From a0d9443af147e949c1e6a01ac24749d12593ec5b Mon Sep 17 00:00:00 2001 From: Harpreet Date: Sat, 3 Sep 2016 00:36:51 +0530 Subject: cbcintlinprog added --- thirdparty/linux/include/coin/CglPreProcess.hpp | 492 ++++++++++++++++++++++++ 1 file changed, 492 insertions(+) create mode 100644 thirdparty/linux/include/coin/CglPreProcess.hpp (limited to 'thirdparty/linux/include/coin/CglPreProcess.hpp') diff --git a/thirdparty/linux/include/coin/CglPreProcess.hpp b/thirdparty/linux/include/coin/CglPreProcess.hpp new file mode 100644 index 0000000..65c04ca --- /dev/null +++ b/thirdparty/linux/include/coin/CglPreProcess.hpp @@ -0,0 +1,492 @@ +// Copyright (C) 2005, International Business Machines +// Corporation and others. All Rights Reserved. +// This code is licensed under the terms of the Eclipse Public License (EPL). + +#ifndef CglPreProcess_H +#define CglPreProcess_H + +#include +#include + +#include "CoinMessageHandler.hpp" +#include "OsiSolverInterface.hpp" +#include "CglStored.hpp" +#include "OsiPresolve.hpp" +#include "CglCutGenerator.hpp" + +//############################################################################# + +/** 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 etc + +*/ + +class CglPreProcess { + +public: + + ///@name Main methods + //@{ + /** 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 + */ + OsiSolverInterface * 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 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 + */ + OsiSolverInterface * preProcessNonDefault(OsiSolverInterface & model, + int makeEquality=0, int numberPasses=5, + int tuning=0); + /// Creates solution in original model + void postProcess(OsiSolverInterface &model + ,bool deleteStuff=true); + /** 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) + */ + int tightenPrimalBounds(OsiSolverInterface & model,double factor=0.0); + /** Fix some of problem - returning new problem. + Uses reduced costs. + Optional signed character array + 1 always keep, -1 always discard, 0 use djs + + */ + OsiSolverInterface * someFixed(OsiSolverInterface & model, + double fractionToKeep=0.25, + bool fixContinuousAsWell=false, + char * keep=NULL) const; + /** Replace cliques by more maximal cliques + Returns NULL if rows not reduced by greater than cliquesNeeded*rows + + */ + OsiSolverInterface * cliqueIt(OsiSolverInterface & model, + double cliquesNeeded=0.0) const; + /// If we have a cutoff - fix variables + int reducedCostFix(OsiSolverInterface & model); + //@} + + //--------------------------------------------------------------------------- + + /**@name 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. + + */ + //@{ + /** 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. + */ + void setCutoff(double value) ; + + /// Get the cutoff bound on the objective function - always as minimize + double getCutoff() const; + /// The original solver associated with this model. + inline OsiSolverInterface * originalModel() const + { return originalModel_;} + /// Solver after making clique equalities (may == original) + inline OsiSolverInterface * startModel() const + { return startModel_;} + /// Copies of solver at various stages after presolve + inline OsiSolverInterface * modelAtPass(int iPass) const + { if (iPass>=0&&iPass=0&&iPass=0&&iPass