Clp  1.17.6
 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  {
39  return appData_;
40  }
41 
42 protected:
44  void *appData_;
45 };
46 //#############################################################################
52 class OsiBabSolver : public OsiAuxInfo {
53 public:
54  // Default Constructor
55  OsiBabSolver(int solverType = 0);
56 
57  // Copy Constructor
58  OsiBabSolver(const OsiBabSolver &rhs);
59  // Destructor
60  virtual ~OsiBabSolver();
61 
63  virtual OsiAuxInfo *clone() const;
65  OsiBabSolver &operator=(const OsiBabSolver &rhs);
66 
68  inline void setSolver(const OsiSolverInterface *solver)
69  {
70  solver_ = solver;
71  }
73  inline void setSolver(const OsiSolverInterface &solver)
74  {
75  solver_ = &solver;
76  }
77 
83  int solution(double &objectiveValue,
84  double *newSolution, int numberColumns);
88  void setSolution(const double *solution, int numberColumns, double objectiveValue);
89 
95  bool hasSolution(double &solutionValue, double *solution);
96 
109  inline void setSolverType(int value)
110  {
111  solverType_ = value;
112  }
125  inline int solverType() const
126  {
127  return solverType_;
128  }
131  inline bool solutionAddsCuts() const
132  {
133  return solverType_ == 3;
134  }
136  inline bool alwaysTryCutsAtRootNode() const
137  {
138  return solverType_ == 4;
139  }
142  inline bool solverAccurate() const
143  {
144  return solverType_ == 0 || solverType_ == 2 || solverType_ == 4;
145  }
147  inline bool reducedCostsAccurate() const
148  {
149  return solverType_ == 0 || solverType_ == 4;
150  }
152  double mipBound() const;
154  bool mipFeasible() const;
156  inline void setMipBound(double value)
157  {
158  mipBound_ = value;
159  }
161  inline double bestObjectiveValue() const
162  {
163  return bestObjectiveValue_;
164  }
166  inline bool tryCuts() const
167  {
168  return solverType_ != 2;
169  }
171  inline bool warmStart() const
172  {
173  return solverType_ != 2;
174  }
179  inline int extraCharacteristics() const
180  {
181  return extraCharacteristics_;
182  }
187  inline void setExtraCharacteristics(int value)
188  {
189  extraCharacteristics_ = value;
190  }
192  inline const double *beforeLower() const
193  {
194  return beforeLower_;
195  }
197  inline void setBeforeLower(const double *array)
198  {
199  beforeLower_ = array;
200  }
202  inline const double *beforeUpper() const
203  {
204  return beforeUpper_;
205  }
207  inline void setBeforeUpper(const double *array)
208  {
209  beforeUpper_ = array;
210  }
212  inline void setExtraPointer(void *extraInfo)
213  {
214  extraInfo_ = extraInfo;
215  }
217  inline void *getExtraPointer() const
218  {
219  return extraInfo_;
220  }
221 
222 protected:
226  double mipBound_;
230  double *bestSolution_;
232  const double *beforeLower_;
234  const double *beforeUpper_;
236  void *extraInfo_;
256 };
257 
258 #endif
259 
260 /* vi: softtabstop=2 shiftwidth=2 expandtab tabstop=2
261 */
double * bestSolution_
Best integer feasible solution.
Definition: OsiAuxInfo.hpp:230
int solverType() const
gets solver type 0 - normal LP solver 1 - DW - may also return heuristic solutions 2 - NLP solver or ...
Definition: OsiAuxInfo.hpp:125
const OsiSolverInterface * solver_
Solver to use for getting/setting solutions etc.
Definition: OsiAuxInfo.hpp:228
double mipBound_
Current lower bound on solution ( if > 1.0e50 infeasible)
Definition: OsiAuxInfo.hpp:226
int sizeSolution_
Size of solution.
Definition: OsiAuxInfo.hpp:250
OsiBabSolver & operator=(const OsiBabSolver &rhs)
Assignment operator.
void * extraInfo_
Pointer to extra info.
Definition: OsiAuxInfo.hpp:236
OsiAuxInfo(void *appData=NULL)
bool alwaysTryCutsAtRootNode() const
Return true if we should try cuts at root even if looks satisfied.
Definition: OsiAuxInfo.hpp:136
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:232
void setBeforeUpper(const double *array)
Set pointer to upper bounds before branch (only if extraCharacteristics set)
Definition: OsiAuxInfo.hpp:207
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:197
virtual OsiAuxInfo * clone() const
Clone.
void setSolver(const OsiSolverInterface &solver)
Update solver.
Definition: OsiAuxInfo.hpp:73
bool solutionAddsCuts() const
Return true if getting solution may add cuts so hot start etc will be obsolete.
Definition: OsiAuxInfo.hpp:131
bool tryCuts() const
Says whether we want to try cuts at all.
Definition: OsiAuxInfo.hpp:166
virtual OsiAuxInfo * clone() const
Clone.
bool warmStart() const
Says whether we have a warm start (so can do strong branching)
Definition: OsiAuxInfo.hpp:171
bool reducedCostsAccurate() const
Returns true if can use reduced costs for fixing.
Definition: OsiAuxInfo.hpp:147
This class allows for the use of more exotic solvers e.g.
Definition: OsiAuxInfo.hpp:52
void * appData_
Pointer to user-defined data structure.
Definition: OsiAuxInfo.hpp:44
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:142
int solverType_
Solver type 0 - normal LP solver 1 - DW - may also return heuristic solutions 2 - NLP solver or simil...
Definition: OsiAuxInfo.hpp:248
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:109
double bestObjectiveValue_
Objective value of best solution (if there is one) (minimization)
Definition: OsiAuxInfo.hpp:224
const double * beforeLower() const
Pointer to lower bounds before branch (only if extraCharacteristics set)
Definition: OsiAuxInfo.hpp:192
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:187
virtual ~OsiBabSolver()
const double * beforeUpper() const
Pointer to upper bounds before branch (only if extraCharacteristics set)
Definition: OsiAuxInfo.hpp:202
void * getExtraPointer() const
get pointer to extra info
Definition: OsiAuxInfo.hpp:217
OsiAuxInfo & operator=(const OsiAuxInfo &rhs)
Assignment operator.
double bestObjectiveValue() const
Get objective value of saved solution.
Definition: OsiAuxInfo.hpp:161
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:179
void setSolver(const OsiSolverInterface *solver)
Update solver.
Definition: OsiAuxInfo.hpp:68
int extraCharacteristics_
Bit mask for odd actions of solvers 1 - solution or bound arrays may move in mysterious ways e...
Definition: OsiAuxInfo.hpp:255
OsiBabSolver(int solverType=0)
bool hasSolution(double &solutionValue, double *solution)
returns true if the object stores a solution, false otherwise.
void setExtraPointer(void *extraInfo)
Set pointer to extra stuff.
Definition: OsiAuxInfo.hpp:212
void setMipBound(double value)
Set mip bound (only used for some solvers)
Definition: OsiAuxInfo.hpp:156
const double * beforeUpper_
Pointer to upper bounds before branch (only if extraCharacteristics set)
Definition: OsiAuxInfo.hpp:234