Loading...
Searching...
No Matches
CglPreProcess Class Reference

Class for preProcessing and postProcessing. More...

`#include <CglPreProcess.hpp>`

Collaboration diagram for CglPreProcess:
[legend]

## Public Member Functions

Main methods
OsiSolverInterface * | preProcess (OsiSolverInterface &model, bool makeEquality=false, int numberPasses=5)
| preProcess problem - returning new problem.
OsiSolverInterface * | preProcessNonDefault (OsiSolverInterface &model, int makeEquality=0, int numberPasses=5, int tuning=0)
| preProcess problem - returning new problem.
void | postProcess (OsiSolverInterface &model, int deleteStuff=2)
| Creates solution in original model deleteStuff 0 - don't, 1 do (but not if infeasible), 2 always.
int | tightenPrimalBounds (OsiSolverInterface &model, double factor=0.0)
| Tightens primal bounds to make dual and branch and cutfaster.
OsiSolverInterface * | someFixed (OsiSolverInterface &model, double fractionToKeep=0.25, bool fixContinuousAsWell=false, char *keep=NULL) const
| Fix some of problem - returning new problem.
OsiSolverInterface * | cliqueIt (OsiSolverInterface &model, double cliquesNeeded=0.0) const
| Replace cliques by more maximal cliques Returns NULL if rows not reduced by greater than cliquesNeeded*rows.
int | reducedCostFix (OsiSolverInterface &model)
| If we have a cutoff - fix variables.
Parameter set/get methods
The set methods return true if the parameter was set to the given value, false if the value of the parameter is out of range. The get methods return the value of the parameter.
void | setCutoff (double value)
| Set cutoff bound on the objective function.
double | getCutoff () const
| Get the cutoff bound on the objective function - always as minimize.
OsiSolverInterface * | originalModel () const
| The original solver associated with this model.
void | setOriginalModel (OsiSolverInterface *originalModel)
| Set original model (probably acopy).
OsiSolverInterface * | startModel () const
| Solver after making clique equalities (may == original).
int | numberSolvers () const
| Number of solvers.
OsiSolverInterface * | modelAtPass (int iPass) const
| Copies of solver at various stages after presolve.
OsiSolverInterface * | modifiedModel (int iPass) const
| Copies of solver at various stages after presolve after modifications.
OsiPresolve * | presolve (int iPass) const
| Matching presolve information.
void | setPresolve (int iPass, OsiPresolve *presolve)
| Set matching presolve information.
const int * | originalColumns ()
| Return a pointer to the original columns (with possible clique slacks) MUST be called before postProcess otherwise you just get 0,1,2.
const int * | originalRows ()
| Return a pointer to the original rows MUST be called before postProcess otherwise you just get 0,1,2.
int | numberSOS () const
| Number of SOS if found.
const int * | typeSOS () const
| Type of each SOS.
const int * | startSOS () const
| Start of each SOS.
const int * | whichSOS () const
| Columns in SOS.
const double * | weightSOS () const
| Weights for each SOS column.
void | passInProhibited (const char *prohibited, int numberColumns)
| Pass in prohibited columns.
const char * | prohibited ()
| Updated prohibited columns.
int | numberIterationsPre () const
| Number of iterations PreProcessing.
int | numberIterationsPost () const
| Number of iterations PostProcessing.
void | passInRowTypes (const char *rowTypes, int numberRows)
| Pass in row types 0 normal 1 cut rows - will be dropped if remain in At end of preprocess cut rows will be dropped and put into cuts.
const char * | rowTypes ()
| Updated row types - may be NULL Carried around and corresponds to existing rows -1 added by preprocess e.g.
const CglStored & | cuts () const
| Return cuts from dropped rows.
const CglStored * | cutsPointer () const
| Return pointer to cuts from dropped rows.
void | update (const OsiPresolve *pinfo, const OsiSolverInterface *solver)
| Update prohibited and rowType.
int | options () const
| Get options.
void | setOptions (int value)
| Set options.
Cut generator methods
int | numberCutGenerators () const
| Get the number of cut generators.
CglCutGenerator ** | cutGenerators () const
| Get the list of cut generators.
CglCutGenerator * | cutGenerator (int i) const
| Get the specified cut generator.
void | addCutGenerator (CglCutGenerator *generator)
| Add one generator - up to user to delete generators.
Setting/Accessing application data
void | setApplicationData (void *appData)
| Set application data.
void * | getApplicationData () const
| Get application data.
Message handling
void | passInMessageHandler (CoinMessageHandler *handler)
| Pass in Message handler (not deleted at end).
void | newLanguage (CoinMessages::Language language)
| Set language.
void | setLanguage (CoinMessages::Language language)
CoinMessageHandler * | messageHandler () const
| Return handler.
CoinMessages | messages ()
| Return messages.
CoinMessages * | messagesPointer ()
| Return pointer to messages.
Constructors and destructors etc
| CglPreProcess ()
| Constructor.
| CglPreProcess (const CglPreProcess &rhs)
| Copy constructor .
CglPreProcess & | operator= (const CglPreProcess &rhs)
| Assignment operator.
| ~CglPreProcess ()
| Destructor.
void | gutsOfDestructor ()
| Clears out as much as possible.
void | setTimeLimit (const double timeLimit, const bool useElapsedTime)
| Set time limit.
void | setKeepColumnNames (const bool keep)
| Keeps original column names.

## Private Member Functions

private methods
OsiSolverInterface * | modified (OsiSolverInterface *model, bool constraints, int &numberChanges, int iBigPass, int numberPasses)
| Return model with useful modifications.
void | createOriginalIndices ()
| create original columns and rows
void | makeInteger ()
| Make continuous variables integer.

## Private member data

OsiSolverInterface * | originalModel_
| The original solver associated with this model.
OsiSolverInterface * | startModel_
| Solver after making clique equalities (may == original).
int | numberSolvers_
| Number of solvers at various stages.
OsiSolverInterface ** | model_
| Copies of solver at various stages after presolve.
OsiSolverInterface ** | modifiedModel_
| Copies of solver at various stages after presolve after modifications.
OsiPresolve ** | presolve_
| Matching presolve information.
CoinMessageHandler * | handler_
| Message handler.
bool | defaultHandler_
| Flag to say if handler_ is the default handler.
CoinMessages | messages_
| Cgl messages.
void * | appData_
| Pointer to user-defined data structure.
int * | originalColumn_
| Original column numbers.
int * | originalRow_
| Original row numbers.
int | numberCutGenerators_
| Number of cut generators.
CglCutGenerator ** | generator_
| Cut generators.
int | numberSOS_
| Number of SOS if found.
int * | typeSOS_
| Type of each SOS.
int * | startSOS_
| Start of each SOS.
int * | whichSOS_
| Columns in SOS.
double * | weightSOS_
| Weights for each SOS column.
int | numberProhibited_
| Number of columns in original prohibition set.
int | numberIterationsPre_
| Number of iterations done in PreProcessing.
int | numberIterationsPost_
| Number of iterations done in PostProcessing.
char * | prohibited_
| Columns which should not be presolved e.g. SOS.
int | numberRowType_
| Number of rows in original row types.
int | options_
| Options 1 - original model had integer bounds before tightening 2 - don't do probing 4 - don't do duplicate rows 8 - don't do cliques 16 - some heavy probing options 64 - very heavy probing.
char * | rowType_
| Row types (may be NULL) Carried around and corresponds to existing rows -1 added by preprocess e.g.
CglStored | cuts_
| Cuts from dropped rows.
bool | useElapsedTime_
| use elapsed (wallclock time) or cpu time
double | timeLimit_
| time limit (default COIN_DBL_MAX)
bool | keepColumnNames_
| keep column names
double | getCurrentCPUTime () const
| current elapsed or cpu time

## Detailed Description

Class for preProcessing and postProcessing.

While cuts can be added at any time in the tree, some cuts are actually just stronger versions of existing constraints. In this case they can replace those constraints rather than being added as new constraints. This is awkward in the tree but reasonable at the root node.

This is a general process class which uses other cut generators to strengthen constraints, establish that constraints are redundant, fix variables and find relationships such as x + y == 1.

Presolve will also be done.

If row names existed they may be replaced by R0000000..., unless setKeepColumnNames(true) is set.

Definition at line 37 of file CglPreProcess.hpp.

## Constructor & Destructor Documentation

## CglPreProcess() [1/2]

CglPreProcess::CglPreProcess | ( |  | ) |

Constructor.

## CglPreProcess() [2/2]

CglPreProcess::CglPreProcess | ( | const CglPreProcess & | rhs | ) |

Copy constructor .

## ~CglPreProcess()

CglPreProcess::~CglPreProcess | ( |  | ) |

Destructor.

## Member Function Documentation

## preProcess()

OsiSolverInterface * CglPreProcess::preProcess | ( | OsiSolverInterface & | model,
|  | bool | makeEquality = false,
|  | int | numberPasses = 5 )

preProcess problem - returning new problem.

If makeEquality true then <= cliques converted to ==. Presolve will be done numberPasses times.

Returns NULL if infeasible

This version uses default strategy. For more control copy and edit code from this function i.e. call preProcessNonDefault

## preProcessNonDefault()

OsiSolverInterface * CglPreProcess::preProcessNonDefault | ( | OsiSolverInterface & | model,
|  | int | makeEquality = 0,
|  | int | numberPasses = 5,
|  | int | tuning = 0 )

preProcess problem - returning new problem.

If makeEquality true then <= cliques converted to ==. Presolve will be done numberPasses times.

Returns NULL if infeasible

This version assumes user has added cut generators to CglPreProcess object before calling it. As an example use coding in preProcess If makeEquality is 1 add slacks to get cliques, if 2 add slacks to get sos (but only if looks plausible) and keep sos info

## postProcess()

void CglPreProcess::postProcess | ( | OsiSolverInterface & | model,
|  | int | deleteStuff = 2 )

Creates solution in original model deleteStuff 0 - don't, 1 do (but not if infeasible), 2 always.

## tightenPrimalBounds()

int CglPreProcess::tightenPrimalBounds | ( | OsiSolverInterface & | model,
|  | double | factor = 0.0 )

Tightens primal bounds to make dual and branch and cutfaster.

Unless fixed or integral, bounds are slightly looser than they could be. Returns non-zero if problem infeasible Fudge for branch and bound - put bounds on columns of factor * largest value (at continuous) - should improve stability in branch and bound on infeasible branches (0.0 is off)

## someFixed()

OsiSolverInterface * CglPreProcess::someFixed | ( | OsiSolverInterface & | model,
|  | double | fractionToKeep = 0.25,
|  | bool | fixContinuousAsWell = false,
|  | char * | keep = NULL ) const

Fix some of problem - returning new problem.

Uses reduced costs. Optional signed character array 1 always keep, -1 always discard, 0 use djs

## cliqueIt()

OsiSolverInterface * CglPreProcess::cliqueIt | ( | OsiSolverInterface & | model,
|  | double | cliquesNeeded = 0.0 ) const

Replace cliques by more maximal cliques Returns NULL if rows not reduced by greater than cliquesNeeded*rows.

## reducedCostFix()

int CglPreProcess::reducedCostFix | ( | OsiSolverInterface & | model | ) |

If we have a cutoff - fix variables.

## setCutoff()

void CglPreProcess::setCutoff | ( | double | value | ) |

Set cutoff bound on the objective function.

When using strict comparison, the bound is adjusted by a tolerance to avoid accidentally cutting off the optimal solution.

## getCutoff()

double CglPreProcess::getCutoff | ( |  | ) | const

Get the cutoff bound on the objective function - always as minimize.

## originalModel()

OsiSolverInterface * CglPreProcess::originalModel | ( |  | ) | const

inline

The original solver associated with this model.

Definition at line 119 of file CglPreProcess.hpp.

## setOriginalModel()

void CglPreProcess::setOriginalModel | ( | OsiSolverInterface * | originalModel | ) |

inline

Set original model (probably acopy).

Definition at line 124 of file CglPreProcess.hpp.

## startModel()

OsiSolverInterface * CglPreProcess::startModel | ( |  | ) | const

inline

Solver after making clique equalities (may == original).

Definition at line 129 of file CglPreProcess.hpp.

## numberSolvers()

int CglPreProcess::numberSolvers | ( |  | ) | const

inline

Number of solvers.

Definition at line 134 of file CglPreProcess.hpp.

## modelAtPass()

OsiSolverInterface * CglPreProcess::modelAtPass | ( | int | iPass | ) | const

inline

Copies of solver at various stages after presolve.

Definition at line 139 of file CglPreProcess.hpp.

## modifiedModel()

OsiSolverInterface * CglPreProcess::modifiedModel | ( | int | iPass | ) | const

inline

Copies of solver at various stages after presolve after modifications.

Definition at line 147 of file CglPreProcess.hpp.

## presolve()

OsiPresolve * CglPreProcess::presolve | ( | int | iPass | ) | const

inline

Matching presolve information.

Definition at line 155 of file CglPreProcess.hpp.

## setPresolve()

void CglPreProcess::setPresolve | ( | int | iPass,
|  | OsiPresolve * | presolve )

inline

Set matching presolve information.

Definition at line 163 of file CglPreProcess.hpp.

## originalColumns()

const int * CglPreProcess::originalColumns | ( |  | ) |

Return a pointer to the original columns (with possible clique slacks) MUST be called before postProcess otherwise you just get 0,1,2.

## originalRows()

const int * CglPreProcess::originalRows | ( |  | ) |

Return a pointer to the original rows MUST be called before postProcess otherwise you just get 0,1,2.

## numberSOS()

int CglPreProcess::numberSOS | ( |  | ) | const

inline

Number of SOS if found.

Definition at line 175 of file CglPreProcess.hpp.

## typeSOS()

const int * CglPreProcess::typeSOS | ( |  | ) | const

inline

Type of each SOS.

Definition at line 180 of file CglPreProcess.hpp.

## startSOS()

const int * CglPreProcess::startSOS | ( |  | ) | const

inline

Start of each SOS.

Definition at line 185 of file CglPreProcess.hpp.

## whichSOS()

const int * CglPreProcess::whichSOS | ( |  | ) | const

inline

Columns in SOS.

Definition at line 190 of file CglPreProcess.hpp.

## weightSOS()

const double * CglPreProcess::weightSOS | ( |  | ) | const

inline

Weights for each SOS column.

Definition at line 195 of file CglPreProcess.hpp.

## passInProhibited()

void CglPreProcess::passInProhibited | ( | const char * | prohibited,
|  | int | numberColumns )

Pass in prohibited columns.

## prohibited()

const char * CglPreProcess::prohibited | ( |  | ) |

inline

Updated prohibited columns.

Definition at line 202 of file CglPreProcess.hpp.

## numberIterationsPre()

int CglPreProcess::numberIterationsPre | ( |  | ) | const

inline

Number of iterations PreProcessing.

Definition at line 207 of file CglPreProcess.hpp.

## numberIterationsPost()

int CglPreProcess::numberIterationsPost | ( |  | ) | const

inline

Number of iterations PostProcessing.

Definition at line 212 of file CglPreProcess.hpp.

## passInRowTypes()

void CglPreProcess::passInRowTypes | ( | const char * | rowTypes,
|  | int | numberRows )

Pass in row types 0 normal 1 cut rows - will be dropped if remain in At end of preprocess cut rows will be dropped and put into cuts.

## rowTypes()

const char * CglPreProcess::rowTypes | ( |  | ) |

inline

Updated row types - may be NULL Carried around and corresponds to existing rows -1 added by preprocess e.g.

x+y=1 0 normal 1 cut rows - can be dropped if wanted

Definition at line 229 of file CglPreProcess.hpp.

## cuts()

const CglStored & CglPreProcess::cuts | ( |  | ) | const

inline

Return cuts from dropped rows.

Definition at line 234 of file CglPreProcess.hpp.

## cutsPointer()

const CglStored * CglPreProcess::cutsPointer | ( |  | ) | const

inline

Return pointer to cuts from dropped rows.

Definition at line 239 of file CglPreProcess.hpp.

## update()

void CglPreProcess::update | ( | const OsiPresolve * | pinfo,
|  | const OsiSolverInterface * | solver )

Update prohibited and rowType.

## options()

int CglPreProcess::options | ( |  | ) | const

inline

Get options.

Definition at line 246 of file CglPreProcess.hpp.

## setOptions()

void CglPreProcess::setOptions | ( | int | value | ) |

inline

Set options.

Definition at line 251 of file CglPreProcess.hpp.

## numberCutGenerators()

int CglPreProcess::numberCutGenerators | ( |  | ) | const

inline

Get the number of cut generators.

Definition at line 260 of file CglPreProcess.hpp.

## cutGenerators()

CglCutGenerator ** CglPreProcess::cutGenerators | ( |  | ) | const

inline

Get the list of cut generators.

Definition at line 265 of file CglPreProcess.hpp.

## cutGenerator()

CglCutGenerator * CglPreProcess::cutGenerator | ( | int | i | ) | const

inline

Get the specified cut generator.

Definition at line 270 of file CglPreProcess.hpp.

## addCutGenerator()

void CglPreProcess::addCutGenerator | ( | CglCutGenerator * | generator | ) |

Add one generator - up to user to delete generators.

## setApplicationData()

void CglPreProcess::setApplicationData | ( | void * | appData | ) |

Set application data.

This is a pointer that the application can store into and retrieve. This field is available for the application to optionally define and use.

## getApplicationData()

void * CglPreProcess::getApplicationData | ( |  | ) | const

Get application data.

## passInMessageHandler()

void CglPreProcess::passInMessageHandler | ( | CoinMessageHandler * | handler | ) |

Pass in Message handler (not deleted at end).

## newLanguage()

void CglPreProcess::newLanguage | ( | CoinMessages::Language | language | ) |

Set language.

## setLanguage()

void CglPreProcess::setLanguage | ( | CoinMessages::Language | language | ) |

inline

Definition at line 302 of file CglPreProcess.hpp.

## messageHandler()

CoinMessageHandler * CglPreProcess::messageHandler | ( |  | ) | const

inline

Return handler.

Definition at line 307 of file CglPreProcess.hpp.

## messages()

CoinMessages CglPreProcess::messages | ( |  | ) |

inline

Return messages.

Definition at line 312 of file CglPreProcess.hpp.

## messagesPointer()

CoinMessages * CglPreProcess::messagesPointer | ( |  | ) |

inline

Return pointer to messages.

Definition at line 317 of file CglPreProcess.hpp.

## operator=()

CglPreProcess & CglPreProcess::operator= | ( | const CglPreProcess & | rhs | ) |

Assignment operator.

## gutsOfDestructor()

void CglPreProcess::gutsOfDestructor | ( |  | ) |

Clears out as much as possible.

## setTimeLimit()

void CglPreProcess::setTimeLimit | ( | const double | timeLimit,
|  | const bool | useElapsedTime )

Set time limit.

## setKeepColumnNames()

void CglPreProcess::setKeepColumnNames | ( | const bool | keep | ) |

Keeps original column names.

## modified()

OsiSolverInterface * CglPreProcess::modified | ( | OsiSolverInterface * | model,
|  | bool | constraints,
|  | int & | numberChanges,
|  | int | iBigPass,
|  | int | numberPasses )

private

Return model with useful modifications.

If constraints true then adds any x+y=1 or x-y=0 constraints If NULL infeasible

## createOriginalIndices()

void CglPreProcess::createOriginalIndices | ( |  | ) |

private

create original columns and rows

## makeInteger()

void CglPreProcess::makeInteger | ( |  | ) |

private

Make continuous variables integer.

## getCurrentCPUTime()

double CglPreProcess::getCurrentCPUTime | ( |  | ) | const

private

current elapsed or cpu time

## Member Data Documentation

## originalModel_

OsiSolverInterface* CglPreProcess::originalModel_

private

The original solver associated with this model.

Definition at line 373 of file CglPreProcess.hpp.

## startModel_

OsiSolverInterface* CglPreProcess::startModel_

private

Solver after making clique equalities (may == original).

Definition at line 375 of file CglPreProcess.hpp.

## numberSolvers_

int CglPreProcess::numberSolvers_

private

Number of solvers at various stages.

Definition at line 377 of file CglPreProcess.hpp.

## model_

OsiSolverInterface** CglPreProcess::model_

private

Copies of solver at various stages after presolve.

Definition at line 379 of file CglPreProcess.hpp.

## modifiedModel_

OsiSolverInterface** CglPreProcess::modifiedModel_

private

Copies of solver at various stages after presolve after modifications.

Definition at line 381 of file CglPreProcess.hpp.

## presolve_

OsiPresolve** CglPreProcess::presolve_

private

Matching presolve information.

Definition at line 383 of file CglPreProcess.hpp.

## handler_

CoinMessageHandler* CglPreProcess::handler_

private

Message handler.

Definition at line 386 of file CglPreProcess.hpp.

## defaultHandler_

bool CglPreProcess::defaultHandler_

private

Flag to say if handler_ is the default handler.

The default handler is deleted when the model is deleted. Other handlers (supplied by the client) will not be deleted.

Definition at line 393 of file CglPreProcess.hpp.

## messages_

CoinMessages CglPreProcess::messages_

private

Cgl messages.

Definition at line 396 of file CglPreProcess.hpp.

## appData_

void* CglPreProcess::appData_

private

Pointer to user-defined data structure.

Definition at line 399 of file CglPreProcess.hpp.

## originalColumn_

int* CglPreProcess::originalColumn_

private

Original column numbers.

Definition at line 401 of file CglPreProcess.hpp.

## originalRow_

int* CglPreProcess::originalRow_

private

Original row numbers.

Definition at line 403 of file CglPreProcess.hpp.

## numberCutGenerators_

int CglPreProcess::numberCutGenerators_

private

Number of cut generators.

Definition at line 405 of file CglPreProcess.hpp.

## generator_

CglCutGenerator** CglPreProcess::generator_

private

Cut generators.

Definition at line 407 of file CglPreProcess.hpp.

## numberSOS_

int CglPreProcess::numberSOS_

private

Number of SOS if found.

Definition at line 409 of file CglPreProcess.hpp.

## typeSOS_

int* CglPreProcess::typeSOS_

private

Type of each SOS.

Definition at line 411 of file CglPreProcess.hpp.

## startSOS_

int* CglPreProcess::startSOS_

private

Start of each SOS.

Definition at line 413 of file CglPreProcess.hpp.

## whichSOS_

int* CglPreProcess::whichSOS_

private

Columns in SOS.

Definition at line 415 of file CglPreProcess.hpp.

## weightSOS_

double* CglPreProcess::weightSOS_

private

Weights for each SOS column.

Definition at line 417 of file CglPreProcess.hpp.

## numberProhibited_

int CglPreProcess::numberProhibited_

private

Number of columns in original prohibition set.

Definition at line 419 of file CglPreProcess.hpp.

## numberIterationsPre_

int CglPreProcess::numberIterationsPre_

private

Number of iterations done in PreProcessing.

Definition at line 421 of file CglPreProcess.hpp.

## numberIterationsPost_

int CglPreProcess::numberIterationsPost_

private

Number of iterations done in PostProcessing.

Definition at line 423 of file CglPreProcess.hpp.

## prohibited_

char* CglPreProcess::prohibited_

private

Columns which should not be presolved e.g. SOS.

Definition at line 425 of file CglPreProcess.hpp.

## numberRowType_

int CglPreProcess::numberRowType_

private

Number of rows in original row types.

Definition at line 427 of file CglPreProcess.hpp.

## options_

int CglPreProcess::options_

private

Options 1 - original model had integer bounds before tightening 2 - don't do probing 4 - don't do duplicate rows 8 - don't do cliques 16 - some heavy probing options 64 - very heavy probing.

Definition at line 436 of file CglPreProcess.hpp.

## rowType_

char* CglPreProcess::rowType_

private

Row types (may be NULL) Carried around and corresponds to existing rows -1 added by preprocess e.g.

x+y=1 0 normal 1 cut rows - can be dropped if wanted

Definition at line 443 of file CglPreProcess.hpp.

## cuts_

CglStored CglPreProcess::cuts_

private

Cuts from dropped rows.

Definition at line 445 of file CglPreProcess.hpp.

## useElapsedTime_

bool CglPreProcess::useElapsedTime_

private

use elapsed (wallclock time) or cpu time

Definition at line 448 of file CglPreProcess.hpp.

## timeLimit_

double CglPreProcess::timeLimit_

private

time limit (default COIN_DBL_MAX)

Definition at line 451 of file CglPreProcess.hpp.

## keepColumnNames_

bool CglPreProcess::keepColumnNames_

private

keep column names

Definition at line 454 of file CglPreProcess.hpp.

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

- Cgl/src/CglPreProcess/CglPreProcess.hpp