BlockIPPlatform
 All Classes Files Functions Variables
Public Member Functions | Public Attributes | Protected Member Functions | Private Attributes | List of all members
BlockIPInterface Class Reference

Class to solve large block angular problems. More...

#include <BlockIPInterface.h>

Collaboration diagram for BlockIPInterface:
Collaboration graph
[legend]

Public Member Functions

 BlockIPInterface ()
 Constructor.
 
 ~BlockIPInterface ()
 Destructor.
 
void setSolver (SOLVER solver)
 Set the solver to be used.
 
SOLVER getSolver ()
 Get the solver to be used.
 
void setMaxTime (double time)
 Set maximum time allowed to solve the problem.
 
double getMaxTime ()
 Get maximum time allowed to solve the problem.
 
void setMaxThreads (int numThreads)
 Set the maximum number of threads to be used.
 
int getMaxThreads ()
 Get the maximum number of threads to be used.
 
void setLogFilename (char *filename)
 Set the name of the log file.
 
const char * getLogFilename ()
 Get the name of the log file.
 
void setSolFilename (char *filename)
 Set the name of the solution file.
 
const char * getSolFilename ()
 Get the name of the solution file.
 
BlockIPgetBlockIPInterface ()
 Get BlockIP interface.
 
OsiInterfacegetSolverInterface ()
 Get solver interface.
 
void readMps (const char *filename)
 Load a problem from a mps file.
 
void readAmpl (const char *modelFilename, const char *dataFilename)
 Load a problem from ampl files.
 
void readBlockIPFormat (const char *filename)
 Load a problem from BlockIP format file.
 
void amplToMps (const char *modelFilename, const char *dataFilename, const char *mpsFilename, bool convertToStd=false)
 Converts a problem in ampl format to mps format.
 
void amplToBlockIPFormat (const char *modelFilename, const char *dataFilename, const char *BlockIPFormatFilename, bool convertToStd=false)
 Converts a problem in ampl format to BlockIP format.
 
void mpsToBlockIPFormat (const char *mpsFilename, const char *BlockIPFormatFilename, bool convertToStd=false)
 Converts a problem in mps format to BlockIP format.
 
void BlockIPFormatToMps (const char *BlockIPFormatFilename, const char *mpsFilename, bool convertToStd=false)
 Converts a problem in BlockIP format to mps format.
 
OPT_STATUS solve ()
 Solve the problem loaded.
 
double getObjValue ()
 Get the objective function value.
 
const double * getSolution ()
 Get the solution.
 
int getNumVars ()
 Get the number of variables.
 
void printX ()
 Show all the primal variables of blocks and slacks.
 
void printX (int globalVarIndex)
 Show the value of the i-th primal variable.
 
void printX (string varName)
 Show the value of the named primal variable.
 
void printX (int blockIndex, int varIndex)
 Show the value of the i-th primal variable inside the block k.
 
void printX (string blockName, int varIndex)
 Show the value of the i-th primal variable inside the named block.
 
void printXBlock (int blockIndex)
 Show the value of all primal variables inside the block k.
 
void printXBlock (string blockName)
 Show the value of all primal variables inside the named block.
 
void printXSlack ()
 Show the value of all primal variables inside the slacks.
 
void printXSlack (int slackIndex)
 Show the value of the i-th primal variable inside the slacks.
 
void printRC ()
 Show all the reduced cost of primal variables of blocks and slacks.
 
void printRC (int globalVarIndex)
 Show the reduced cost of the i-th primal variable.
 
void printRC (string varName)
 Show the reduced cost of the named primal variable.
 
void printRC (int blockIndex, int varIndex)
 Show the reduced cost of the i-th primal variable inside the block k.
 
void printRC (string blockName, int varIndex)
 Show the reduced cost of the i-th primal variable inside the named block.
 
void printRCBlock (int blockIndex)
 Show the reduced cost of all primal variables inside the block k.
 
void printRCBlock (string blockName)
 Show the reduced cost of all primal variables inside the named block.
 
void printRCSlack ()
 Show the reduced cost of all primal variables inside the slacks.
 
void printRCSlack (int slackIndex)
 Show the reduced cost of the i-th primal variable inside the slacks.
 
void printCons ()
 Show all the dual variables of blocks and linking constraints.
 
void printCons (int globalConsIndex)
 Show the dual variable of the i-th constraint.
 
void printCons (string consName)
 Show the dual variable of the named constraint.
 
void printCons (int blockIndex, int consIndex)
 Show the dual variable of the i-th constraint inside the block k.
 
void printCons (string blockName, int consIndex)
 Show the dual variable of the i-th constraint inside the named block.
 
void printConsBlock (int blockIndex)
 Show all the dual variables inside the block k.
 
void printConsBlock (string blockName)
 Show all the dual varialbes inside the named block.
 
void printConsLinking ()
 Show all the dual varialbes inside the linking constraints.
 
void printConsLinking (int linkingIndex)
 Show the dual variable of the i-th constraint inside the linking constraints.
 

Public Attributes

double infMatlab
 Infinity value to use in BlockIP Matlab.
 
int iterMatlab
 Maximum number of IP iterations to use in BlockIP Matlab.
 
int typeCompMatlab
 How ty direction is computed.
 
const char * pathMatlab
 Path where is prblock_ip.m.
 

Protected Member Functions

void freeMemory ()
 Free all allocated memory.
 
void createMatlabProblem ()
 Create the files to load and solve a problem in BlockIP Matlab.
 

Private Attributes

BlockIPbip
 BlockIP environment.
 
SMLBlockIPsmlbip
 To read problems in SML format.
 
OsiInterfaceoi
 To solve problems with third-party solvers.
 
SOLVER solver
 Solver to use.
 
double maxTime
 Maximum time allowed to solve the problem.
 
int numThreads
 Maximum number of threads to use.
 
bool solved
 True if at least a initial solve has been done.
 
char * logFilename
 Name of log file.
 
char * solFilename
 Name of solution file.
 
StdFormstdForm
 To perform conversions between standar form and original problem.
 
string * varNames
 Name of variables, only used when the problem is loaded from ampl files.
 
int numVars
 Number of varibles, only used when the problem is loaded from ampl files.
 
int * varsOrder
 correct order for the variables, ampl orders the variables
 
bool amplOrMps
 True if ampl is used, false if mps is used.
 
TYPE_INPUT type_input
 Type of input used to read the problem.
 
int numVarsMatlab
 Number of variables when BlockIP Matlab has been used.
 
int numConsMatlab
 Number of constraints when BlockIP Matlab has been used.
 
int numBlocks
 Number of blocks.
 
int numCons
 Number of constraints.
 
int numLinCons
 Number of linking constraints.
 
string * consNames
 Name of contraints.
 
string * blockNames
 Name of blocks.
 
int * varsPerBlock
 Number of variables in each block.
 
int * consPerBlock
 Number of constraints in each block.
 
vector< int > * indexUbInf
 Index to variables with ub = inf.
 
double fobj
 Objective function value.
 
double dobj
 Dual objective function value.
 
double * x
 Objective function solution.
 
double * y
 Dual variables of constraints.
 
double * z
 Dual variables of x_i <= u_i bounds.
 
double * w
 Dual variables of x_i >= 0 bounds.
 
double * rc
 Reduced costs.
 
int iter
 Number of iterations.
 
int iterPCG
 Number of PCG iterations.
 
double CPUsec
 CPU seconds of the optimization.
 

Detailed Description

Class to solve large block angular problems.

Member Function Documentation

void BlockIPInterface::amplToBlockIPFormat ( const char *  modelFilename,
const char *  dataFilename,
const char *  BlockIPFormatFilename,
bool  convertToStd = false 
)

Converts a problem in ampl format to BlockIP format.

Parameters
convertToStdIf true the problem will be written in BlockIP standard form
void BlockIPInterface::amplToMps ( const char *  modelFilename,
const char *  dataFilename,
const char *  mpsFilename,
bool  convertToStd = false 
)

Converts a problem in ampl format to mps format.

Parameters
convertToStdIf true the problem will be written in BlockIP standard form
void BlockIPInterface::BlockIPFormatToMps ( const char *  BlockIPFormatFilename,
const char *  mpsFilename,
bool  convertToStd = false 
)

Converts a problem in BlockIP format to mps format.

Parameters
convertToStdIf true the problem will be written in BlockIP standard form

Here is the call graph for this function:

BlockIP * BlockIPInterface::getBlockIPInterface ( )
inline

Get BlockIP interface.

Returns
BlockIP interface
const char * BlockIPInterface::getLogFilename ( )
inline

Get the name of the log file.

Returns
Name of the log file
double BlockIPInterface::getMaxTime ( )
inline

Get maximum time allowed to solve the problem.

Returns
Maximum time allowed to solve the problem
int BlockIPInterface::getNumVars ( )

Get the number of variables.

Returns
Number of variables
const char * BlockIPInterface::getSolFilename ( )
inline

Get the name of the solution file.

Returns
Name of the solution file
const double * BlockIPInterface::getSolution ( )

Get the solution.

Returns
Solution
OsiInterface * BlockIPInterface::getSolverInterface ( )
inline

Get solver interface.

Returns
Solver interface
void BlockIPInterface::mpsToBlockIPFormat ( const char *  mpsFilename,
const char *  BlockIPFormatFilename,
bool  convertToStd = false 
)

Converts a problem in mps format to BlockIP format.

Parameters
convertToStdIf true the problem will be written in BlockIP standard form

Here is the call graph for this function:

void BlockIPInterface::setLogFilename ( char *  filename)

Set the name of the log file.

Note
The filename will be copied
void BlockIPInterface::setSolFilename ( char *  filename)

Set the name of the solution file.

Note
The filename will be copied
void BlockIPInterface::setSolver ( SOLVER  solver)
inline

Set the solver to be used.

Parameters
solverSolver to be used

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