Minotaur 0.4.1
Docs for developers
Public Member Functions | List of all members
Minotaur::OsiLPEngine Class Reference

The OsiLPEngine engine uses the OSI interface to CLP solver. More...

#include <OsiLPEngine.h>

Inheritance diagram for Minotaur::OsiLPEngine:
Inheritance graph
[legend]
Collaboration diagram for Minotaur::OsiLPEngine:
Collaboration graph
[legend]

Public Member Functions

 OsiLPEngine (EnvPtr env)
 Constructor with an environment.
 
 ~OsiLPEngine ()
 Destroy.
 
void addConstraint (ConstraintPtr)
 Add a new constraint to the engine. More...
 
void changeBound (ConstraintPtr cons, BoundType lu, double new_val)
 Change a bound of a constraint. More...
 
void changeBound (VariablePtr var, BoundType lu, double new_val)
 Change a bound of a variable. More...
 
void changeBound (VariablePtr var, double new_lb, double new_ub)
 Change both bounds of a variable. More...
 
void changeConstraint (ConstraintPtr con, LinearFunctionPtr lf, double lb, double ub)
 Change the linear function, and the bounds of a constraint. More...
 
void changeConstraint (ConstraintPtr c, NonlinearFunctionPtr nlf)
 Change the nonlinear function, and the bounds of a constraint. More...
 
void changeObj (FunctionPtr f, double cb)
 Change objective function. More...
 
void clear ()
 Clear the problem. More...
 
void disableStrBrSetup ()
 Restore settings after strong branching. More...
 
EnginePtr emptyCopy ()
 Return an empty OsiLPEngine pointer. More...
 
void enableFactorization ()
 
void disableFactorization ()
 
void enableStrBrSetup ()
 Make settings for strong branching. More...
 
void fillStats (std::vector< double > &)
 Accumulate statistics from different threads in a common data. More...
 
void getBasics (int *index)
 
void getBInvARow (int row, double *z, double *slack)
 
void getBasisStatus (int *cstat, int *rstat)
 
const double * getColLower ()
 
const double * getColUpper ()
 
const double * getRowLower ()
 
const double * getRowUpper ()
 
const double * getRightHandSide ()
 
int getNumCols ()
 
int getNumRows ()
 
const double * getRowActivity ()
 
const double * getOriginalTableau ()
 
const int * getRowStarts ()
 
const int * getIndicesofVars ()
 
const int * getRowLength ()
 
double getSolutionValue ()
 Return the solution value of the objective after solving the LP. More...
 
ConstSolutionPtr getSolution ()
 Get the solution obtained after solving the problem. More...
 
EngineStatus getStatus ()
 Get the status of the last solve command. More...
 
int getIterationCount ()
 
std::string getName () const
 Get the name. More...
 
ConstWarmStartPtr getWarmStart ()
 Return the osilp interface. For hacks. More...
 
WarmStartPtr getWarmStartCopy ()
 
bool IsOptimalBasisAvailable ()
 
void load (ProblemPtr problem)
 
void loadFromWarmStart (const WarmStartPtr ws)
 
void loadDualWarmStart (int size, double *dualVec)
 
void negateObj ()
 Negate the objective function. Min f is changed to Min -f. More...
 
void removeCons (std::vector< ConstraintPtr > &delcons)
 Delete constraints from the engine. More...
 
void resetIterationLimit ()
 Reset the iteration limit to maximum possible. More...
 
void setIterationLimit (int limit)
 
int setDualObjLimit (double)
 Set the dual objective limit. More...
 
EngineStatus solve ()
 
void writeLP (const char *filename) const
 Writes an LP file of the loaded LP.
 
void writeStats (std::ostream &out) const
 Write statistics. More...
 
- Public Member Functions inherited from Minotaur::LPEngine
 LPEngine ()
 Constructor. May set default parameters/options here.
 
virtual ~LPEngine ()
 Destructor must be implemented if memory needs to be freed.
 
virtual void enableFactorization ()
 
virtual void disableFactorization ()
 
virtual bool IsOptimalBasisAvailable ()
 
virtual void getBasics (int *)
 
virtual void getBInvARow (int, double *, double *)
 
virtual int getNumCols ()
 
virtual int getNumRows ()
 
virtual const double * getColLower ()
 
virtual const double * getColUpper ()
 
virtual const double * getRowLower ()
 
virtual const double * getRowUpper ()
 
virtual const double * getRightHandSide ()
 
virtual const double * getRowActivity ()
 
virtual const double * getOriginalTableau ()
 
virtual const int * getRowStarts ()
 
virtual const int * getIndicesofVars ()
 
virtual const int * getRowLength ()
 
virtual void loadDualWarmStart (int, double *)
 
- Public Member Functions inherited from Minotaur::Engine
 Engine ()
 Default constructor.
 
virtual ~Engine ()
 Destroy.
 
virtual void addConstraint (ConstraintPtr)=0
 Add a new constraint to the engine. More...
 
virtual void changeBound (ConstraintPtr cons, BoundType lu, double new_val)=0
 Change a bound of a constraint. More...
 
virtual void changeBound (VariablePtr var, BoundType lu, double new_val)=0
 Change a bound of a variable. More...
 
virtual void changeBound (VariablePtr var, double new_lb, double new_ub)=0
 Change both bounds of a variable. More...
 
virtual void changeConstraint (ConstraintPtr c, LinearFunctionPtr lf, double lb, double ub)=0
 Change the linear function, and the bounds of a constraint. More...
 
virtual void changeConstraint (ConstraintPtr c, NonlinearFunctionPtr nlf)=0
 Change the nonlinear function, and the bounds of a constraint. More...
 
virtual void changeObj (FunctionPtr f, double cb)=0
 Change objective function. More...
 
virtual void clear ()=0
 Clear the loaded problem, if any, from the engine. More...
 
virtual void disableStrBrSetup ()=0
 Restore settings after strong branching. More...
 
virtual EnginePtr emptyCopy ()
 Get a fresh copy of the engine, without the problem loaded into it. More...
 
virtual void enableStrBrSetup ()=0
 Make settings for strong branching. More...
 
virtual ConstSolutionPtr getSolution ()=0
 Get the solution obtained after solving the problem. More...
 
virtual double getSolutionValue ()=0
 Get the solution value. More...
 
virtual EngineStatus solve ()=0
 Solve the problem that was loaded previously. More...
 
virtual std::string getName () const =0
 Get the name. More...
 
virtual EngineStatus getStatus ()=0
 Get the status of the last solve command. More...
 
virtual std::string getStatusString ()
 Return a string that describes the status in simple words.
 
virtual ConstWarmStartPtr getWarmStart ()=0
 
virtual WarmStartPtr getWarmStartCopy ()=0
 
virtual void load (ProblemPtr problem)=0
 
virtual void loadFromWarmStart (const WarmStartPtr ws)=0
 
virtual void negateObj ()=0
 Negate the objective function. Min f is changed to Min -f. More...
 
virtual LoggerPtr getLogger ()
 Return pointer to the log manager.
 
virtual void removeCons (std::vector< ConstraintPtr > &delcons)=0
 Delete constraints from the engine. More...
 
virtual void resetIterationLimit ()=0
 Reset the iteration limit to maximum possible. More...
 
virtual int setDualObjLimit (double)=0
 Set the dual objective limit. More...
 
virtual void setIterationLimit (int limit)=0
 
virtual void setLogger (LoggerPtr logger)
 Set a new log manager.
 
virtual void setOptionsForSingleSolve ()
 
virtual void setOptionsForRepeatedSolve ()
 Set options to solve the NLP repeatedly, with few changes. More...
 
virtual void writeStats (std::ostream &) const
 
virtual void fillStats (std::vector< double > &)
 Accumulate statistics from different threads in a common data. More...
 

Additional Inherited Members

- Protected Attributes inherited from Minotaur::Engine
EngineStatus status_
 Status of the last solve.
 
LoggerPtr logger_
 Keep log.
 

Detailed Description

The OsiLPEngine engine uses the OSI interface to CLP solver.

Member Function Documentation

◆ addConstraint()

void OsiLPEngine::addConstraint ( ConstraintPtr  )
virtual

Add a new constraint to the engine.

Implements Minotaur::Engine.

◆ changeBound() [1/3]

void OsiLPEngine::changeBound ( ConstraintPtr  cons,
BoundType  lu,
double  new_val 
)
virtual

Change a bound of a constraint.

Implements Minotaur::Engine.

◆ changeBound() [2/3]

void OsiLPEngine::changeBound ( VariablePtr  var,
BoundType  lu,
double  new_val 
)
virtual

Change a bound of a variable.

Implements Minotaur::Engine.

◆ changeBound() [3/3]

void OsiLPEngine::changeBound ( VariablePtr  var,
double  new_lb,
double  new_ub 
)
virtual

Change both bounds of a variable.

Implements Minotaur::Engine.

◆ changeConstraint() [1/2]

void OsiLPEngine::changeConstraint ( ConstraintPtr  c,
NonlinearFunctionPtr  nlf 
)
virtual

Change the nonlinear function, and the bounds of a constraint.

Parameters
[in]cOriginal constraint that is to be changed.
[nlf]The new nonlinear function.

Implements Minotaur::Engine.

◆ changeConstraint() [2/2]

void OsiLPEngine::changeConstraint ( ConstraintPtr  c,
LinearFunctionPtr  lf,
double  lb,
double  ub 
)
virtual

Change the linear function, and the bounds of a constraint.

Parameters
[in]cOriginal constraint that is to be changed.
[lf]The new linear function.
[lb]The new lower bound.
[ub]The new upper bound.

Implements Minotaur::Engine.

◆ changeObj()

void OsiLPEngine::changeObj ( FunctionPtr  f,
double  cb 
)
virtual

Change objective function.

Implements Minotaur::Engine.

◆ clear()

void OsiLPEngine::clear ( )
virtual

Clear the problem.

Implements Minotaur::Engine.

◆ disableFactorization()

void OsiLPEngine::disableFactorization ( )
virtual

Reimplemented from Minotaur::LPEngine.

◆ disableStrBrSetup()

void OsiLPEngine::disableStrBrSetup ( )
virtual

Restore settings after strong branching.

Implements Minotaur::Engine.

◆ emptyCopy()

EnginePtr OsiLPEngine::emptyCopy ( )
virtual

Return an empty OsiLPEngine pointer.

Reimplemented from Minotaur::Engine.

◆ enableFactorization()

void OsiLPEngine::enableFactorization ( )
virtual

Reimplemented from Minotaur::LPEngine.

◆ enableStrBrSetup()

void OsiLPEngine::enableStrBrSetup ( )
virtual

Make settings for strong branching.

Implements Minotaur::Engine.

◆ fillStats()

void OsiLPEngine::fillStats ( std::vector< double > &  )
virtual

Accumulate statistics from different threads in a common data.

Reimplemented from Minotaur::Engine.

◆ getBasics()

void OsiLPEngine::getBasics ( int *  index)
virtual

Reimplemented from Minotaur::LPEngine.

◆ getBInvARow()

void OsiLPEngine::getBInvARow ( int  row,
double *  z,
double *  slack 
)
virtual

Reimplemented from Minotaur::LPEngine.

◆ getColLower()

const double * OsiLPEngine::getColLower ( )
virtual

Reimplemented from Minotaur::LPEngine.

◆ getColUpper()

const double * OsiLPEngine::getColUpper ( )
virtual

Reimplemented from Minotaur::LPEngine.

◆ getIndicesofVars()

const int * OsiLPEngine::getIndicesofVars ( )
virtual

Reimplemented from Minotaur::LPEngine.

◆ getIterationCount()

int OsiLPEngine::getIterationCount ( )

Return the number of iterations it took to solve the last problem.

◆ getName()

std::string OsiLPEngine::getName ( ) const
virtual

Get the name.

Implements Minotaur::Engine.

◆ getNumCols()

int OsiLPEngine::getNumCols ( )
virtual

Reimplemented from Minotaur::LPEngine.

◆ getNumRows()

int OsiLPEngine::getNumRows ( )
virtual

Reimplemented from Minotaur::LPEngine.

◆ getOriginalTableau()

const double * OsiLPEngine::getOriginalTableau ( )
virtual

Reimplemented from Minotaur::LPEngine.

◆ getRightHandSide()

const double * OsiLPEngine::getRightHandSide ( )
virtual

Reimplemented from Minotaur::LPEngine.

◆ getRowActivity()

const double * OsiLPEngine::getRowActivity ( )
virtual

Reimplemented from Minotaur::LPEngine.

◆ getRowLength()

const int * OsiLPEngine::getRowLength ( )
virtual

Reimplemented from Minotaur::LPEngine.

◆ getRowLower()

const double * OsiLPEngine::getRowLower ( )
virtual

Reimplemented from Minotaur::LPEngine.

◆ getRowStarts()

const int * OsiLPEngine::getRowStarts ( )
virtual

Reimplemented from Minotaur::LPEngine.

◆ getRowUpper()

const double * OsiLPEngine::getRowUpper ( )
virtual

Reimplemented from Minotaur::LPEngine.

◆ getSolution()

ConstSolutionPtr OsiLPEngine::getSolution ( )
virtual

Get the solution obtained after solving the problem.

Implements Minotaur::Engine.

◆ getSolutionValue()

double OsiLPEngine::getSolutionValue ( )
virtual

Return the solution value of the objective after solving the LP.

Implements Minotaur::Engine.

◆ getStatus()

EngineStatus OsiLPEngine::getStatus ( )
virtual

Get the status of the last solve command.

Implements Minotaur::Engine.

◆ getWarmStart()

ConstWarmStartPtr Minotaur::OsiLPEngine::getWarmStart ( )
inlinevirtual

Return the osilp interface. For hacks.

Implements Minotaur::Engine.

◆ getWarmStartCopy()

WarmStartPtr OsiLPEngine::getWarmStartCopy ( )
virtual

Get a full copy of warm start information from the engine. Does not change even if the engine starts solving something else later on.

Implements Minotaur::Engine.

◆ IsOptimalBasisAvailable()

bool OsiLPEngine::IsOptimalBasisAvailable ( )
virtual

Reimplemented from Minotaur::LPEngine.

◆ load()

void OsiLPEngine::load ( ProblemPtr  problem)
virtual

Load the problem into the engine. We create arrays of variables and constraints, the A matrix, rhs, objective etc from the problem and initialize the LP solver.

Implements Minotaur::Engine.

◆ loadDualWarmStart()

void OsiLPEngine::loadDualWarmStart ( int  size,
double *  dualVec 
)
virtual

Reimplemented from Minotaur::LPEngine.

◆ loadFromWarmStart()

void OsiLPEngine::loadFromWarmStart ( const WarmStartPtr  ws)
virtual

Use warm start information for solving the next problem. May Create a copy of WarmStart and use the copy inside the engine; the copy (but not the original) gets updated after solving a relaxation.

Implements Minotaur::Engine.

◆ negateObj()

void OsiLPEngine::negateObj ( )
virtual

Negate the objective function. Min f is changed to Min -f.

Implements Minotaur::Engine.

◆ removeCons()

void OsiLPEngine::removeCons ( std::vector< ConstraintPtr > &  delcons)
virtual

Delete constraints from the engine.

Parameters
[in]delconsA vector of constraint pointers that should be deleted from the engine.

Implements Minotaur::Engine.

◆ resetIterationLimit()

void OsiLPEngine::resetIterationLimit ( )
virtual

Reset the iteration limit to maximum possible.

Implements Minotaur::Engine.

◆ setDualObjLimit()

int Minotaur::OsiLPEngine::setDualObjLimit ( double  )
inlinevirtual

Set the dual objective limit.

Implements Minotaur::Engine.

◆ setIterationLimit()

void OsiLPEngine::setIterationLimit ( int  limit)
virtual

Set a limit on number of iterations. For strong-branching, for instance.

Implements Minotaur::Engine.

◆ solve()

EngineStatus OsiLPEngine::solve ( )
virtual

Solve the problem that was loaded. Calls resolve() function of Osi. The resolve() function `‘smartly’' decides what method of clp should be called.

Implements Minotaur::Engine.

◆ writeStats()

void OsiLPEngine::writeStats ( std::ostream &  out) const
virtual

Write statistics.

Reimplemented from Minotaur::Engine.


The documentation for this class was generated from the following files:

Minotaur source code documented by Doxygen 1.9.4 on Thu Apr 24 2025