BlockIPPlatform
 All Classes Files Functions Variables
Public Member Functions | Private Member Functions | Private Attributes | List of all members
OsiInterface Class Reference

Interface class to solve problems through Osi. More...

#include <OsiInterface.h>

Collaboration diagram for OsiInterface:
Collaboration graph
[legend]

Public Member Functions

 OsiInterface (SOLVER solver)
 Constructor.
 
 ~OsiInterface ()
 Destructor.
 
void setMaxTime (double time)
 Set maximum time allowed to solve the problem.
 
double getMaxTime ()
 Get maximum time allowed to solve the problem.
 
void setNumThreads (int numThreads)
 Set the maximum number of threads that the solver can use to solve the problem.
 
int getNumThreads ()
 Get the maximum number of threads that the solver can use to solve the problem.
 
void setFirstFeasible (bool stopAtFirstFeasible)
 Set if the execution must be stopped at first feasible solution.
 
bool getFirstFeasible ()
 Get if the execution must be stopped at first feasible solution.
 
void setLogFileName (char *filename)
 Set the name of the log file.
 
const char * getLogFileName ()
 Get the name of the log file.
 
OsiSolverInterface * getSolverInterface ()
 Get solver interface.
 
void readMps (const char *filename)
 Load a problem from a mps file.
 
void loadProblem (int numRows, int numColumns, int nz, double obj[], double qobj[], double lb[], double ub[], double lhs[], double rhs[], int begRows[], int indCols[], double values[], bool copy_vectors=true)
 Load a problem.
 
OPT_STATUS solve ()
 Solve the problem loaded.
 
double getObjValue ()
 Get the objective function value.
 
const double * getSolution ()
 Get the solution.
 
int getNumVars ()
 Get the number of variables.
 
const string * getVarNames ()
 Get the name of variables.
 

Private Member Functions

void freeMemory ()
 Free all allocated memory.
 

Private Attributes

OsiSolveros
 Main class to solve problems through Osi.
 

Detailed Description

Interface class to solve problems through Osi.

Constructor & Destructor Documentation

OsiInterface::OsiInterface ( SOLVER  solver)

Constructor.

Exceptions
SOLVER_NOT_AVAILABLEif the selected solver does not exist in the current compilation
LICENCE_ERRORif the selected solver needs a license and has not been founded or it is not valid
Note
No binary variables are allowed

Member Function Documentation

bool OsiInterface::getFirstFeasible ( )

Get if the execution must be stopped at first feasible solution.

Note
This option only will be used when the problem loaded contains binary variables
Returns
If the execution must be stopped at first feasible solution
const char * OsiInterface::getLogFileName ( )

Get the name of the log file.

Returns
Name of the log file
double OsiInterface::getMaxTime ( )

Get maximum time allowed to solve the problem.

Returns
Maximum time allowed to solve the problem
int OsiInterface::getNumThreads ( )
inline

Get the maximum number of threads that the solver can use to solve the problem.

Returns
Maximum number of threads that the solver can use to solve the problem, -1 if unlimited
int OsiInterface::getNumVars ( )

Get the number of variables.

Returns
Number of variables
const double * OsiInterface::getSolution ( )

Get the solution.

Returns
Solution
OsiSolverInterface * OsiInterface::getSolverInterface ( )

Get solver interface.

Returns
Solver interface
const string * OsiInterface::getVarNames ( )

Get the name of variables.

Returns
Name of variables
void OsiInterface::loadProblem ( int  numRows,
int  numColumns,
int  nz,
double  obj[],
double  qobj[],
double  lb[],
double  ub[],
double  lhs[],
double  rhs[],
int  begRows[],
int  indCols[],
double  values[],
bool  copy_vectors = true 
)

Load a problem.

Parameters
numRowsNumber of rows
numColumnsNumber of columns
nzNumber of non-zero elements in the sparse matrix
objObjective function values, if NULL, all variables have 0 objective coefficient
qobjQuadratic coefficients of the separable quadratic objective, if NULL, all variables have 0 quadratic coefficients
lbLower bound of variables
ubUpper bound of variables, if NULL, all columns have upper bound infinity.
lhsLower bound of restrictions, if NULL, all columns have lower bound 0
rhsUpper bound of restrictions, if NULL, all rows have upper bound infinity
begRowsIndex to the begining of each row, if NULL, all rows have lower bound -infinity
indColsIndex of each column
valuesValue of each non-zero element
copy_vectorsif false the vectors will be used freed with delete[] after optimization TODO
void OsiInterface::setFirstFeasible ( bool  stopAtFirstFeasible)

Set if the execution must be stopped at first feasible solution.

Note
This option only will be used when the problem loaded contains binary variables
OsiInterface::OPT_STATUS OsiInterface::solve ( )

Solve the problem loaded.

Returns
Optimization exit status

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