#include <MipHandler.h>
Collaboration diagram for MipHandler:
Public Member Functions | |
Data query functions | |
int | getAgentID () const |
Get the agent identitiy number. | |
int | getSubcatchmentID () const |
Get the subcatchment identitiy number. | |
AgentProblem *const | getSpecificProblemPtr () const |
Returns a pointer to the specific problem. | |
AgentProblem | getSpecificProblem () const |
Returns the specific problem. | |
ProblemDescription *const | getProblemDescriptionPtr () const |
Returns a pointer to the supplementary MIP description. | |
Set data functions | |
virtual void | setAgentID (int agentID) |
Set the agent identitiy number. | |
virtual void | setSubcatchmentID (int subcatchmentID) |
Set the subcatchment identitiy number. | |
virtual int | setSpecificProblem (const AgentProblem &specificProblem) |
pass template problem to MipHandler | |
virtual void | resetProblem () |
reset specific to template problem: | |
Solve and load functions | |
virtual int | solve (AgentSolution &solution_) |
Solve specific problem and return solution. | |
Set parameter functions | |
virtual void | setSolverType (SolverType solver) |
Set the solver type:. | |
virtual void | setTestFlag (int test) |
Switch testmode of this class on/off. | |
virtual void | setTolerance (double eps) |
Set the tolerance of coefficients. | |
virtual bool | setVerbosity (int verbosity) |
Set the verbosity of the MipHandler. | |
virtual void | setSafePrimalSolutionFlag (bool safePrimalSolution) |
set if primal solution is to be saved | |
Get parameter functions | |
virtual SolverType | getSolverType () const |
Get the solver type:. | |
bool | getTestFlag () const |
Returns if testmode is on or of. | |
double | getTolerance () const |
Get the tolerance of coefficients. | |
int | getNumberOfSolvedMIPs () const |
get number of solved MIP problems | |
bool | getSafePrimalSolutionFlag () |
get if primal solution is to be saved | |
virtual string | getSolverName () |
Get the name of chosen solver. | |
Functions to read and write files and Debugging fucntions | |
virtual int | readMtx (char *filename) |
Reads Excel file and store data in templateProblem. | |
virtual int | readDat (char *filename) |
virtual int | writeMtx (char *filename) const |
Write milp tableau to mtx file. | |
virtual int | writeDat (char *filename) const |
Write milp tableau and supplementary information to dat file. | |
virtual void | writeSolutionPrimal (char *filename) const |
void | writeSolverProblemExcel (char *filename) const |
virtual void | writeMps (const string filename, const string extension="mps") const |
virtual void | readMps (const string infile, const string extension="mps") |
virtual void | templateOutput (string name) |
virtual void | specificOutput (string name) |
virtual void | outputSolver (string name) |
virtual void | manipulateObjective () |
manipulate Objective functions coefficienst for testing, e.g. warmstart funcionality | |
Constructors and Destructors | |
MipHandler () | |
Standard Constructor. | |
~MipHandler () | |
Destructor. | |
Private Member Functions | |
Private methods | |
virtual int | switchSolver () |
Switch to the solver specified in (solverType solver). | |
void | setInitialParamSym () |
set some important SYMPHONY parameters | |
virtual int | loadProblem () |
Load specific problem to specified solver. | |
virtual int | solve () |
Solve specific problem. | |
int | solveSym () |
loaded problem and solve using SYMPHONY | |
int | solveOsl () |
loaded problem and solve using OSL | |
int | warmstart1Osl () |
use warmstart to solve with mode 1 and Osl | |
int | warmstart2Osl () |
use warmstart to solve with mode 2 and Osl | |
int | coldstart1Osl () |
solve with mode 1 and Osl | |
int | coldstart2Osl () |
solve with mode 2 and Osl | |
int | coldstart3Osl () |
solve with mode 3 and Osl | |
virtual void | forcedSolution (const AgentProblem &problem_, AgentSolution &solution_, bool save) |
compute forced solution for problem_ and pass it to solution_ | |
virtual void | forcedSolution () |
compute forced solution for specific problem and pass it to solution | |
virtual int | loadSolutionSym () |
Load solution provided by SYMPHONY to solution. | |
virtual int | loadSolutionOsl () |
Load solution provided by OSL to solution. | |
virtual void | deleteEmptyRowsAndCols () |
Find and delete empty Rows and Coumns. | |
void | preForcedSolutionMessages () |
print some messages before forced solution | |
void | postSolveTest () |
perform some tests after solving | |
void | printTime (char *mode) |
Print current time to standard out. | |
template<class ClassType> | |
int | copy (ClassType *&finalObjectPtr_, const ClassType *const originalObjectPtr_) |
Allocates memory for class member finalObjectPtr_ if necessary and copies data from the object originalObjectPtr_ points to. | |
virtual void | errormessage () const |
Private Attributes | |
Private member objects | |
AgentProblem * | templateProblem |
Object where template data read from mtx file is stored:. | |
AgentProblem * | specificProblem |
Customized templateProblem. | |
ProblemDescription * | problemDescriptionObject |
Additional descriptive information on the general MIP. | |
OsiSolverInterface * | mipSolver |
Interface to MIP solver. | |
AgentSolution * | solution |
SolverType | solver |
Encodes the type of MIP solver to be used. | |
string | solvername |
stores the specified solver name | |
int | istransposed |
number of blocks the Excel Tableau is made of | |
int | test |
Test flag. | |
double | eps |
Tolerance of coefficients to be distinct from zero. | |
int | agentID |
Agent identity, usefull for runtime debugging. | |
int | subcatchmentID |
Subcatchment identity, usefull for runtime debugging. | |
int | verbosity |
remember the verbosity set in solver | |
int | nudC |
Count dropped columns. | |
mat | lpmatrix |
structur tracing success and failure during the dynamic simulation of each MILP solving process | |
int | mp |
counts loaded MIP problems | |
int | forcedSolutionFlag |
Flag if forced solution was calculated. | |
bool | savePrimalSolution |
Flag if primal solution is to be safed. |
The class MipHandler is the interface between class AgentF and the solver class OsiSolverInterface. Template problems and problem descriptions can be read from .mtx and .dat files. Agents can pass their specific problem to the MipHandler or manipulate the template problem hold by the MipHandler such that it becomes specific. This problem is solved and the solution passed back to the Agent.
|
Standard Constructor. Default solver is SYMPHONY |
|
Destructor.
|
|
solve with mode 1 and Osl
|
|
solve with mode 2 and Osl
|
|
solve with mode 3 and Osl
|
|
Allocates memory for class member finalObjectPtr_ if necessary and copies data from the object originalObjectPtr_ points to.
|
Here is the call graph for this function:
|
Find and delete empty Rows and Coumns. Finds empty rows and columns, i.e. rows and columns which are equal to zero, in the specific problem and deltes them in the solver. CAVE: (i) Has to be used after problem is loaded to solver. (ii) Currently buggy with SYMPHONY(TODO) |
|
Prints agent ID and subcatchement ID to standard error |
|
compute forced solution for specific problem and pass it to solution Like above with problem_ = specificProblem and solution_ = solution |
|
compute forced solution for problem_ and pass it to solution_ Compute forced solution for problem_ and pass it to solution_. The forced solution consists essentially of the opportunity costs of the Agent. |
|
Get the agent identitiy number. This number is a useful runtime debugging information: In case of runtime errors the causing agent can be determined |
|
get number of solved MIP problems
|
|
Returns a pointer to the supplementary MIP description. which can be used to read data from the supplementary MIP description. CAVE: The MIP description shoul not be modified! |
|
get if primal solution is to be saved
|
|
Get the name of chosen solver.
|
|
Get the solver type:.
|
|
Returns the specific problem. CAVE: expensive; costs lots of time and memory when problem is big, problably not necessary |
|
Returns a pointer to the specific problem. which can be used to manipulate the specific problem |
|
Get the subcatchment identitiy number. Also useful for runtime debugging |
|
Returns if testmode is on or of.
|
|
Get the tolerance of coefficients. Get the tolerance of coefficients (=eps) below which they are regarded as zero |
|
Load specific problem to specified solver. Load the specific problem which was given e.g. by readMtx(), to the specified solver (solverType solver) |
|
Load solution provided by OSL to solution.
|
|
Load solution provided by SYMPHONY to solution.
|
|
manipulate Objective functions coefficienst for testing, e.g. warmstart funcionality
|
|
Write the solver contents to separate files |
|
perform some tests after solving
|
|
print some messages before forced solution
|
|
Print current time to standard out.
|
|
|
|
Read a MIP problem from MPS file and load it to specified solver and to specificProblem |
|
Reads Excel file and store data in templateProblem. Reads in MILP tableau from Excel input file and sends data to MipHandler->templateProblem. This function is supposed only to be used by 'MilpCheck' application. CAVE: no return code implemented, yet |
|
reset specific to template problem:
|
|
Set the agent identitiy number. This number is a useful runtime debugging information: In case of runtime errors the causing agent can be determined |
|
set some important SYMPHONY parameters
|
|
set if primal solution is to be saved
|
|
Set the solver type:.
|
|
pass template problem to MipHandler
|
|
Set the subcatchment identitiy number. Also useful for runtime debugging |
|
Switch testmode of this class on/off. test = true -> setVerbosity(10) |
|
Set the tolerance of coefficients. Set the tolerance of coefficients (=eps) below which they are regarded as zero |
|
Set the verbosity of the MipHandler. larger numbers -> larger verbosity verbosity = -2 -> no verbosity |
|
Solve specific problem. Solves the specific problem hold by the MipHandler with the specified solver (solverType solver). The specific problem is automatically loaded to the solver. |
|
Solve specific problem and return solution. Solves the specific problem hold by the MipHandler with the specified solver (solverType solver) and passes back the solution in solution_. The specific problem is automatically loaded to the solver. |
|
loaded problem and solve using OSL
|
|
loaded problem and solve using SYMPHONY
|
|
Write the specific model contents to separate files |
|
Switch to the solver specified in (solverType solver).
|
|
Write the template model contents to separate files |
|
use warmstart to solve with mode 1 and Osl
|
|
use warmstart to solve with mode 2 and Osl
|
|
Write milp tableau and supplementary information to dat file. Writes the MILP tableau loaded to specificProblem and supplementary informationin loded descriptionObject to dat output file filename CAVE:not testet yet (TODO:test this) |
|
Write the (to solver) loaded(!) MIP problem to MPS file |
|
Write milp tableau to mtx file. Writes the MILP tableau loaded to specificProblem in mtx output file filename |
|
write primal solution into output files: name is <filename>.<solvername>-pri |
|
Writes the MILP tableau loaded to the specified solver in Excel style to output file filename |
|
Agent identity, usefull for runtime debugging.
|
|
Tolerance of coefficients to be distinct from zero.
|
|
Flag if forced solution was calculated.
|
|
number of blocks the Excel Tableau is made of
|
|
structur tracing success and failure during the dynamic simulation of each MILP solving process
|
|
Interface to MIP solver.
|
|
counts loaded MIP problems
|
|
Count dropped columns.
|
|
Additional descriptive information on the general MIP. This additional information on the genaral MIP describes in particular special economic and hydrological properties. The contents of AgentProblem (i.e. mtx file contents) and the contents of ProblemDescription correspond to the contents and structure of a dat file. |
|
Flag if primal solution is to be safed.
|
|
As it is a pointer no memory is allocated to copy it from the AgentF's and no time is needed for a copy process in solve(AgentSolution& solution); |
|
Encodes the type of MIP solver to be used.
|
|
stores the specified solver name
|
|
Customized templateProblem.
|
|
Subcatchment identity, usefull for runtime debugging.
|
|
Object where template data read from mtx file is stored:.
|
|
Test flag.
|
|
remember the verbosity set in solver
|