Cbc  2.9.9
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
OsiAuxInfo.hpp
Go to the documentation of this file.
1 // Copyright (C) 2006, International Business Machines
2 // Corporation and others. All Rights Reserved.
3 // This code is licensed under the terms of the Eclipse Public License (EPL).
4 
5 #ifndef OsiAuxInfo_H
6 #define OsiAuxInfo_H
7 
9 
10 //#############################################################################
21 class OsiAuxInfo {
22 public:
23  // Default Constructor
24  OsiAuxInfo (void * appData = NULL);
25 
26  // Copy Constructor
27  OsiAuxInfo (const OsiAuxInfo & rhs);
28  // Destructor
29  virtual ~OsiAuxInfo();
30 
32  virtual OsiAuxInfo * clone() const;
34  OsiAuxInfo & operator=(const OsiAuxInfo& rhs);
35 
37  inline void * getApplicationData() const
38  { return appData_;}
39 protected:
41  void * appData_;
42 };
43 //#############################################################################
49 class OsiBabSolver : public OsiAuxInfo {
50 public:
51  // Default Constructor
52  OsiBabSolver (int solverType=0);
53 
54  // Copy Constructor
55  OsiBabSolver (const OsiBabSolver & rhs);
56  // Destructor
57  virtual ~OsiBabSolver();
58 
60  virtual OsiAuxInfo * clone() const;
62  OsiBabSolver & operator=(const OsiBabSolver& rhs);
63 
65  inline void setSolver(const OsiSolverInterface * solver)
66  { solver_ = solver;}
68  inline void setSolver(const OsiSolverInterface & solver)
69  { solver_ = &solver;}
70 
76  int solution(double & objectiveValue,
77  double * newSolution, int numberColumns);
81  void setSolution(const double * solution, int numberColumns, double objectiveValue);
82 
88  bool hasSolution(double & solutionValue, double * solution);
89 
102  inline void setSolverType(int value)
103  { solverType_=value;}
116  inline int solverType() const
117  { return solverType_;}
120  inline bool solutionAddsCuts() const
121  { return solverType_==3;}
123  inline bool alwaysTryCutsAtRootNode() const
124  { return solverType_==4;}
127  inline bool solverAccurate() const
128  { return solverType_==0||solverType_==2||solverType_==4;}
130  inline bool reducedCostsAccurate() const
131  { return solverType_==0||solverType_==4;}
133  double mipBound() const;
135  bool mipFeasible() const;
137  inline void setMipBound(double value)
138  { mipBound_ = value;}
140  inline double bestObjectiveValue() const
141  { return bestObjectiveValue_;}
143  inline bool tryCuts() const
144  { return solverType_!=2;}
146  inline bool warmStart() const
147  { return solverType_!=2;}
152  inline int extraCharacteristics() const
153  { return extraCharacteristics_;}
158  inline void setExtraCharacteristics(int value)
159  { extraCharacteristics_=value;}
161  inline const double * beforeLower() const
162  { return beforeLower_;}
164  inline void setBeforeLower(const double * array)
165  { beforeLower_ = array;}
167  inline const double * beforeUpper() const
168  { return beforeUpper_;}
170  inline void setBeforeUpper(const double * array)
171  { beforeUpper_ = array;}
172 protected:
176  double mipBound_;
180  double * bestSolution_;
182  const double * beforeLower_;
184  const double * beforeUpper_;
204 };
205 
206 #endif
double * bestSolution_
Best integer feasible solution.
Definition: OsiAuxInfo.hpp:180
int solverType() const
gets solver type 0 - normal LP solver 1 - DW - may also return heuristic solutions 2 - NLP solver or ...
Definition: OsiAuxInfo.hpp:116
const OsiSolverInterface * solver_
Solver to use for getting/setting solutions etc.
Definition: OsiAuxInfo.hpp:178
double mipBound_
Current lower bound on solution ( if > 1.0e50 infeasible)
Definition: OsiAuxInfo.hpp:176
int sizeSolution_
Size of solution.
Definition: OsiAuxInfo.hpp:198
OsiBabSolver & operator=(const OsiBabSolver &rhs)
Assignment operator.
OsiAuxInfo(void *appData=NULL)
bool alwaysTryCutsAtRootNode() const
Return true if we should try cuts at root even if looks satisfied.
Definition: OsiAuxInfo.hpp:123
int solution(double &objectiveValue, double *newSolution, int numberColumns)
returns 0 if no heuristic solution, 1 if valid solution with better objective value than one passed i...
This class allows for a more structured use of algorithmic tweaking to an OsiSolverInterface.
Definition: OsiAuxInfo.hpp:21
virtual ~OsiAuxInfo()
bool mipFeasible() const
Returns true if node feasible.
const double * beforeLower_
Pointer to lower bounds before branch (only if extraCharacteristics set)
Definition: OsiAuxInfo.hpp:182
void setBeforeUpper(const double *array)
Set pointer to upper bounds before branch (only if extraCharacteristics set)
Definition: OsiAuxInfo.hpp:170
void setSolution(const double *solution, int numberColumns, double objectiveValue)
Set solution and objective value.
void setBeforeLower(const double *array)
Set pointer to lower bounds before branch (only if extraCharacteristics set)
Definition: OsiAuxInfo.hpp:164
virtual OsiAuxInfo * clone() const
Clone.
void setSolver(const OsiSolverInterface &solver)
Update solver.
Definition: OsiAuxInfo.hpp:68
bool solutionAddsCuts() const
Return true if getting solution may add cuts so hot start etc will be obsolete.
Definition: OsiAuxInfo.hpp:120
bool tryCuts() const
Says whether we want to try cuts at all.
Definition: OsiAuxInfo.hpp:143
virtual OsiAuxInfo * clone() const
Clone.
bool warmStart() const
Says whether we have a warm start (so can do strong branching)
Definition: OsiAuxInfo.hpp:146
bool reducedCostsAccurate() const
Returns true if can use reduced costs for fixing.
Definition: OsiAuxInfo.hpp:130
This class allows for the use of more exotic solvers e.g.
Definition: OsiAuxInfo.hpp:49
void * appData_
Pointer to user-defined data structure.
Definition: OsiAuxInfo.hpp:41
Abstract Base Class for describing an interface to a solver.
bool solverAccurate() const
Returns true if can use solver objective or feasible values, otherwise use mipBound etc...
Definition: OsiAuxInfo.hpp:127
int solverType_
Solver type 0 - normal LP solver 1 - DW - may also return heuristic solutions 2 - NLP solver or simil...
Definition: OsiAuxInfo.hpp:196
double mipBound() const
Get objective (well mip bound)
void setSolverType(int value)
Sets solver type 0 - normal LP solver 1 - DW - may also return heuristic solutions 2 - NLP solver or ...
Definition: OsiAuxInfo.hpp:102
double bestObjectiveValue_
Objective value of best solution (if there is one) (minimization)
Definition: OsiAuxInfo.hpp:174
const double * beforeLower() const
Pointer to lower bounds before branch (only if extraCharacteristics set)
Definition: OsiAuxInfo.hpp:161
void * getApplicationData() const
Get application data.
Definition: OsiAuxInfo.hpp:37
void setExtraCharacteristics(int value)
Set bit mask for odd actions of solvers 1 - solution or bound arrays may move in mysterious ways e...
Definition: OsiAuxInfo.hpp:158
virtual ~OsiBabSolver()
const double * beforeUpper() const
Pointer to upper bounds before branch (only if extraCharacteristics set)
Definition: OsiAuxInfo.hpp:167
OsiAuxInfo & operator=(const OsiAuxInfo &rhs)
Assignment operator.
double bestObjectiveValue() const
Get objective value of saved solution.
Definition: OsiAuxInfo.hpp:140
int extraCharacteristics() const
Get bit mask for odd actions of solvers 1 - solution or bound arrays may move in mysterious ways e...
Definition: OsiAuxInfo.hpp:152
void setSolver(const OsiSolverInterface *solver)
Update solver.
Definition: OsiAuxInfo.hpp:65
int extraCharacteristics_
Bit mask for odd actions of solvers 1 - solution or bound arrays may move in mysterious ways e...
Definition: OsiAuxInfo.hpp:203
OsiBabSolver(int solverType=0)
bool hasSolution(double &solutionValue, double *solution)
returns true if the object stores a solution, false otherwise.
void setMipBound(double value)
Set mip bound (only used for some solvers)
Definition: OsiAuxInfo.hpp:137
const double * beforeUpper_
Pointer to upper bounds before branch (only if extraCharacteristics set)
Definition: OsiAuxInfo.hpp:184