Cgl 0.60.2

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

- File List
- File Members

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
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 {
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:
224 double bestObjectiveValue_;
226 double mipBound_;
228 const OsiSolverInterface *solver_;
230 double *bestSolution_;
232 const double *beforeLower_;
234 const double *beforeUpper_;
236 void *extraInfo_;
248 int solverType_;
250 int sizeSolution_;
255 int extraCharacteristics_;
256 };
257
258 #endif
259
260 /* vi: softtabstop=2 shiftwidth=2 expandtab tabstop=2
261 */
OsiBabSolver::bestSolution_
double * bestSolution_
Best integer feasible solution.
Definition: OsiAuxInfo.hpp:230
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:125
OsiBabSolver::solver_
const OsiSolverInterface * solver_
Solver to use for getting/setting solutions etc.
Definition: OsiAuxInfo.hpp:228
OsiBabSolver::mipBound_
double mipBound_
Current lower bound on solution ( if &gt; 1.0e50 infeasible)
Definition: OsiAuxInfo.hpp:226
OsiBabSolver::sizeSolution_
int sizeSolution_
Size of solution.
Definition: OsiAuxInfo.hpp:250
OsiBabSolver::operator=
OsiBabSolver & operator=(const OsiBabSolver &rhs)
Assignment operator.
OsiBabSolver::extraInfo_
void * extraInfo_
Pointer to extra info.
Definition: OsiAuxInfo.hpp:236
OsiAuxInfo::OsiAuxInfo
OsiAuxInfo(void *appData=NULL)
OsiBabSolver::alwaysTryCutsAtRootNode
bool alwaysTryCutsAtRootNode() const
Return true if we should try cuts at root even if looks satisfied.
Definition: OsiAuxInfo.hpp:136
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...
OsiAuxInfo
This class allows for a more structured use of algorithmic tweaking to an OsiSolverInterface.
Definition: OsiAuxInfo.hpp:21
OsiAuxInfo::~OsiAuxInfo
virtual ~OsiAuxInfo()
OsiBabSolver::mipFeasible
bool mipFeasible() const
Returns true if node feasible.
OsiBabSolver::beforeLower_
const double * beforeLower_
Pointer to lower bounds before branch (only if extraCharacteristics set)
Definition: OsiAuxInfo.hpp:232
OsiBabSolver::setBeforeUpper
void setBeforeUpper(const double *array)
Set pointer to upper bounds before branch (only if extraCharacteristics set)
Definition: OsiAuxInfo.hpp:207
OsiBabSolver::setSolution
void setSolution(const double *solution, int numberColumns, double objectiveValue)
Set solution and objective value.
OsiBabSolver::setBeforeLower
void setBeforeLower(const double *array)
Set pointer to lower bounds before branch (only if extraCharacteristics set)
Definition: OsiAuxInfo.hpp:197
OsiBabSolver::clone
virtual OsiAuxInfo * clone() const
Clone.
OsiBabSolver::setSolver
void setSolver(const OsiSolverInterface &solver)
Update solver.
Definition: OsiAuxInfo.hpp:73
OsiBabSolver::solutionAddsCuts
bool solutionAddsCuts() const
Return true if getting solution may add cuts so hot start etc will be obsolete.
Definition: OsiAuxInfo.hpp:131
OsiBabSolver::tryCuts
bool tryCuts() const
Says whether we want to try cuts at all.
Definition: OsiAuxInfo.hpp:166
OsiAuxInfo::clone
virtual OsiAuxInfo * clone() const
Clone.
OsiBabSolver::warmStart
bool warmStart() const
Says whether we have a warm start (so can do strong branching)
Definition: OsiAuxInfo.hpp:171
OsiBabSolver::reducedCostsAccurate
bool reducedCostsAccurate() const
Returns true if can use reduced costs for fixing.
Definition: OsiAuxInfo.hpp:147
OsiBabSolver
This class allows for the use of more exotic solvers e.g.
Definition: OsiAuxInfo.hpp:52
OsiAuxInfo::appData_
void * appData_
Pointer to user-defined data structure.
Definition: OsiAuxInfo.hpp:44
OsiSolverInterface
Abstract Base Class for describing an interface to a solver.
Definition: OsiSolverInterface.hpp:61
OsiBabSolver::solverAccurate
bool solverAccurate() const
Returns true if can use solver objective or feasible values, otherwise use mipBound etc...
Definition: OsiAuxInfo.hpp:142
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:248
OsiBabSolver::mipBound
double mipBound() const
Get objective (well mip bound)
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:109
OsiBabSolver::bestObjectiveValue_
double bestObjectiveValue_
Objective value of best solution (if there is one) (minimization)
Definition: OsiAuxInfo.hpp:224
OsiBabSolver::beforeLower
const double * beforeLower() const
Pointer to lower bounds before branch (only if extraCharacteristics set)
Definition: OsiAuxInfo.hpp:192
OsiAuxInfo::getApplicationData
void * getApplicationData() const
Get application data.
Definition: OsiAuxInfo.hpp:37
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:187
OsiBabSolver::~OsiBabSolver
virtual ~OsiBabSolver()
OsiBabSolver::beforeUpper
const double * beforeUpper() const
Pointer to upper bounds before branch (only if extraCharacteristics set)
Definition: OsiAuxInfo.hpp:202
OsiBabSolver::getExtraPointer
void * getExtraPointer() const
get pointer to extra info
Definition: OsiAuxInfo.hpp:217
OsiAuxInfo::operator=
OsiAuxInfo & operator=(const OsiAuxInfo &rhs)
Assignment operator.
OsiBabSolver::bestObjectiveValue
double bestObjectiveValue() const
Get objective value of saved solution.
Definition: OsiAuxInfo.hpp:161
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:179
OsiBabSolver::setSolver
void setSolver(const OsiSolverInterface *solver)
Update solver.
Definition: OsiAuxInfo.hpp:68
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:255
OsiBabSolver::OsiBabSolver
OsiBabSolver(int solverType=0)
OsiBabSolver::hasSolution
bool hasSolution(double &solutionValue, double *solution)
returns true if the object stores a solution, false otherwise.
OsiBabSolver::setExtraPointer
void setExtraPointer(void *extraInfo)
Set pointer to extra stuff.
Definition: OsiAuxInfo.hpp:212
OsiBabSolver::setMipBound
void setMipBound(double value)
Set mip bound (only used for some solvers)
Definition: OsiAuxInfo.hpp:156
OsiBabSolver::beforeUpper_
const double * beforeUpper_
Pointer to upper bounds before branch (only if extraCharacteristics set)
Definition: OsiAuxInfo.hpp:234