- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

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
8 class OsiSolverInterface;
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:
174 double bestObjectiveValue_;
176 double mipBound_;
178 const OsiSolverInterface * solver_;
180 double * bestSolution_;
182 const double * beforeLower_;
184 const double * beforeUpper_;
196 int solverType_;
198 int sizeSolution_;
203 int extraCharacteristics_;
204 };
205
206 #endif
OsiBabSolver
This class allows for the use of more exotic solvers e.g.
Definition: OsiAuxInfo.hpp:49
OsiBabSolver::setSolverType
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
OsiBabSolver::solution
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...
OsiBabSolver::solver_
const OsiSolverInterface * solver_
Solver to use for getting/setting solutions etc.
Definition: OsiAuxInfo.hpp:178
OsiBabSolver::setBeforeLower
void setBeforeLower(const double *array)
Set pointer to lower bounds before branch (only if extraCharacteristics set)
Definition: OsiAuxInfo.hpp:164
OsiBabSolver::setSolution
void setSolution(const double *solution, int numberColumns, double objectiveValue)
Set solution and objective value.
OsiBabSolver::clone
virtual OsiAuxInfo * clone() const
Clone.
OsiBabSolver::solverType_
int solverType_
Solver type 0 - normal LP solver 1 - DW - may also return heuristic solutions 2 - NLP solver or simil...
Definition: OsiAuxInfo.hpp:196
OsiBabSolver::reducedCostsAccurate
bool reducedCostsAccurate() const
Returns true if can use reduced costs for fixing.
Definition: OsiAuxInfo.hpp:130
OsiAuxInfo
This class allows for a more structured use of algorithmic tweaking to an OsiSolverInterface.
Definition: OsiAuxInfo.hpp:21
OsiBabSolver::hasSolution
bool hasSolution(double &solutionValue, double *solution)
returns true if the object stores a solution, false otherwise.
OsiBabSolver::sizeSolution_
int sizeSolution_
Size of solution.
Definition: OsiAuxInfo.hpp:198
OsiBabSolver::setBeforeUpper
void setBeforeUpper(const double *array)
Set pointer to upper bounds before branch (only if extraCharacteristics set)
Definition: OsiAuxInfo.hpp:170
OsiBabSolver::OsiBabSolver
OsiBabSolver(int solverType=0)
OsiBabSolver::beforeUpper
const double * beforeUpper() const
Pointer to upper bounds before branch (only if extraCharacteristics set)
Definition: OsiAuxInfo.hpp:167
OsiBabSolver::beforeUpper_
const double * beforeUpper_
Pointer to upper bounds before branch (only if extraCharacteristics set)
Definition: OsiAuxInfo.hpp:184
OsiBabSolver::alwaysTryCutsAtRootNode
bool alwaysTryCutsAtRootNode() const
Return true if we should try cuts at root even if looks satisfied.
Definition: OsiAuxInfo.hpp:123
OsiBabSolver::extraCharacteristics
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
OsiBabSolver::bestObjectiveValue_
double bestObjectiveValue_
Objective value of best solution (if there is one) (minimization)
Definition: OsiAuxInfo.hpp:174
OsiBabSolver::beforeLower
const double * beforeLower() const
Pointer to lower bounds before branch (only if extraCharacteristics set)
Definition: OsiAuxInfo.hpp:161
OsiBabSolver::solutionAddsCuts
bool solutionAddsCuts() const
Return true if getting solution may add cuts so hot start etc will be obsolete.
Definition: OsiAuxInfo.hpp:120
OsiBabSolver::solverType
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
OsiBabSolver::setSolver
void setSolver(const OsiSolverInterface &solver)
Update solver.
Definition: OsiAuxInfo.hpp:68
OsiBabSolver::beforeLower_
const double * beforeLower_
Pointer to lower bounds before branch (only if extraCharacteristics set)
Definition: OsiAuxInfo.hpp:182
OsiBabSolver::extraCharacteristics_
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::setMipBound
void setMipBound(double value)
Set mip bound (only used for some solvers)
Definition: OsiAuxInfo.hpp:137
OsiBabSolver::~OsiBabSolver
virtual ~OsiBabSolver()
OsiBabSolver::mipBound_
double mipBound_
Current lower bound on solution ( if &gt; 1.0e50 infeasible)
Definition: OsiAuxInfo.hpp:176
OsiAuxInfo::OsiAuxInfo
OsiAuxInfo(void *appData=NULL)
OsiBabSolver::tryCuts
bool tryCuts() const
Says whether we want to try cuts at all.
Definition: OsiAuxInfo.hpp:143
OsiBabSolver::solverAccurate
bool solverAccurate() const
Returns true if can use solver objective or feasible values, otherwise use mipBound etc...
Definition: OsiAuxInfo.hpp:127
OsiAuxInfo::clone
virtual OsiAuxInfo * clone() const
Clone.
OsiSolverInterface
Abstract Base Class for describing an interface to a solver.
Definition: OsiSolverInterface.hpp:62
OsiBabSolver::setSolver
void setSolver(const OsiSolverInterface *solver)
Update solver.
Definition: OsiAuxInfo.hpp:65
OsiAuxInfo::~OsiAuxInfo
virtual ~OsiAuxInfo()
OsiBabSolver::warmStart
bool warmStart() const
Says whether we have a warm start (so can do strong branching)
Definition: OsiAuxInfo.hpp:146
OsiAuxInfo::getApplicationData
void * getApplicationData() const
Get application data.
Definition: OsiAuxInfo.hpp:37
OsiAuxInfo::operator=
OsiAuxInfo & operator=(const OsiAuxInfo &rhs)
Assignment operator.
OsiBabSolver::mipBound
double mipBound() const
Get objective (well mip bound)
OsiBabSolver::mipFeasible
bool mipFeasible() const
Returns true if node feasible.
OsiBabSolver::operator=
OsiBabSolver & operator=(const OsiBabSolver &rhs)
Assignment operator.
OsiBabSolver::setExtraCharacteristics
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
OsiAuxInfo::appData_
void * appData_
Pointer to user-defined data structure.
Definition: OsiAuxInfo.hpp:41
OsiBabSolver::bestSolution_
double * bestSolution_
Best integer feasible solution.
Definition: OsiAuxInfo.hpp:180
OsiBabSolver::bestObjectiveValue
double bestObjectiveValue() const
Get objective value of saved solution.
Definition: OsiAuxInfo.hpp:140