Class MILPSolverCPX
Defined in File solver-cpx.h
Inheritance Relationships
Base Type
public MILPSolver
(Class MILPSolver)
Class Documentation
-
class MILPSolverCPX : public MILPSolver
Public Functions
-
MILPSolverCPX()
-
virtual ~MILPSolverCPX()
-
virtual MILPSolver *clone()
-
virtual double getInfinity()
-
virtual int getNumCols()
-
virtual int getNumRows()
-
virtual void setColName(const int &var, const string &asString)
-
virtual string getColName(const int &var)
-
virtual void setRowName(const int &cons, const string &asString)
-
virtual string getRowName(const int &cons)
-
virtual double getColUpper(const int &var)
-
virtual void setColUpper(const int &var, const double &b)
-
virtual double getColLower(const int &var)
-
virtual void setColLower(const int &var, const double &b)
-
virtual void setColBounds(const int &var, const double &lb, const double &ub)
-
virtual bool isColumnInteger(const int &col)
Ascertain whether the given column is an integer.
- Parameters:
c – A column index
- Returns:
true
if columnc
is an integer.
-
virtual bool isColumnBinary(const int &col)
Ascertain whether the given column is binary (i.e. a [0,1] integer).
- Parameters:
c – A column index
- Returns:
true
if columnc
is binary.
-
virtual double getRowUpper(const int &var)
-
virtual void setRowUpper(const int &c, const double &b)
-
virtual double getRowLower(const int &var)
-
virtual void setRowLower(const int &c, const double &b)
-
virtual void addCol(const vector<pair<int, double>> &entries, const double &lb, const double &ub, const ColumnType &type)
Functions for the columns (variables) of the model.
-
virtual void addRow(const vector<pair<int, double>> &entries, const double &lb, const double &ub)
Functions for the rows (constraints) of the model.
-
virtual void setMaximiseObjective(const bool &maxim)
Objective function calls.
Specify that the calls to
solve()
should maximise the given objective, rather than minimising.- Parameters:
maxim – If
true
, the objective will be maximised.
-
virtual void clearObjective()
Clear the objective coefficients (set each to 0).
-
virtual void setObjective(double *const entries)
Set the objective function according to the vector of weights given.
- Parameters:
entries – An array, size equal to
getNumCols()
containing the linear coefficient for each column, to use in the objective.
-
virtual void setObjCoeff(const int &var, const double &w)
Set the linear coefficient in the objective function of the given column.
- Parameters:
var – The column whose coefficient is to be changed
w – The coefficient for column <codevar
-
virtual void writeLp(const string &filename)
Miscellaneous functions.
-
virtual bool solve(const bool &skipPresolve)
Solving, and accessing solutions.
-
virtual const double *getSolution()
-
virtual const double *getSolutionRows()
Obtain the value of the row in the solution.
- Returns:
An array containing
getNumRows()
values, one for each row.
-
virtual const double *getPartialSolution(const int &from, const int &to)
Obtain the solution values of a subset of the columns in the LP.
- Parameters:
from – The start column index of the range to return (inclusive)
to – The end column index of the range to return (exclusive)
- Returns:
A pointer to an array, where index 0 contains the value of the variable
from
etc.
-
virtual double getSingleSolutionVariableValue(const int &col)
Obtain the solution values of the specified variable.
- Parameters:
col – The index of the variable (column)
- Returns:
The value that variable takes in the most recent solution to the LP
-
virtual double getObjValue()
Return the computed value of the objective function.
-
virtual bool supportsQuadratic() const
-
virtual void getRow(const int &i, vector<pair<int, double>> &entries)
Get a row from the LP, returning the coefficients it contains.
- Parameters:
i – The index of the row to get
entries – A reference to a vector of
int
,double
pairs which, after calling the method, will contain the column indices and coefficients of rowi
of the LP.
-
virtual void hush()
Suppress all output from the solver
-
MILPSolverCPX()