Debian Codegraph @

Bonmin/src/CbcBonmin/Heuristics/BonHeuristicFPump.hpp

raw
1 // Copyright (C) 2007, International Business Machines Corporation and others.
2 // All Rights Reserved.
3 // This code is published under the Eclipse Public License.
4 //
5 // Authors :
6 // Joao P. Goncalves, International Business Machines Corporation
7 //
8 // Date : November 12, 2007
9
10 #ifndef BonHeuristicFPump_HPP
11 #define BonHeuristicFPump_HPP
12 #include "BonOsiTMINLPInterface.hpp"
13 #include "BonBonminSetup.hpp"
14 #include "CbcHeuristic.hpp"
15
16 namespace Bonmin
17 {
18 class HeuristicFPump : public CbcHeuristic
19 {
20 public:
21 /// Default constructor
22 HeuristicFPump();
23
24 /// Constructor with setup
25 HeuristicFPump(BonminSetup * setup);
26
27 /// Copy constructor
28 HeuristicFPump(const HeuristicFPump &copy);
29
30 /// Destructor
31 ~HeuristicFPump() {}
32
33 /// Assignment operator
34 HeuristicFPump & operator=(const HeuristicFPump & rhs);
35
36 /** Virtual constructor.*/
37 virtual CbcHeuristic * clone() const{
38 return new HeuristicFPump(*this);
39 }
40
41 /// Resets stuff if model changes
42 virtual void resetModel(CbcModel * model){
43 setModel(model);
44 }
45
46 /** Change setup used for heuristic.*/
47 void setSetup(BonminSetup * setup){
48 setup_ = setup;
49 Initialize(setup_->options());
50 }
51
52 /// Performs heuristic
53 virtual int solution(double &solutionValue, double *betterSolution);
54
55 /// Performs heuristic with add cust
56 virtual int solution(double &solutionValue, double *betterSolution, OsiCuts & cs)
57 {
58 return solution(solutionValue, betterSolution);
59 }
60
61 /** Register the options for this heuristic */
62 static void registerOptions(Ipopt::SmartPtr<Bonmin::RegisteredOptions> roptions);
63
64 /** Initiaize using passed options.*/
65 void Initialize(Ipopt::SmartPtr<Ipopt::OptionsList> options);
66
67 private:
68 /** Setup to use for local searches (will make copies).*/
69 BonminSetup * setup_;
70
71 /** Norm of the objective function - either 1 or 2 */
72 int objective_norm_;
73
74 /// To enable advanced unstable stuff
75 int enableAdvanced_;
76 };
77
78 class RoundingFPump
79 {
80 public:
81 /// Default constructor
82 RoundingFPump(TMINLP2TNLP* minlp);
83
84 /// Destructor
85 ~RoundingFPump();
86
87 /// Rounds the solution
88 void round(const double integerTolerance,
89 const double primalTolerance,
90 double* solution);
91
92 private:
93 /// gutsOfConstructor
94 void gutsOfConstructor();
95
96 /// Pointer to problem
97 TMINLP2TNLP* minlp_;
98
99 /// Number of rows
100 int numberRows_;
101
102 /// Number of columns
103 int numberColumns_;
104
105 /// Jacobian of g
106 std::vector<std::pair<int, int> >* col_and_jac_g_;
107
108 };
109
110 }
111 #endif