graph_analysis
Public Types | Public Member Functions | List of all members
graph_analysis::algorithms::lp::embedded::ScipSolver Class Reference

#include <ScipSolver.hpp>

Inheritance diagram for graph_analysis::algorithms::lp::embedded::ScipSolver:
Inheritance graph
[legend]
Collaboration diagram for graph_analysis::algorithms::lp::embedded::ScipSolver:
Collaboration graph
[legend]

Public Types

typedef shared_ptr< ScipSolver > Ptr
 
- Public Types inherited from graph_analysis::algorithms::LPSolver
enum  Status {
  STATUS_UNKNOWN, STATUS_OPTIMAL, STATUS_INFEASIBLE, STATUS_UNBOUNDED,
  INVALID_PROBLEM_DEFINITION, NO_SOLUTION_FOUND, SOLUTION_FOUND
}
 
enum  Type {
  UNKNOWN_LP_SOLVER, CBC_SOLVER, CLP_SOLVER, GLPK_SOLVER,
  SCIP_SOLVER, SOPLEX_SOLVER, GLPK_SOLVER_EMBEDDED, SCIP_SOLVER_EMBEDDED,
  SOPLEX_SOLVER_EMBEDDED, LP_SOLVER_TYPE_END
}
 
enum  ProblemFormat {
  UNKNOWN_PROBLEM_FORMAT = 0, CPLEX, GLPK, MPS,
  LP_PROBLEM_FORMAT_END
}
 
enum  SolutionType {
  UNKNOWN_SOLUTION_TYPE = 0, BASIC_SOLUTION, IPT_SOLUTION, MIP_SOLUTION,
  LP_SOLUTION_TYPE_END
}
 Solution types: basic, IPT = interior point, MIP = mixed integer. More...
 
typedef shared_ptr< LPSolver > Ptr
 

Public Member Functions

 ScipSolver ()
 
virtual ~ScipSolver ()
 
void debugSolution (bool enable)
 
LPSolver::Type getSolverType () const override
 
void doLoadProblem (const std::string &filename, LPSolver::ProblemFormat format=CPLEX) override
 
void saveProblem (const std::string &filename, LPSolver::ProblemFormat format=CPLEX) const override
 
void loadSolution (const std::string &filename, LPSolver::SolutionType format=BASIC_SOLUTION) override
 
void saveSolution (const std::string &filename, LPSolver::SolutionType format=BASIC_SOLUTION) const override
 
double getObjectiveValue () const override
 
double getVariableValue (const std::string &varName) const
 
double getVariableValueByColumnIdx (uint32_t idx) const override
 
Status run () override
 
Status getStatus () const
 
Status run (const std::string &problem, LPSolver::ProblemFormat problemFormat=CPLEX, bool useCaching=false) override
 
- Public Member Functions inherited from graph_analysis::algorithms::LPSolver
 LPSolver ()
 
virtual ~LPSolver ()
 
bool loadProblem (const std::string &filename, ProblemFormat format=CPLEX)
 
std::string saveProblemToTempfile (LPSolver::ProblemFormat format=CPLEX) const
 
std::string saveSolutionToTempfile (LPSolver::SolutionType format=BASIC_SOLUTION) const
 
std::string getVariableNameByColumnIdx (uint32_t idx) const
 
uint32_t getColumnIdxByVariableName (const std::string &varName) const
 
const std::string & getProblemFile () const
 
LPSolver::ProblemFormat getProblemFileFormat () const
 
const std::string & getSolutionFile () const
 
LPSolver::SolutionType getSolutionFileFormat () const
 
virtual std::vector< size_t > infeasibleConstraints () const
 
void setSolutionCacheSize (size_t size)
 
size_t getSolutionCacheSize () const
 
void resetSolutionCache ()
 

Additional Inherited Members

- Static Public Member Functions inherited from graph_analysis::algorithms::LPSolver
static LPSolver::Ptr getInstance (LPSolver::Type solverType)
 
static ProblemFormat getProblemFormatFromFileExtension (const std::string &extension)
 
static std::string getTempFilename (const std::string &suffix=".lp")
 
- Static Public Attributes inherited from graph_analysis::algorithms::LPSolver
static std::map< Status, std::string > StatusTxt
 
static std::map< Type, std::string > TypeTxt
 
static std::map< ProblemFormat, std::string > ProblemFormatTxt
 
static std::map< LPSolver::ProblemFormat, std::vector< std::string > > ProblemFormatExtensions
 
- Protected Types inherited from graph_analysis::algorithms::LPSolver
typedef std::map< std::string, KnownSolution > KnownSolutions
 
- Protected Member Functions inherited from graph_analysis::algorithms::LPSolver
Status loadKnownSolution (const std::string &problemFilename)
 
void registerSolution (const std::string &problemFilename, const std::string &solutionFilename, Status status, SolutionType type)
 
const LPSolver::KnownSolutions::mapped_type & getRegisteredSolution (const std::string &problemFilename) const
 
- Protected Attributes inherited from graph_analysis::algorithms::LPSolver
std::string mProblemFile
 
LPSolver::ProblemFormat mProblemFileFormat
 
std::string mSolutionFile
 
LPSolver::SolutionType mSolutionFileFormat
 
size_t mSolutionCacheSize
 
- Static Protected Attributes inherited from graph_analysis::algorithms::LPSolver
static KnownSolutions msKnownSolutions
 

Member Typedef Documentation

◆ Ptr

Constructor & Destructor Documentation

◆ ScipSolver()

graph_analysis::algorithms::lp::embedded::ScipSolver::ScipSolver ( )

◆ ~ScipSolver()

graph_analysis::algorithms::lp::embedded::ScipSolver::~ScipSolver ( )
virtual

Member Function Documentation

◆ debugSolution()

void graph_analysis::algorithms::lp::embedded::ScipSolver::debugSolution ( bool  enable)

◆ doLoadProblem()

void graph_analysis::algorithms::lp::embedded::ScipSolver::doLoadProblem ( const std::string &  filename,
LPSolver::ProblemFormat  format = CPLEX 
)
overridevirtual

◆ getObjectiveValue()

double graph_analysis::algorithms::lp::embedded::ScipSolver::getObjectiveValue ( ) const
overridevirtual

Retrieve the current objective value of the solution

Implements graph_analysis::algorithms::LPSolver.

◆ getSolverType()

LPSolver::Type graph_analysis::algorithms::lp::embedded::ScipSolver::getSolverType ( ) const
inlineoverridevirtual

◆ getStatus()

LPSolver::Status graph_analysis::algorithms::lp::embedded::ScipSolver::getStatus ( ) const

◆ getVariableValue()

double graph_analysis::algorithms::lp::embedded::ScipSolver::getVariableValue ( const std::string &  varName) const

◆ getVariableValueByColumnIdx()

double graph_analysis::algorithms::lp::embedded::ScipSolver::getVariableValueByColumnIdx ( uint32_t  idx) const
overridevirtual

Get the variable value by the column index

Parameters
idxcolumn index
Returns
the variable value

Reimplemented from graph_analysis::algorithms::LPSolver.

◆ loadSolution()

void graph_analysis::algorithms::lp::embedded::ScipSolver::loadSolution ( const std::string &  filename,
LPSolver::SolutionType  format = BASIC_SOLUTION 
)
overridevirtual

Load a solution based

Parameters
filenamefilename of the solution file
formatformat of the solution

Implements graph_analysis::algorithms::LPSolver.

◆ run() [1/2]

LPSolver::Status graph_analysis::algorithms::lp::embedded::ScipSolver::run ( )
overridevirtual

Run the solver (after loadProblem) has been called

Implements graph_analysis::algorithms::LPSolver.

◆ run() [2/2]

LPSolver::Status graph_analysis::algorithms::lp::embedded::ScipSolver::run ( const std::string &  problemFilename,
LPSolver::ProblemFormat  problemFormat = CPLEX,
bool  useCaching = false 
)
overridevirtual

Run the solver with a given problem file

Parameters
problemFilenamefilename of the problem to solve
problemFormatformat of the problem to solver
useCachingTo use caching of problem and respective solutions set to True, otherwise False

Implements graph_analysis::algorithms::LPSolver.

◆ saveProblem()

void graph_analysis::algorithms::lp::embedded::ScipSolver::saveProblem ( const std::string &  filename,
LPSolver::ProblemFormat  format = CPLEX 
) const
overridevirtual

Save the problem to file

Parameters
filenamefilename of the problem file
formatformat of the the problem

Implements graph_analysis::algorithms::LPSolver.

◆ saveSolution()

void graph_analysis::algorithms::lp::embedded::ScipSolver::saveSolution ( const std::string &  filename,
LPSolver::SolutionType  format = BASIC_SOLUTION 
) const
overridevirtual

Save the solution to file

Parameters
filenamefilename of the solution file
formatformat of the the solution

Implements graph_analysis::algorithms::LPSolver.


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