KClpLinearRelaxationSolver

class KClpLinearRelaxationSolver : public KLinearRelaxationSolver

Linear relaxation solver for Clp

Public Functions

KClpLinearRelaxationSolver(KLinearRelaxation &relax, const KNumVar &obj, KProblem::Sense sense, int storedBasisSize = 1000)

Constructor (note: no default constructor).

Parameters
  • relax – domain (a linear relaxation)

  • obj – the objective variable

  • sense – the sense for optimization

  • storedBasisSize – maximum depth for basis reload

KClpLinearRelaxationSolver(const KClpLinearRelaxationSolver&)

copy constructor

virtual ~KClpLinearRelaxationSolver()

destructor

virtual void setObjective(const KNumVar &var)

Set objective variable.

Parameters

var – the new objective variable

virtual int solve()

Call the solver. Call (Clp solver) and return an error code (see class KLinearRelaxationSolver for its meaning).

virtual double getBound(void) const

Get the (lower for minimization, upper for maximization) bound computed by solve().

Note that :

virtual double getBestBound(void) const

Get the best bound in a branch and bound tree. Useful if search terminated before optimality.

virtual void print(void) const

Print the internal state of the solver. Use is discouraged, use method writeLP to output the content of the solver.

virtual int writeLP(const char *filename) const

Write the current problem to a file in lp format.

void printVariables(void) const

Print variables name and their rank.

This is useful to recover the meaning of the columns in the LP file produced by writeLP.

virtual double getMIPSolution(const KNumVar &var) const

Get the current MIP solution for a KNumVar variable.

Parameters

var – variable whose value is checked

virtual double getMIPSolution(const KAuxVar &var) const

Get the current MIP solution for a KAuxVar variable.

Parameters

var – variable whose value is checked

virtual double getLPSolution(const KNumVar &var) const

Get the current MIP solution for a KNumVar variable.

Parameters

var – variable whose value is checked

virtual double getLPSolution(const KAuxVar &var) const

Get the current LP solution for a KAuxVar variable.

Parameters

var – variable whose value is checked

void updateSolution(bool MIPflag)

Update the KHybridSolution object with the current MIP (MIPflag=true) or LP (MIPflag=false) solution.

Parameters

MIPflag – true to get the current MIP solution, false for LP.

KHybridSolution *getSolutionPtr(void) const

Get a pointer to the solution contained in the solver. Method updateSolution must be used before the call.

virtual int getNumberGlobals(void) const

Get the number of global variables.

virtual void generateCuts(KLinearRelaxation*)

Cut generation

virtual double getReducedCost(const KNumVar &var) const

Note that LP solve must be complete.

Parameters

var – the variable whose reduced cost in the current LP solution is retrieved

Returns

reduced cost value

void printSolverOutput(bool flag)

Activate or deactivate solver verbose output.

void setPresolve(bool)

Activate or deactivate presolve.

virtual void instantiateNumVarsToCurrentSol(void)

Instantiate variables to current solution obtained by linear relaxation solver.

virtual void instantiateNumVarToCurrentSol(KNumVar *var)

Instantiate a variables to current solution obtained by linear relaxation solver.