#include <osiif.h>
Inheritance diagram for ABA_OSIIF:
Public Types | |
enum | SOLVERTYPE { Exact, Approx } |
Public Member Functions | |
ABA_OSIIF (ABA_MASTER *master) | |
This constructor does not initialize the problem data of the linear program. It must be loaded later with the function initialize(). | |
ABA_OSIIF (ABA_MASTER *master, ABA_OPTSENSE sense, int nRow, int maxRow, int nCol, int maxCol, ABA_ARRAY< double > &obj, ABA_ARRAY< double > &lb, ABA_ARRAY< double > &ub, ABA_ARRAY< ABA_ROW * > &rows) | |
virtual | ~ABA_OSIIF () |
The destructor. | |
SOLVERTYPE | currentSolverType () |
OsiSolverInterface * | osiLP () |
Private Member Functions | |
void | freeDouble (const double *&) |
void | freeDouble (double *&) |
void | freeInt (int *&) |
void | freeChar (char *&) |
void | freeChar (const char *&) |
void | freeStatus (CoinWarmStartBasis::Status *&) |
virtual void | _initialize (ABA_OPTSENSE sense, int nRow, int maxRow, int nCol, int maxCol, ABA_ARRAY< double > &obj, ABA_ARRAY< double > &lBound, ABA_ARRAY< double > &uBound, ABA_ARRAY< ABA_ROW * > &rows) |
Implements the corresponding pure virtual function of the base class LP and loads the linear program defined by the following arguments to the solver. | |
virtual void | _loadBasis (ABA_ARRAY< ABA_LPVARSTAT::STATUS > &lpVarStat, ABA_ARRAY< ABA_SLACKSTAT::STATUS > &slackStat) |
virtual ABA_OPTSENSE | _sense () const |
virtual void | _sense (const ABA_OPTSENSE &newSense) |
This version of the function _sense() changes the sense of the optimization. | |
virtual int | _nRow () const |
virtual int | _maxRow () const |
virtual int | _nCol () const |
virtual int | _maxCol () const |
virtual double | _obj (int i) const |
virtual double | _lBound (int i) const |
virtual double | _uBound (int i) const |
virtual double | _rhs (int i) const |
virtual void | _row (int i, ABA_ROW &r) const |
virtual int | _nnz () const |
Returns the number of nonzero elements in the constraint matrix (not including the right hand side). | |
virtual OPTSTAT | _primalSimplex () |
virtual OPTSTAT | _dualSimplex () |
virtual OPTSTAT | _barrier (bool doCrossover) |
virtual OPTSTAT | _approx () |
virtual double | _value () const |
virtual double | _xVal (int i) |
virtual double | _barXVal (int i) |
virtual double | _reco (int i) |
virtual double | _slack (int i) |
virtual double | _yVal (int i) |
virtual ABA_LPVARSTAT::STATUS | _lpVarStat (int i) |
virtual ABA_SLACKSTAT::STATUS | _slackStat (int i) |
virtual int | _getInfeas (int &infeasRow, int &infeasCol, double *bInvRow) |
Can be called if the last linear program has been solved with the dual simplex method and is infeasible. This function is currently not supported by the interface. | |
virtual void | _remRows (ABA_BUFFER< int > &ind) |
virtual void | _addRows (ABA_BUFFER< ABA_ROW * > &newRows) |
virtual void | _remCols (ABA_BUFFER< int > &vars) |
virtual void | _addCols (ABA_BUFFER< ABA_COLUMN * > &newVars) |
virtual void | _changeRhs (ABA_ARRAY< double > &newRhs) |
virtual void | _changeLBound (int i, double newLb) |
virtual void | _changeUBound (int i, double newUb) |
virtual int | _pivotSlackVariableIn (ABA_BUFFER< int > &rows) |
Pivots the slack variables stored in the buffer rows into the basis. This function defines the pure virtual function of the base class LP. This function is currently not supported by the interface. | |
void | getSol () |
Extracts the solution, i.e., the value, the status, the values of the variables, slack variables, and dual variables, the reduced costs, and the statuses of the variables and slack variables form the internal solver data structure. | |
char | csense2osi (ABA_CSENSE *sense) const |
Converts the ABACUS representation of the row sense to the Osi representation. | |
ABA_CSENSE::SENSE | osi2csense (char sense) const |
Converts the OSI representation of the row sense to the ABACUS representation. | |
CoinWarmStartBasis::Status | lpVarStat2osi (ABA_LPVARSTAT::STATUS stat) const |
Converts the ABACUS variable status to OSI format. | |
ABA_LPVARSTAT::STATUS | osi2lpVarStat (CoinWarmStartBasis::Status stat) const |
Converts the OSI variable status to ABACUS format. | |
CoinWarmStartBasis::Status | slackStat2osi (ABA_SLACKSTAT::STATUS stat) const |
Converts the ABACUS slack status to OSI format. | |
ABA_SLACKSTAT::STATUS | osi2slackStat (CoinWarmStartBasis::Status stat) const |
Converts the OSI slack status to ABACUS format. | |
OsiSolverInterface * | getDefaultInterface () |
Allocates an Open Solver Interface of type defaultOsiSolver. | |
OsiSolverInterface * | switchInterfaces (SOLVERTYPE newMethod) |
Switches between exact and approximate solvers. | |
void | loadDummyRow (OsiSolverInterface *s2, const double *lbounds, const double *ubounds, const double *objectives) |
Initializes the problem with a dummy row To be used with CPLEX if there are no rows. | |
void | _rowRealloc (int newSize) |
void | _colRealloc (int newSize) |
virtual int | _setSimplexIterationLimit (int limit) |
virtual int | _getSimplexIterationLimit (int &limit) |
ABA_OSIIF (const ABA_OSIIF &rhs) | |
const ABA_OSIIF & | operator= (const ABA_OSIIF &rhs) |
void | convertSenseToBound (double inf, const char sense, const double right, const double range, double &lower, double &upper) const |
Private Attributes | |
OsiSolverInterface * | osiLP_ |
ABA_LPMASTEROSI * | lpMasterOsi_ |
double | value_ |
const double * | xVal_ |
An array storing the values of the variables after the linear program has been optimized. | |
const double * | barXVal_ |
const double * | reco_ |
An array storing the values of the reduced costs after the linear program has been optimized. | |
const double * | yVal_ |
An array storing the values of the dual variables after the linear program has been optimized. | |
const char * | cStat_ |
An array storing the statuses of the variables after the linear program has been optimized. | |
int | numCols_ |
The number of columns currently used in the LP. | |
int | numRows_ |
The number of rows currently used in the LP. | |
const char * | rStat_ |
An array storing the statuses of the slack variables after the linear program has been optimized. | |
const double * | rhs_ |
An array storing the right hand sides of the linear program. | |
const double * | rowactivity_ |
An array storing the row activity of the linear program. | |
const char * | rowsense_ |
An array storing the row senses of the linear program. | |
const double * | colupper_ |
An array storing the column upper bounds of the linear program. | |
const double * | collower_ |
An array storing the column lower bounds of the linear program. | |
const double * | objcoeff_ |
An array storing the objective function coefficients of the linear program. | |
CoinWarmStartBasis * | ws_ |
A warm start object storing information about a basis of the linear program. | |
SOLVERTYPE | currentSolverType_ |
The type of the current solver interface. |
Definition at line 43 of file osiif.h.
ABA_OSIIF::ABA_OSIIF | ( | ABA_MASTER * | master | ) |
This constructor does not initialize the problem data of the linear program. It must be loaded later with the function initialize().
master | A pointer to the corresponding master of the optimization. |
ABA_OSIIF::ABA_OSIIF | ( | ABA_MASTER * | master, | |
ABA_OPTSENSE | sense, | |||
int | nRow, | |||
int | maxRow, | |||
int | nCol, | |||
int | maxCol, | |||
ABA_ARRAY< double > & | obj, | |||
ABA_ARRAY< double > & | lb, | |||
ABA_ARRAY< double > & | ub, | |||
ABA_ARRAY< ABA_ROW * > & | rows | |||
) |
A constructor with initialization.
master | A pointer to the corresponding master of the optimization. | |
sense | The sense of the objective function. | |
nCol | The number of columns (variables). | |
maxCol | The maximal number of columns. | |
nRow | The number of rows. | |
maxRow | The maximal number of rows. | |
obj | An array with the objective function coefficients. | |
lb | An array with the lower bounds of the columns. | |
ub | An array with the upper bounds of the columns. | |
rows | An array storing the rows of the problem. |
virtual ABA_OSIIF::~ABA_OSIIF | ( | ) | [virtual] |
The destructor.
ABA_OSIIF::ABA_OSIIF | ( | const ABA_OSIIF & | rhs | ) | [private] |
SOLVERTYPE ABA_OSIIF::currentSolverType | ( | ) | [inline] |
void ABA_OSIIF::freeDouble | ( | const double *& | ) | [private] |
void ABA_OSIIF::freeDouble | ( | double *& | ) | [private] |
void ABA_OSIIF::freeInt | ( | int *& | ) | [private] |
void ABA_OSIIF::freeChar | ( | char *& | ) | [private] |
void ABA_OSIIF::freeChar | ( | const char *& | ) | [private] |
void ABA_OSIIF::freeStatus | ( | CoinWarmStartBasis::Status *& | ) | [private] |
virtual void ABA_OSIIF::_initialize | ( | ABA_OPTSENSE | sense, | |
int | nRow, | |||
int | maxRow, | |||
int | nCol, | |||
int | maxCol, | |||
ABA_ARRAY< double > & | obj, | |||
ABA_ARRAY< double > & | lBound, | |||
ABA_ARRAY< double > & | uBound, | |||
ABA_ARRAY< ABA_ROW * > & | rows | |||
) | [private, virtual] |
Implements the corresponding pure virtual function of the base class LP and loads the linear program defined by the following arguments to the solver.
sense | The sense of the objective function. | |
nCol | The number of columns (variables). | |
maxCol | The maximal number of columns. | |
nRow | The number of rows. | |
maxRow | The maximal number of rows. | |
obj | An array with the objective function coefficients. | |
lb | An array with the lower bounds of the columns. | |
ub | An array with the upper bounds of the columns. | |
rows | An array storing the rows of the problem. |
Implements ABA_LP.
virtual void ABA_OSIIF::_loadBasis | ( | ABA_ARRAY< ABA_LPVARSTAT::STATUS > & | lpVarStat, | |
ABA_ARRAY< ABA_SLACKSTAT::STATUS > & | slackStat | |||
) | [private, virtual] |
Loads a basis to the solver
lpVarStat | An array storing the status of the columns. | |
lpVarStat | An array storing the status of the slack variables. |
Implements ABA_LP.
virtual ABA_OPTSENSE ABA_OSIIF::_sense | ( | ) | const [private, virtual] |
Returns the sense of the optimization.
It implements the pure virtual function of the base class LP.
Implements ABA_LP.
virtual void ABA_OSIIF::_sense | ( | const ABA_OPTSENSE & | newSense | ) | [private, virtual] |
virtual int ABA_OSIIF::_nRow | ( | ) | const [private, virtual] |
Returns the number of rows of the linear program.
It implements the pure virtual function of the base class LP.
Implements ABA_LP.
virtual int ABA_OSIIF::_maxRow | ( | ) | const [private, virtual] |
Returns the maximal number of rows of the linear program.
It implements the pure virtual function of the base class LP.
Implements ABA_LP.
virtual int ABA_OSIIF::_nCol | ( | ) | const [private, virtual] |
Returns the number of columns of the linear program.
It implements the pure virtual function of the base class LP.
Implements ABA_LP.
virtual int ABA_OSIIF::_maxCol | ( | ) | const [private, virtual] |
Returns the maximal number of columns of the linear program.
It implements the pure virtual function of the base class LP.
Implements ABA_LP.
virtual double ABA_OSIIF::_obj | ( | int | i | ) | const [private, virtual] |
Returns the objective function coefficient of column i.
It implements the pure virtual function of the base class LP.
Implements ABA_LP.
virtual double ABA_OSIIF::_lBound | ( | int | i | ) | const [private, virtual] |
Returns the lower bound of column i.
It implements the pure virtual function of the base class LP.
Implements ABA_LP.
virtual double ABA_OSIIF::_uBound | ( | int | i | ) | const [private, virtual] |
Returns the upper bound of column i.
It implements the pure virtual function of the base class LP.
Implements ABA_LP.
virtual double ABA_OSIIF::_rhs | ( | int | i | ) | const [private, virtual] |
Returns the right hand side of row i.
It implements the pure virtual function of the base class LP.
Implements ABA_LP.
virtual void ABA_OSIIF::_row | ( | int | i, | |
ABA_ROW & | r | |||
) | const [private, virtual] |
Stores a copy of row i in r.
It implements the pure virtual function of the base class LP.
Implements ABA_LP.
virtual int ABA_OSIIF::_nnz | ( | ) | const [private, virtual] |
Returns the number of nonzero elements in the constraint matrix (not including the right hand side).
It implements the pure virtual function of the base class LP.
Implements ABA_LP.
virtual OPTSTAT ABA_OSIIF::_primalSimplex | ( | ) | [private, virtual] |
Calls the primal simplex method.
It implements the pure virtual function of the base class LP.
Implements ABA_LP.
virtual OPTSTAT ABA_OSIIF::_dualSimplex | ( | ) | [private, virtual] |
Calls the dual simplex method.
It implements the pure virtual function of the base class LP.
Implements ABA_LP.
virtual OPTSTAT ABA_OSIIF::_barrier | ( | bool | doCrossover | ) | [private, virtual] |
Calls the barrier method.
It implements the pure virtual function of the base class LP.
Implements ABA_LP.
virtual OPTSTAT ABA_OSIIF::_approx | ( | ) | [private, virtual] |
Calls an approximate method.
It implements the pure virtual function of the base class LP.
Implements ABA_LP.
virtual double ABA_OSIIF::_value | ( | ) | const [private, virtual] |
Returns the optimum value of the linear program.
It implements the pure virtual function of the base class LP.
Implements ABA_LP.
virtual double ABA_OSIIF::_xVal | ( | int | i | ) | [private, virtual] |
Returns the value of the column i.
It implements the pure virtual function of the base class LP.
Implements ABA_LP.
virtual double ABA_OSIIF::_barXVal | ( | int | i | ) | [private, virtual] |
Returns the value of the column i.
It implements the pure virtual function of the base class LP.
Implements ABA_LP.
virtual double ABA_OSIIF::_reco | ( | int | i | ) | [private, virtual] |
Returns the reduced cost of the column i.
It implements the pure virtual function of the base class LP.
Implements ABA_LP.
virtual double ABA_OSIIF::_slack | ( | int | i | ) | [private, virtual] |
Returns the value of the slack column of the row i.
It implements the pure virtual function of the base class LP.
Implements ABA_LP.
virtual double ABA_OSIIF::_yVal | ( | int | i | ) | [private, virtual] |
Returns the value of the dual column of the row i.
It implements the pure virtual function of the base class LP.
Implements ABA_LP.
virtual ABA_LPVARSTAT::STATUS ABA_OSIIF::_lpVarStat | ( | int | i | ) | [private, virtual] |
Returns the status of the column i.
It implements the pure virtual function of the base class LP.
Implements ABA_LP.
virtual ABA_SLACKSTAT::STATUS ABA_OSIIF::_slackStat | ( | int | i | ) | [private, virtual] |
Returns the status of the slack column i.
It implements the pure virtual function of the base class LP.
Implements ABA_LP.
virtual int ABA_OSIIF::_getInfeas | ( | int & | infeasRow, | |
int & | infeasCol, | |||
double * | bInvRow | |||
) | [private, virtual] |
Can be called if the last linear program has been solved with the dual simplex method and is infeasible. This function is currently not supported by the interface.
In this case it computes the infeasible basic variable or constraint and the corresponding row nInvRow of the basis inverse. Either infeasRow or infeasCol is nonnegative. Then this number refers to an infeasible variable or slack variable, respectively. The function returns 0 if it is successful, 1 otherwise.
Currently this featureis not supported by the Open Solver Interface, therefore a call to this function always returns an error status.
Implements ABA_LP.
virtual void ABA_OSIIF::_remRows | ( | ABA_BUFFER< int > & | ind | ) | [private, virtual] |
Removes the rows listed in ind.
It implements the pure virtual function of the base class LP.
Implements ABA_LP.
virtual void ABA_OSIIF::_addRows | ( | ABA_BUFFER< ABA_ROW * > & | newRows | ) | [private, virtual] |
Adds the rows to the linear program.
It implements the pure virtual function of the base class LP.
Implements ABA_LP.
virtual void ABA_OSIIF::_remCols | ( | ABA_BUFFER< int > & | vars | ) | [private, virtual] |
Removes the columns listed in vars.
It implements the pure virtual function of the base class LP.
Implements ABA_LP.
virtual void ABA_OSIIF::_addCols | ( | ABA_BUFFER< ABA_COLUMN * > & | newVars | ) | [private, virtual] |
Adds the columns newCols to the linear program.
It implements the pure virtual function of the base class LP.
Implements ABA_LP.
virtual void ABA_OSIIF::_changeRhs | ( | ABA_ARRAY< double > & | newRhs | ) | [private, virtual] |
Sets the right hand side of the linear program to newRhs.
This array must have at least length of the number of rows. This function implements the pure virtual function of the base class LP.
Implements ABA_LP.
virtual void ABA_OSIIF::_changeLBound | ( | int | i, | |
double | newLb | |||
) | [private, virtual] |
Sets the lower bound of column i to newLb.
It implements the pure virtual function of the base class LP.
Implements ABA_LP.
virtual void ABA_OSIIF::_changeUBound | ( | int | i, | |
double | newUb | |||
) | [private, virtual] |
Sets the upper bound of column i to newLb.
It implements the pure virtual function of the base class LP.
Implements ABA_LP.
virtual int ABA_OSIIF::_pivotSlackVariableIn | ( | ABA_BUFFER< int > & | rows | ) | [private, virtual] |
Pivots the slack variables stored in the buffer rows into the basis. This function defines the pure virtual function of the base class LP. This function is currently not supported by the interface.
1 otherwise.
rows | The numbers of the slack variables that should be pivoted in. |
Implements ABA_LP.
void ABA_OSIIF::getSol | ( | ) | [private] |
Extracts the solution, i.e., the value, the status, the values of the variables, slack variables, and dual variables, the reduced costs, and the statuses of the variables and slack variables form the internal solver data structure.
char ABA_OSIIF::csense2osi | ( | ABA_CSENSE * | sense | ) | const [private] |
Converts the ABACUS representation of the row sense to the Osi representation.
ABA_CSENSE::SENSE ABA_OSIIF::osi2csense | ( | char | sense | ) | const [private] |
Converts the OSI representation of the row sense to the ABACUS representation.
CoinWarmStartBasis::Status ABA_OSIIF::lpVarStat2osi | ( | ABA_LPVARSTAT::STATUS | stat | ) | const [private] |
Converts the ABACUS variable status to OSI format.
ABA_LPVARSTAT::STATUS ABA_OSIIF::osi2lpVarStat | ( | CoinWarmStartBasis::Status | stat | ) | const [private] |
Converts the OSI variable status to ABACUS format.
CoinWarmStartBasis::Status ABA_OSIIF::slackStat2osi | ( | ABA_SLACKSTAT::STATUS | stat | ) | const [private] |
Converts the ABACUS slack status to OSI format.
ABA_SLACKSTAT::STATUS ABA_OSIIF::osi2slackStat | ( | CoinWarmStartBasis::Status | stat | ) | const [private] |
Converts the OSI slack status to ABACUS format.
OsiSolverInterface* ABA_OSIIF::getDefaultInterface | ( | ) | [private] |
Allocates an Open Solver Interface of type defaultOsiSolver.
OsiSolverInterface* ABA_OSIIF::switchInterfaces | ( | SOLVERTYPE | newMethod | ) | [private] |
Switches between exact and approximate solvers.
void ABA_OSIIF::loadDummyRow | ( | OsiSolverInterface * | s2, | |
const double * | lbounds, | |||
const double * | ubounds, | |||
const double * | objectives | |||
) | [private] |
Initializes the problem with a dummy row To be used with CPLEX if there are no rows.
void ABA_OSIIF::_rowRealloc | ( | int | newSize | ) | [private, virtual] |
Reallocates the internal memory such that newSize rows can be stored. This function is obsolete, as memory management is completely handled by Osi.
It implements the corresponding pure virtual function of the base class LP. If a reallocation is performed in the base class LP, we reinitialize the internal data structure. Actually this reinitialization is redundant since it would be performed automatically if addRows() or addCols() fail. However, to be consistent, and if a reallocation is performed to decrease the size of the arrays we call reinitialize().
Implements ABA_LP.
void ABA_OSIIF::_colRealloc | ( | int | newSize | ) | [private, virtual] |
Reallocates the internal memory such that newSize columns can be stored. This function is obsolete, as memory management is completely handled by Osi.
It implements the corresponding pure virtual function of the base class LP.
Implements ABA_LP.
virtual int ABA_OSIIF::_setSimplexIterationLimit | ( | int | limit | ) | [private, virtual] |
Changes the iteration limit of the Simplex algorithm.
This function defines a pure virtual function of the base class LP.
1 otherwise.
limit | The new value of the iteration limit. |
Implements ABA_LP.
virtual int ABA_OSIIF::_getSimplexIterationLimit | ( | int & | limit | ) | [private, virtual] |
Defines a pure virtual function of the base class LP.
1 otherwise.
limit | Stores the iteration limit if the return value is 0. |
Implements ABA_LP.
void ABA_OSIIF::convertSenseToBound | ( | double | inf, | |
const char | sense, | |||
const double | right, | |||
const double | range, | |||
double & | lower, | |||
double & | upper | |||
) | const [inline, private] |
OsiSolverInterface* ABA_OSIIF::osiLP_ [private] |
ABA_LPMASTEROSI* ABA_OSIIF::lpMasterOsi_ [private] |
double ABA_OSIIF::value_ [private] |
const double* ABA_OSIIF::xVal_ [private] |
const double* ABA_OSIIF::barXVal_ [private] |
const double* ABA_OSIIF::reco_ [private] |
const double* ABA_OSIIF::yVal_ [private] |
const char* ABA_OSIIF::cStat_ [private] |
int ABA_OSIIF::numCols_ [private] |
int ABA_OSIIF::numRows_ [private] |
const char* ABA_OSIIF::rStat_ [private] |
const double* ABA_OSIIF::rhs_ [private] |
const double* ABA_OSIIF::rowactivity_ [private] |
const char* ABA_OSIIF::rowsense_ [private] |
const double* ABA_OSIIF::colupper_ [private] |
const double* ABA_OSIIF::collower_ [private] |
const double* ABA_OSIIF::objcoeff_ [private] |
CoinWarmStartBasis* ABA_OSIIF::ws_ [private] |
SOLVERTYPE ABA_OSIIF::currentSolverType_ [private] |