ruby-cbc 0.1.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/.rspec +2 -0
- data/.travis.yml +4 -0
- data/Gemfile +4 -0
- data/README.md +203 -0
- data/Rakefile +40 -0
- data/bin/console +14 -0
- data/bin/setup +7 -0
- data/ext/ruby-cbc/cbc.i +15 -0
- data/ext/ruby-cbc/cbc_wrap.c +4618 -0
- data/ext/ruby-cbc/extconf.rb +60 -0
- data/ext/ruby-cbc/install/bin/cbc +0 -0
- data/ext/ruby-cbc/install/bin/clp +0 -0
- data/ext/ruby-cbc/install/include/coin/CbcBranchActual.hpp +24 -0
- data/ext/ruby-cbc/install/include/coin/CbcBranchAllDifferent.hpp +62 -0
- data/ext/ruby-cbc/install/include/coin/CbcBranchBase.hpp +78 -0
- data/ext/ruby-cbc/install/include/coin/CbcBranchCut.hpp +183 -0
- data/ext/ruby-cbc/install/include/coin/CbcBranchDecision.hpp +129 -0
- data/ext/ruby-cbc/install/include/coin/CbcBranchDefaultDecision.hpp +100 -0
- data/ext/ruby-cbc/install/include/coin/CbcBranchDynamic.hpp +206 -0
- data/ext/ruby-cbc/install/include/coin/CbcBranchLotsize.hpp +242 -0
- data/ext/ruby-cbc/install/include/coin/CbcBranchToFixLots.hpp +94 -0
- data/ext/ruby-cbc/install/include/coin/CbcBranchingObject.hpp +236 -0
- data/ext/ruby-cbc/install/include/coin/CbcClique.hpp +303 -0
- data/ext/ruby-cbc/install/include/coin/CbcCompare.hpp +39 -0
- data/ext/ruby-cbc/install/include/coin/CbcCompareActual.hpp +14 -0
- data/ext/ruby-cbc/install/include/coin/CbcCompareBase.hpp +142 -0
- data/ext/ruby-cbc/install/include/coin/CbcCompareDefault.hpp +120 -0
- data/ext/ruby-cbc/install/include/coin/CbcCompareDepth.hpp +47 -0
- data/ext/ruby-cbc/install/include/coin/CbcCompareEstimate.hpp +48 -0
- data/ext/ruby-cbc/install/include/coin/CbcCompareObjective.hpp +49 -0
- data/ext/ruby-cbc/install/include/coin/CbcConfig.h +14 -0
- data/ext/ruby-cbc/install/include/coin/CbcConsequence.hpp +49 -0
- data/ext/ruby-cbc/install/include/coin/CbcCountRowCut.hpp +168 -0
- data/ext/ruby-cbc/install/include/coin/CbcCutGenerator.hpp +482 -0
- data/ext/ruby-cbc/install/include/coin/CbcCutModifier.hpp +57 -0
- data/ext/ruby-cbc/install/include/coin/CbcCutSubsetModifier.hpp +66 -0
- data/ext/ruby-cbc/install/include/coin/CbcDummyBranchingObject.hpp +83 -0
- data/ext/ruby-cbc/install/include/coin/CbcEventHandler.hpp +245 -0
- data/ext/ruby-cbc/install/include/coin/CbcFathom.hpp +137 -0
- data/ext/ruby-cbc/install/include/coin/CbcFathomDynamicProgramming.hpp +169 -0
- data/ext/ruby-cbc/install/include/coin/CbcFeasibilityBase.hpp +56 -0
- data/ext/ruby-cbc/install/include/coin/CbcFixVariable.hpp +67 -0
- data/ext/ruby-cbc/install/include/coin/CbcFollowOn.hpp +207 -0
- data/ext/ruby-cbc/install/include/coin/CbcFullNodeInfo.hpp +161 -0
- data/ext/ruby-cbc/install/include/coin/CbcGeneral.hpp +60 -0
- data/ext/ruby-cbc/install/include/coin/CbcGeneralDepth.hpp +279 -0
- data/ext/ruby-cbc/install/include/coin/CbcHeuristic.hpp +682 -0
- data/ext/ruby-cbc/install/include/coin/CbcHeuristicDINS.hpp +96 -0
- data/ext/ruby-cbc/install/include/coin/CbcHeuristicDW.hpp +309 -0
- data/ext/ruby-cbc/install/include/coin/CbcHeuristicDive.hpp +192 -0
- data/ext/ruby-cbc/install/include/coin/CbcHeuristicDiveCoefficient.hpp +52 -0
- data/ext/ruby-cbc/install/include/coin/CbcHeuristicDiveFractional.hpp +52 -0
- data/ext/ruby-cbc/install/include/coin/CbcHeuristicDiveGuided.hpp +55 -0
- data/ext/ruby-cbc/install/include/coin/CbcHeuristicDiveLineSearch.hpp +52 -0
- data/ext/ruby-cbc/install/include/coin/CbcHeuristicDivePseudoCost.hpp +60 -0
- data/ext/ruby-cbc/install/include/coin/CbcHeuristicDiveVectorLength.hpp +52 -0
- data/ext/ruby-cbc/install/include/coin/CbcHeuristicFPump.hpp +340 -0
- data/ext/ruby-cbc/install/include/coin/CbcHeuristicGreedy.hpp +280 -0
- data/ext/ruby-cbc/install/include/coin/CbcHeuristicLocal.hpp +271 -0
- data/ext/ruby-cbc/install/include/coin/CbcHeuristicPivotAndFix.hpp +58 -0
- data/ext/ruby-cbc/install/include/coin/CbcHeuristicRENS.hpp +77 -0
- data/ext/ruby-cbc/install/include/coin/CbcHeuristicRINS.hpp +102 -0
- data/ext/ruby-cbc/install/include/coin/CbcHeuristicRandRound.hpp +58 -0
- data/ext/ruby-cbc/install/include/coin/CbcHeuristicVND.hpp +94 -0
- data/ext/ruby-cbc/install/include/coin/CbcLinked.hpp +1406 -0
- data/ext/ruby-cbc/install/include/coin/CbcMessage.hpp +94 -0
- data/ext/ruby-cbc/install/include/coin/CbcMipStartIO.hpp +26 -0
- data/ext/ruby-cbc/install/include/coin/CbcModel.hpp +2952 -0
- data/ext/ruby-cbc/install/include/coin/CbcNWay.hpp +166 -0
- data/ext/ruby-cbc/install/include/coin/CbcNode.hpp +351 -0
- data/ext/ruby-cbc/install/include/coin/CbcNodeInfo.hpp +349 -0
- data/ext/ruby-cbc/install/include/coin/CbcObject.hpp +272 -0
- data/ext/ruby-cbc/install/include/coin/CbcObjectUpdateData.hpp +64 -0
- data/ext/ruby-cbc/install/include/coin/CbcOrClpParam.cpp +4134 -0
- data/ext/ruby-cbc/install/include/coin/CbcOrClpParam.hpp +532 -0
- data/ext/ruby-cbc/install/include/coin/CbcParam.hpp +324 -0
- data/ext/ruby-cbc/install/include/coin/CbcPartialNodeInfo.hpp +110 -0
- data/ext/ruby-cbc/install/include/coin/CbcSOS.hpp +279 -0
- data/ext/ruby-cbc/install/include/coin/CbcSimpleInteger.hpp +286 -0
- data/ext/ruby-cbc/install/include/coin/CbcSimpleIntegerDynamicPseudoCost.hpp +564 -0
- data/ext/ruby-cbc/install/include/coin/CbcSimpleIntegerPseudoCost.hpp +114 -0
- data/ext/ruby-cbc/install/include/coin/CbcSolver.hpp +447 -0
- data/ext/ruby-cbc/install/include/coin/CbcStrategy.hpp +258 -0
- data/ext/ruby-cbc/install/include/coin/CbcSubProblem.hpp +83 -0
- data/ext/ruby-cbc/install/include/coin/CbcTree.hpp +490 -0
- data/ext/ruby-cbc/install/include/coin/CbcTreeLocal.hpp +372 -0
- data/ext/ruby-cbc/install/include/coin/Cbc_C_Interface.h +381 -0
- data/ext/ruby-cbc/install/include/coin/Cgl012cut.hpp +464 -0
- data/ext/ruby-cbc/install/include/coin/CglAllDifferent.hpp +115 -0
- data/ext/ruby-cbc/install/include/coin/CglClique.hpp +308 -0
- data/ext/ruby-cbc/install/include/coin/CglConfig.h +19 -0
- data/ext/ruby-cbc/install/include/coin/CglCutGenerator.hpp +121 -0
- data/ext/ruby-cbc/install/include/coin/CglDuplicateRow.hpp +189 -0
- data/ext/ruby-cbc/install/include/coin/CglFlowCover.hpp +371 -0
- data/ext/ruby-cbc/install/include/coin/CglGMI.hpp +364 -0
- data/ext/ruby-cbc/install/include/coin/CglGMIParam.hpp +313 -0
- data/ext/ruby-cbc/install/include/coin/CglGomory.hpp +204 -0
- data/ext/ruby-cbc/install/include/coin/CglKnapsackCover.hpp +310 -0
- data/ext/ruby-cbc/install/include/coin/CglLandP.hpp +306 -0
- data/ext/ruby-cbc/install/include/coin/CglLandPValidator.hpp +130 -0
- data/ext/ruby-cbc/install/include/coin/CglLiftAndProject.hpp +104 -0
- data/ext/ruby-cbc/install/include/coin/CglMessage.hpp +50 -0
- data/ext/ruby-cbc/install/include/coin/CglMixedIntegerRounding.hpp +429 -0
- data/ext/ruby-cbc/install/include/coin/CglMixedIntegerRounding2.hpp +427 -0
- data/ext/ruby-cbc/install/include/coin/CglOddHole.hpp +160 -0
- data/ext/ruby-cbc/install/include/coin/CglParam.hpp +93 -0
- data/ext/ruby-cbc/install/include/coin/CglPreProcess.hpp +492 -0
- data/ext/ruby-cbc/install/include/coin/CglProbing.hpp +543 -0
- data/ext/ruby-cbc/install/include/coin/CglRedSplit.hpp +448 -0
- data/ext/ruby-cbc/install/include/coin/CglRedSplit2.hpp +494 -0
- data/ext/ruby-cbc/install/include/coin/CglRedSplit2Param.hpp +495 -0
- data/ext/ruby-cbc/install/include/coin/CglRedSplitParam.hpp +272 -0
- data/ext/ruby-cbc/install/include/coin/CglResidualCapacity.hpp +240 -0
- data/ext/ruby-cbc/install/include/coin/CglSimpleRounding.hpp +174 -0
- data/ext/ruby-cbc/install/include/coin/CglStored.hpp +125 -0
- data/ext/ruby-cbc/install/include/coin/CglTreeInfo.hpp +180 -0
- data/ext/ruby-cbc/install/include/coin/CglTwomir.hpp +565 -0
- data/ext/ruby-cbc/install/include/coin/CglZeroHalf.hpp +133 -0
- data/ext/ruby-cbc/install/include/coin/ClpAmplObjective.hpp +113 -0
- data/ext/ruby-cbc/install/include/coin/ClpCholeskyBase.hpp +294 -0
- data/ext/ruby-cbc/install/include/coin/ClpCholeskyDense.hpp +162 -0
- data/ext/ruby-cbc/install/include/coin/ClpConfig.h +17 -0
- data/ext/ruby-cbc/install/include/coin/ClpConstraint.hpp +125 -0
- data/ext/ruby-cbc/install/include/coin/ClpConstraintAmpl.hpp +108 -0
- data/ext/ruby-cbc/install/include/coin/ClpConstraintLinear.hpp +110 -0
- data/ext/ruby-cbc/install/include/coin/ClpConstraintQuadratic.hpp +119 -0
- data/ext/ruby-cbc/install/include/coin/ClpDualRowDantzig.hpp +71 -0
- data/ext/ruby-cbc/install/include/coin/ClpDualRowPivot.hpp +129 -0
- data/ext/ruby-cbc/install/include/coin/ClpDualRowSteepest.hpp +153 -0
- data/ext/ruby-cbc/install/include/coin/ClpDummyMatrix.hpp +183 -0
- data/ext/ruby-cbc/install/include/coin/ClpDynamicExampleMatrix.hpp +186 -0
- data/ext/ruby-cbc/install/include/coin/ClpDynamicMatrix.hpp +381 -0
- data/ext/ruby-cbc/install/include/coin/ClpEventHandler.hpp +187 -0
- data/ext/ruby-cbc/install/include/coin/ClpFactorization.hpp +432 -0
- data/ext/ruby-cbc/install/include/coin/ClpGubDynamicMatrix.hpp +247 -0
- data/ext/ruby-cbc/install/include/coin/ClpGubMatrix.hpp +358 -0
- data/ext/ruby-cbc/install/include/coin/ClpInterior.hpp +570 -0
- data/ext/ruby-cbc/install/include/coin/ClpLinearObjective.hpp +103 -0
- data/ext/ruby-cbc/install/include/coin/ClpMatrixBase.hpp +524 -0
- data/ext/ruby-cbc/install/include/coin/ClpMessage.hpp +131 -0
- data/ext/ruby-cbc/install/include/coin/ClpModel.hpp +1307 -0
- data/ext/ruby-cbc/install/include/coin/ClpNetworkMatrix.hpp +229 -0
- data/ext/ruby-cbc/install/include/coin/ClpNode.hpp +349 -0
- data/ext/ruby-cbc/install/include/coin/ClpNonLinearCost.hpp +401 -0
- data/ext/ruby-cbc/install/include/coin/ClpObjective.hpp +134 -0
- data/ext/ruby-cbc/install/include/coin/ClpPackedMatrix.hpp +638 -0
- data/ext/ruby-cbc/install/include/coin/ClpParameters.hpp +126 -0
- data/ext/ruby-cbc/install/include/coin/ClpPdcoBase.hpp +103 -0
- data/ext/ruby-cbc/install/include/coin/ClpPlusMinusOneMatrix.hpp +290 -0
- data/ext/ruby-cbc/install/include/coin/ClpPresolve.hpp +299 -0
- data/ext/ruby-cbc/install/include/coin/ClpPrimalColumnDantzig.hpp +72 -0
- data/ext/ruby-cbc/install/include/coin/ClpPrimalColumnPivot.hpp +155 -0
- data/ext/ruby-cbc/install/include/coin/ClpPrimalColumnSteepest.hpp +247 -0
- data/ext/ruby-cbc/install/include/coin/ClpQuadraticObjective.hpp +155 -0
- data/ext/ruby-cbc/install/include/coin/ClpSimplex.hpp +1797 -0
- data/ext/ruby-cbc/install/include/coin/ClpSimplexDual.hpp +300 -0
- data/ext/ruby-cbc/install/include/coin/ClpSimplexNonlinear.hpp +117 -0
- data/ext/ruby-cbc/install/include/coin/ClpSimplexOther.hpp +277 -0
- data/ext/ruby-cbc/install/include/coin/ClpSimplexPrimal.hpp +244 -0
- data/ext/ruby-cbc/install/include/coin/ClpSolve.hpp +446 -0
- data/ext/ruby-cbc/install/include/coin/Clp_C_Interface.h +525 -0
- data/ext/ruby-cbc/install/include/coin/CoinAlloc.hpp +176 -0
- data/ext/ruby-cbc/install/include/coin/CoinBuild.hpp +149 -0
- data/ext/ruby-cbc/install/include/coin/CoinDenseFactorization.hpp +419 -0
- data/ext/ruby-cbc/install/include/coin/CoinDenseVector.hpp +383 -0
- data/ext/ruby-cbc/install/include/coin/CoinDistance.hpp +48 -0
- data/ext/ruby-cbc/install/include/coin/CoinError.hpp +257 -0
- data/ext/ruby-cbc/install/include/coin/CoinFactorization.hpp +2044 -0
- data/ext/ruby-cbc/install/include/coin/CoinFileIO.hpp +166 -0
- data/ext/ruby-cbc/install/include/coin/CoinFinite.hpp +34 -0
- data/ext/ruby-cbc/install/include/coin/CoinFloatEqual.hpp +177 -0
- data/ext/ruby-cbc/install/include/coin/CoinHelperFunctions.hpp +1111 -0
- data/ext/ruby-cbc/install/include/coin/CoinIndexedVector.hpp +1164 -0
- data/ext/ruby-cbc/install/include/coin/CoinLpIO.hpp +805 -0
- data/ext/ruby-cbc/install/include/coin/CoinMessage.hpp +96 -0
- data/ext/ruby-cbc/install/include/coin/CoinMessageHandler.hpp +666 -0
- data/ext/ruby-cbc/install/include/coin/CoinModel.hpp +1054 -0
- data/ext/ruby-cbc/install/include/coin/CoinModelUseful.hpp +441 -0
- data/ext/ruby-cbc/install/include/coin/CoinMpsIO.hpp +1056 -0
- data/ext/ruby-cbc/install/include/coin/CoinOslFactorization.hpp +280 -0
- data/ext/ruby-cbc/install/include/coin/CoinPackedMatrix.hpp +947 -0
- data/ext/ruby-cbc/install/include/coin/CoinPackedVector.hpp +657 -0
- data/ext/ruby-cbc/install/include/coin/CoinPackedVectorBase.hpp +269 -0
- data/ext/ruby-cbc/install/include/coin/CoinParam.hpp +644 -0
- data/ext/ruby-cbc/install/include/coin/CoinPragma.hpp +26 -0
- data/ext/ruby-cbc/install/include/coin/CoinPresolveDoubleton.hpp +73 -0
- data/ext/ruby-cbc/install/include/coin/CoinPresolveDual.hpp +85 -0
- data/ext/ruby-cbc/install/include/coin/CoinPresolveDupcol.hpp +226 -0
- data/ext/ruby-cbc/install/include/coin/CoinPresolveEmpty.hpp +116 -0
- data/ext/ruby-cbc/install/include/coin/CoinPresolveFixed.hpp +181 -0
- data/ext/ruby-cbc/install/include/coin/CoinPresolveForcing.hpp +61 -0
- data/ext/ruby-cbc/install/include/coin/CoinPresolveImpliedFree.hpp +60 -0
- data/ext/ruby-cbc/install/include/coin/CoinPresolveIsolated.hpp +51 -0
- data/ext/ruby-cbc/install/include/coin/CoinPresolveMatrix.hpp +1842 -0
- data/ext/ruby-cbc/install/include/coin/CoinPresolveMonitor.hpp +105 -0
- data/ext/ruby-cbc/install/include/coin/CoinPresolvePsdebug.hpp +166 -0
- data/ext/ruby-cbc/install/include/coin/CoinPresolveSingleton.hpp +112 -0
- data/ext/ruby-cbc/install/include/coin/CoinPresolveSubst.hpp +101 -0
- data/ext/ruby-cbc/install/include/coin/CoinPresolveTighten.hpp +55 -0
- data/ext/ruby-cbc/install/include/coin/CoinPresolveTripleton.hpp +66 -0
- data/ext/ruby-cbc/install/include/coin/CoinPresolveUseless.hpp +63 -0
- data/ext/ruby-cbc/install/include/coin/CoinPresolveZeros.hpp +60 -0
- data/ext/ruby-cbc/install/include/coin/CoinRational.hpp +44 -0
- data/ext/ruby-cbc/install/include/coin/CoinSearchTree.hpp +465 -0
- data/ext/ruby-cbc/install/include/coin/CoinShallowPackedVector.hpp +148 -0
- data/ext/ruby-cbc/install/include/coin/CoinSignal.hpp +117 -0
- data/ext/ruby-cbc/install/include/coin/CoinSimpFactorization.hpp +431 -0
- data/ext/ruby-cbc/install/include/coin/CoinSmartPtr.hpp +528 -0
- data/ext/ruby-cbc/install/include/coin/CoinSnapshot.hpp +476 -0
- data/ext/ruby-cbc/install/include/coin/CoinSort.hpp +678 -0
- data/ext/ruby-cbc/install/include/coin/CoinStructuredModel.hpp +247 -0
- data/ext/ruby-cbc/install/include/coin/CoinTime.hpp +310 -0
- data/ext/ruby-cbc/install/include/coin/CoinTypes.hpp +64 -0
- data/ext/ruby-cbc/install/include/coin/CoinUtility.hpp +19 -0
- data/ext/ruby-cbc/install/include/coin/CoinUtilsConfig.h +34 -0
- data/ext/ruby-cbc/install/include/coin/CoinWarmStart.hpp +58 -0
- data/ext/ruby-cbc/install/include/coin/CoinWarmStartBasis.hpp +456 -0
- data/ext/ruby-cbc/install/include/coin/CoinWarmStartDual.hpp +166 -0
- data/ext/ruby-cbc/install/include/coin/CoinWarmStartPrimalDual.hpp +211 -0
- data/ext/ruby-cbc/install/include/coin/CoinWarmStartVector.hpp +488 -0
- data/ext/ruby-cbc/install/include/coin/Coin_C_defines.h +115 -0
- data/ext/ruby-cbc/install/include/coin/Idiot.hpp +298 -0
- data/ext/ruby-cbc/install/include/coin/OsiAuxInfo.hpp +206 -0
- data/ext/ruby-cbc/install/include/coin/OsiBranchingObject.hpp +1005 -0
- data/ext/ruby-cbc/install/include/coin/OsiCbcSolverInterface.hpp +764 -0
- data/ext/ruby-cbc/install/include/coin/OsiChooseVariable.hpp +534 -0
- data/ext/ruby-cbc/install/include/coin/OsiClpSolverInterface.hpp +1509 -0
- data/ext/ruby-cbc/install/include/coin/OsiColCut.hpp +324 -0
- data/ext/ruby-cbc/install/include/coin/OsiCollections.hpp +35 -0
- data/ext/ruby-cbc/install/include/coin/OsiConfig.h +19 -0
- data/ext/ruby-cbc/install/include/coin/OsiCut.hpp +245 -0
- data/ext/ruby-cbc/install/include/coin/OsiCuts.hpp +474 -0
- data/ext/ruby-cbc/install/include/coin/OsiPresolve.hpp +252 -0
- data/ext/ruby-cbc/install/include/coin/OsiRowCut.hpp +331 -0
- data/ext/ruby-cbc/install/include/coin/OsiRowCutDebugger.hpp +187 -0
- data/ext/ruby-cbc/install/include/coin/OsiSolverBranch.hpp +152 -0
- data/ext/ruby-cbc/install/include/coin/OsiSolverInterface.hpp +2143 -0
- data/ext/ruby-cbc/install/include/coin/OsiSolverParameters.hpp +142 -0
- data/ext/ruby-cbc/install/include/coin/OsiUnitTests.hpp +374 -0
- data/ext/ruby-cbc/install/lib/libCbc.la +35 -0
- data/ext/ruby-cbc/install/lib/libCbc.so +0 -0
- data/ext/ruby-cbc/install/lib/libCbc.so.3 +0 -0
- data/ext/ruby-cbc/install/lib/libCbc.so.3.9.7 +0 -0
- data/ext/ruby-cbc/install/lib/libCbcSolver.la +35 -0
- data/ext/ruby-cbc/install/lib/libCbcSolver.so +0 -0
- data/ext/ruby-cbc/install/lib/libCbcSolver.so.3 +0 -0
- data/ext/ruby-cbc/install/lib/libCbcSolver.so.3.9.7 +0 -0
- data/ext/ruby-cbc/install/lib/libCgl.la +35 -0
- data/ext/ruby-cbc/install/lib/libCgl.so +0 -0
- data/ext/ruby-cbc/install/lib/libCgl.so.1 +0 -0
- data/ext/ruby-cbc/install/lib/libCgl.so.1.9.7 +0 -0
- data/ext/ruby-cbc/install/lib/libClp.la +35 -0
- data/ext/ruby-cbc/install/lib/libClp.so +0 -0
- data/ext/ruby-cbc/install/lib/libClp.so.1 +0 -0
- data/ext/ruby-cbc/install/lib/libClp.so.1.13.9 +0 -0
- data/ext/ruby-cbc/install/lib/libClpSolver.la +35 -0
- data/ext/ruby-cbc/install/lib/libClpSolver.so +0 -0
- data/ext/ruby-cbc/install/lib/libClpSolver.so.1 +0 -0
- data/ext/ruby-cbc/install/lib/libClpSolver.so.1.13.9 +0 -0
- data/ext/ruby-cbc/install/lib/libCoinUtils.la +35 -0
- data/ext/ruby-cbc/install/lib/libCoinUtils.so +0 -0
- data/ext/ruby-cbc/install/lib/libCoinUtils.so.3 +0 -0
- data/ext/ruby-cbc/install/lib/libCoinUtils.so.3.10.11 +0 -0
- data/ext/ruby-cbc/install/lib/libOsi.la +35 -0
- data/ext/ruby-cbc/install/lib/libOsi.so +0 -0
- data/ext/ruby-cbc/install/lib/libOsi.so.1 +0 -0
- data/ext/ruby-cbc/install/lib/libOsi.so.1.12.6 +0 -0
- data/ext/ruby-cbc/install/lib/libOsiCbc.la +35 -0
- data/ext/ruby-cbc/install/lib/libOsiCbc.so +0 -0
- data/ext/ruby-cbc/install/lib/libOsiCbc.so.3 +0 -0
- data/ext/ruby-cbc/install/lib/libOsiCbc.so.3.9.7 +0 -0
- data/ext/ruby-cbc/install/lib/libOsiClp.la +35 -0
- data/ext/ruby-cbc/install/lib/libOsiClp.so +0 -0
- data/ext/ruby-cbc/install/lib/libOsiClp.so.1 +0 -0
- data/ext/ruby-cbc/install/lib/libOsiClp.so.1.13.9 +0 -0
- data/ext/ruby-cbc/install/lib/libOsiCommonTests.la +35 -0
- data/ext/ruby-cbc/install/lib/libOsiCommonTests.so +0 -0
- data/ext/ruby-cbc/install/lib/libOsiCommonTests.so.1 +0 -0
- data/ext/ruby-cbc/install/lib/libOsiCommonTests.so.1.12.6 +0 -0
- data/ext/ruby-cbc/install/lib/pkgconfig/cbc.pc +12 -0
- data/ext/ruby-cbc/install/lib/pkgconfig/cgl.pc +12 -0
- data/ext/ruby-cbc/install/lib/pkgconfig/clp.pc +12 -0
- data/ext/ruby-cbc/install/lib/pkgconfig/coindatamiplib3.pc +9 -0
- data/ext/ruby-cbc/install/lib/pkgconfig/coindatasample.pc +9 -0
- data/ext/ruby-cbc/install/lib/pkgconfig/coinutils.pc +12 -0
- data/ext/ruby-cbc/install/lib/pkgconfig/osi-cbc.pc +12 -0
- data/ext/ruby-cbc/install/lib/pkgconfig/osi-clp.pc +12 -0
- data/ext/ruby-cbc/install/lib/pkgconfig/osi-unittests.pc +12 -0
- data/ext/ruby-cbc/install/lib/pkgconfig/osi.pc +12 -0
- data/lib/ruby-cbc/ilp/constant.rb +44 -0
- data/lib/ruby-cbc/ilp/constraint.rb +32 -0
- data/lib/ruby-cbc/ilp/objective.rb +26 -0
- data/lib/ruby-cbc/ilp/term.rb +47 -0
- data/lib/ruby-cbc/ilp/term_array.rb +80 -0
- data/lib/ruby-cbc/ilp/var.rb +62 -0
- data/lib/ruby-cbc/model.rb +125 -0
- data/lib/ruby-cbc/problem.rb +170 -0
- data/lib/ruby-cbc/version.rb +3 -0
- data/lib/ruby-cbc.rb +21 -0
- data/ruby-cbc.gemspec +36 -0
- metadata +431 -0
@@ -0,0 +1,2952 @@
|
|
1
|
+
/* $Id: CbcModel.hpp 2206 2015-07-07 20:44:40Z stefan $ */
|
2
|
+
// Copyright (C) 2002, International Business Machines
|
3
|
+
// Corporation and others. All Rights Reserved.
|
4
|
+
// This code is licensed under the terms of the Eclipse Public License (EPL).
|
5
|
+
|
6
|
+
#ifndef CbcModel_H
|
7
|
+
#define CbcModel_H
|
8
|
+
#include <string>
|
9
|
+
#include <vector>
|
10
|
+
#include "CoinMessageHandler.hpp"
|
11
|
+
#include "OsiSolverInterface.hpp"
|
12
|
+
#include "OsiBranchingObject.hpp"
|
13
|
+
#include "OsiCuts.hpp"
|
14
|
+
#include "CoinWarmStartBasis.hpp"
|
15
|
+
#include "CbcCompareBase.hpp"
|
16
|
+
#include "CbcCountRowCut.hpp"
|
17
|
+
#include "CbcMessage.hpp"
|
18
|
+
#include "CbcEventHandler.hpp"
|
19
|
+
#include "ClpDualRowPivot.hpp"
|
20
|
+
|
21
|
+
|
22
|
+
class CbcCutGenerator;
|
23
|
+
class CbcBaseModel;
|
24
|
+
class OsiRowCut;
|
25
|
+
class OsiBabSolver;
|
26
|
+
class OsiRowCutDebugger;
|
27
|
+
class CglCutGenerator;
|
28
|
+
class CglStored;
|
29
|
+
class CbcCutModifier;
|
30
|
+
class CglTreeProbingInfo;
|
31
|
+
class CbcHeuristic;
|
32
|
+
class OsiObject;
|
33
|
+
class CbcThread;
|
34
|
+
class CbcTree;
|
35
|
+
class CbcStrategy;
|
36
|
+
class CbcSymmetry;
|
37
|
+
class CbcFeasibilityBase;
|
38
|
+
class CbcStatistics;
|
39
|
+
class CbcFullNodeInfo;
|
40
|
+
class CbcEventHandler ;
|
41
|
+
class CglPreProcess;
|
42
|
+
class OsiClpSolverInterface;
|
43
|
+
class ClpNodeStuff;
|
44
|
+
|
45
|
+
// #define CBC_CHECK_BASIS 1
|
46
|
+
|
47
|
+
//#############################################################################
|
48
|
+
|
49
|
+
/** Simple Branch and bound class
|
50
|
+
|
51
|
+
The initialSolve() method solves the initial LP relaxation of the MIP
|
52
|
+
problem. The branchAndBound() method can then be called to finish using
|
53
|
+
a branch and cut algorithm.
|
54
|
+
|
55
|
+
<h3>Search Tree Traversal</h3>
|
56
|
+
|
57
|
+
Subproblems (aka nodes) requiring additional evaluation are stored using
|
58
|
+
the CbcNode and CbcNodeInfo objects. Ancestry linkage is maintained in the
|
59
|
+
CbcNodeInfo object. Evaluation of a subproblem within branchAndBound()
|
60
|
+
proceeds as follows:
|
61
|
+
<ul>
|
62
|
+
<li> The node representing the most promising parent subproblem is popped
|
63
|
+
from the heap which holds the set of subproblems requiring further
|
64
|
+
evaluation.
|
65
|
+
<li> Using branching instructions stored in the node, and information in
|
66
|
+
its ancestors, the model and solver are adjusted to create the
|
67
|
+
active subproblem.
|
68
|
+
<li> If the parent subproblem will require further evaluation
|
69
|
+
(<i>i.e.</i>, there are branches remaining) its node is pushed back
|
70
|
+
on the heap. Otherwise, the node is deleted. This may trigger
|
71
|
+
recursive deletion of ancestors.
|
72
|
+
<li> The newly created subproblem is evaluated.
|
73
|
+
<li> If the subproblem requires further evaluation, a node is created.
|
74
|
+
All information needed to recreate the subproblem (branching
|
75
|
+
information, row and column cuts) is placed in the node and the node
|
76
|
+
is added to the set of subproblems awaiting further evaluation.
|
77
|
+
</ul>
|
78
|
+
Note that there is never a node representing the active subproblem; the model
|
79
|
+
and solver represent the active subproblem.
|
80
|
+
|
81
|
+
<h3>Row (Constraint) Cut Handling</h3>
|
82
|
+
|
83
|
+
For a typical subproblem, the sequence of events is as follows:
|
84
|
+
<ul>
|
85
|
+
<li> The subproblem is rebuilt for further evaluation: One result of a
|
86
|
+
call to addCuts() is a traversal of ancestors, leaving a list of all
|
87
|
+
cuts used in the ancestors in #addedCuts_. This list is then scanned
|
88
|
+
to construct a basis that includes only tight cuts. Entries for
|
89
|
+
loose cuts are set to NULL.
|
90
|
+
<li> The subproblem is evaluated: One result of a call to solveWithCuts()
|
91
|
+
is the return of a set of newly generated cuts for the subproblem.
|
92
|
+
#addedCuts_ is also kept up-to-date as old cuts become loose.
|
93
|
+
<li> The subproblem is stored for further processing: A call to
|
94
|
+
CbcNodeInfo::addCuts() adds the newly generated cuts to the
|
95
|
+
CbcNodeInfo object associated with this node.
|
96
|
+
</ul>
|
97
|
+
See CbcCountRowCut for details of the bookkeeping associated with cut
|
98
|
+
management.
|
99
|
+
*/
|
100
|
+
|
101
|
+
class CbcModel {
|
102
|
+
|
103
|
+
public:
|
104
|
+
|
105
|
+
enum CbcIntParam {
|
106
|
+
/** The maximum number of nodes before terminating */
|
107
|
+
CbcMaxNumNode = 0,
|
108
|
+
/** The maximum number of solutions before terminating */
|
109
|
+
CbcMaxNumSol,
|
110
|
+
/** Fathoming discipline
|
111
|
+
|
112
|
+
Controls objective function comparisons for purposes of fathoming by bound
|
113
|
+
or determining monotonic variables.
|
114
|
+
|
115
|
+
If 1, action is taken only when the current objective is strictly worse
|
116
|
+
than the target. Implementation is handled by adding a small tolerance to
|
117
|
+
the target.
|
118
|
+
*/
|
119
|
+
CbcFathomDiscipline,
|
120
|
+
/** Adjusts printout
|
121
|
+
1 does different node message with number unsatisfied on last branch
|
122
|
+
*/
|
123
|
+
CbcPrinting,
|
124
|
+
/** Number of branches (may be more than number of nodes as may
|
125
|
+
include strong branching) */
|
126
|
+
CbcNumberBranches,
|
127
|
+
/** Just a marker, so that a static sized array can store parameters. */
|
128
|
+
CbcLastIntParam
|
129
|
+
};
|
130
|
+
|
131
|
+
enum CbcDblParam {
|
132
|
+
/** The maximum amount the value of an integer variable can vary from
|
133
|
+
integer and still be considered feasible. */
|
134
|
+
CbcIntegerTolerance = 0,
|
135
|
+
/** The objective is assumed to worsen by this amount for each
|
136
|
+
integer infeasibility. */
|
137
|
+
CbcInfeasibilityWeight,
|
138
|
+
/** The amount by which to tighten the objective function cutoff when
|
139
|
+
a new solution is discovered. */
|
140
|
+
CbcCutoffIncrement,
|
141
|
+
/** Stop when the gap between the objective value of the best known solution
|
142
|
+
and the best bound on the objective of any solution is less than this.
|
143
|
+
|
144
|
+
This is an absolute value. Conversion from a percentage is left to the
|
145
|
+
client.
|
146
|
+
*/
|
147
|
+
CbcAllowableGap,
|
148
|
+
/** Stop when the gap between the objective value of the best known solution
|
149
|
+
and the best bound on the objective of any solution is less than this
|
150
|
+
fraction of of the absolute value of best known solution.
|
151
|
+
|
152
|
+
Code stops if either this test or CbcAllowableGap test succeeds
|
153
|
+
*/
|
154
|
+
CbcAllowableFractionGap,
|
155
|
+
/** \brief The maximum number of seconds before terminating.
|
156
|
+
A double should be adequate! */
|
157
|
+
CbcMaximumSeconds,
|
158
|
+
/// Cutoff - stored for speed
|
159
|
+
CbcCurrentCutoff,
|
160
|
+
/// Optimization direction - stored for speed
|
161
|
+
CbcOptimizationDirection,
|
162
|
+
/// Current objective value
|
163
|
+
CbcCurrentObjectiveValue,
|
164
|
+
/// Current minimization objective value
|
165
|
+
CbcCurrentMinimizationObjectiveValue,
|
166
|
+
/** \brief The time at start of model.
|
167
|
+
So that other pieces of code can access */
|
168
|
+
CbcStartSeconds,
|
169
|
+
/** Stop doing heuristics when the gap between the objective value of the
|
170
|
+
best known solution and the best bound on the objective of any solution
|
171
|
+
is less than this.
|
172
|
+
|
173
|
+
This is an absolute value. Conversion from a percentage is left to the
|
174
|
+
client.
|
175
|
+
*/
|
176
|
+
CbcHeuristicGap,
|
177
|
+
/** Stop doing heuristics when the gap between the objective value of the
|
178
|
+
best known solution and the best bound on the objective of any solution
|
179
|
+
is less than this fraction of of the absolute value of best known
|
180
|
+
solution.
|
181
|
+
|
182
|
+
Code stops if either this test or CbcAllowableGap test succeeds
|
183
|
+
*/
|
184
|
+
CbcHeuristicFractionGap,
|
185
|
+
/// Smallest non-zero change on a branch
|
186
|
+
CbcSmallestChange,
|
187
|
+
/// Sum of non-zero changes on a branch
|
188
|
+
CbcSumChange,
|
189
|
+
/// Largest non-zero change on a branch
|
190
|
+
CbcLargestChange,
|
191
|
+
/// Small non-zero change on a branch to be used as guess
|
192
|
+
CbcSmallChange,
|
193
|
+
/** Just a marker, so that a static sized array can store parameters. */
|
194
|
+
CbcLastDblParam
|
195
|
+
};
|
196
|
+
|
197
|
+
//---------------------------------------------------------------------------
|
198
|
+
|
199
|
+
public:
|
200
|
+
///@name Solve methods
|
201
|
+
//@{
|
202
|
+
/** \brief Solve the initial LP relaxation
|
203
|
+
|
204
|
+
Invoke the solver's %initialSolve() method.
|
205
|
+
*/
|
206
|
+
void initialSolve();
|
207
|
+
|
208
|
+
/** \brief Invoke the branch \& cut algorithm
|
209
|
+
|
210
|
+
The method assumes that initialSolve() has been called to solve the
|
211
|
+
LP relaxation. It processes the root node, then proceeds to explore the
|
212
|
+
branch & cut search tree. The search ends when the tree is exhausted or
|
213
|
+
one of several execution limits is reached.
|
214
|
+
If doStatistics is 1 summary statistics are printed
|
215
|
+
if 2 then also the path to best solution (if found by branching)
|
216
|
+
if 3 then also one line per node
|
217
|
+
*/
|
218
|
+
void branchAndBound(int doStatistics = 0);
|
219
|
+
private:
|
220
|
+
|
221
|
+
/** \brief Evaluate a subproblem using cutting planes and heuristics
|
222
|
+
|
223
|
+
The method invokes a main loop which generates cuts, applies heuristics,
|
224
|
+
and reoptimises using the solver's native %resolve() method.
|
225
|
+
It returns true if the subproblem remains feasible at the end of the
|
226
|
+
evaluation.
|
227
|
+
*/
|
228
|
+
bool solveWithCuts(OsiCuts & cuts, int numberTries, CbcNode * node);
|
229
|
+
/** Generate one round of cuts - serial mode
|
230
|
+
returns -
|
231
|
+
0 - normal
|
232
|
+
1 - must keep going
|
233
|
+
2 - set numberTries to zero
|
234
|
+
-1 - infeasible
|
235
|
+
*/
|
236
|
+
int serialCuts(OsiCuts & cuts, CbcNode * node, OsiCuts & slackCuts, int lastNumberCuts);
|
237
|
+
/** Generate one round of cuts - parallel mode
|
238
|
+
returns -
|
239
|
+
0 - normal
|
240
|
+
1 - must keep going
|
241
|
+
2 - set numberTries to zero
|
242
|
+
-1 - infeasible
|
243
|
+
*/
|
244
|
+
int parallelCuts(CbcBaseModel * master, OsiCuts & cuts, CbcNode * node, OsiCuts & slackCuts, int lastNumberCuts);
|
245
|
+
/** Input one node output N nodes to put on tree and optional solution update
|
246
|
+
This should be able to operate in parallel so is given a solver and is const(ish)
|
247
|
+
However we will need to keep an array of solver_ and bases and more
|
248
|
+
status is 0 for normal, 1 if solution
|
249
|
+
Calling code should always push nodes back on tree
|
250
|
+
*/
|
251
|
+
CbcNode ** solveOneNode(int whichSolver, CbcNode * node,
|
252
|
+
int & numberNodesOutput, int & status) ;
|
253
|
+
/// Update size of whichGenerator
|
254
|
+
void resizeWhichGenerator(int numberNow, int numberAfter);
|
255
|
+
public:
|
256
|
+
#ifdef CBC_KEEP_DEPRECATED
|
257
|
+
// See if anyone is using these any more!!
|
258
|
+
/** \brief create a clean model from partially fixed problem
|
259
|
+
|
260
|
+
The method creates a new model with given bounds and with no tree.
|
261
|
+
*/
|
262
|
+
CbcModel * cleanModel(const double * lower, const double * upper);
|
263
|
+
/** \brief Invoke the branch \& cut algorithm on partially fixed problem
|
264
|
+
|
265
|
+
The method presolves the given model and does branch and cut. The search
|
266
|
+
ends when the tree is exhausted or maximum nodes is reached.
|
267
|
+
|
268
|
+
If better solution found then it is saved.
|
269
|
+
|
270
|
+
Returns 0 if search completed and solution, 1 if not completed and solution,
|
271
|
+
2 if completed and no solution, 3 if not completed and no solution.
|
272
|
+
|
273
|
+
Normally okay to do cleanModel immediately followed by subBranchandBound
|
274
|
+
(== other form of subBranchAndBound)
|
275
|
+
but may need to get at model for advanced features.
|
276
|
+
|
277
|
+
Deletes model2
|
278
|
+
*/
|
279
|
+
int subBranchAndBound(CbcModel * model2,
|
280
|
+
CbcModel * presolvedModel,
|
281
|
+
int maximumNodes);
|
282
|
+
/** \brief Invoke the branch \& cut algorithm on partially fixed problem
|
283
|
+
|
284
|
+
The method creates a new model with given bounds, presolves it
|
285
|
+
then proceeds to explore the branch & cut search tree. The search
|
286
|
+
ends when the tree is exhausted or maximum nodes is reached.
|
287
|
+
|
288
|
+
If better solution found then it is saved.
|
289
|
+
|
290
|
+
Returns 0 if search completed and solution, 1 if not completed and solution,
|
291
|
+
2 if completed and no solution, 3 if not completed and no solution.
|
292
|
+
|
293
|
+
This is just subModel immediately followed by other version of
|
294
|
+
subBranchandBound.
|
295
|
+
|
296
|
+
*/
|
297
|
+
int subBranchAndBound(const double * lower, const double * upper,
|
298
|
+
int maximumNodes);
|
299
|
+
|
300
|
+
/** \brief Process root node and return a strengthened model
|
301
|
+
|
302
|
+
The method assumes that initialSolve() has been called to solve the
|
303
|
+
LP relaxation. It processes the root node and then returns a pointer
|
304
|
+
to the strengthened model (or NULL if infeasible)
|
305
|
+
*/
|
306
|
+
OsiSolverInterface * strengthenedModel();
|
307
|
+
/** preProcess problem - replacing solver
|
308
|
+
If makeEquality true then <= cliques converted to ==.
|
309
|
+
Presolve will be done numberPasses times.
|
310
|
+
|
311
|
+
Returns NULL if infeasible
|
312
|
+
|
313
|
+
If makeEquality is 1 add slacks to get cliques,
|
314
|
+
if 2 add slacks to get sos (but only if looks plausible) and keep sos info
|
315
|
+
*/
|
316
|
+
CglPreProcess * preProcess( int makeEquality = 0, int numberPasses = 5,
|
317
|
+
int tuning = 5);
|
318
|
+
/** Does postprocessing - original solver back.
|
319
|
+
User has to delete process */
|
320
|
+
void postProcess(CglPreProcess * process);
|
321
|
+
#endif
|
322
|
+
/// Adds an update information object
|
323
|
+
void addUpdateInformation(const CbcObjectUpdateData & data);
|
324
|
+
/** Do one node - broken out for clarity?
|
325
|
+
also for parallel (when baseModel!=this)
|
326
|
+
Returns 1 if solution found
|
327
|
+
node NULL on return if no branches left
|
328
|
+
newNode NULL if no new node created
|
329
|
+
*/
|
330
|
+
int doOneNode(CbcModel * baseModel, CbcNode * & node, CbcNode * & newNode);
|
331
|
+
|
332
|
+
public:
|
333
|
+
/** \brief Reoptimise an LP relaxation
|
334
|
+
|
335
|
+
Invoke the solver's %resolve() method.
|
336
|
+
whereFrom -
|
337
|
+
0 - initial continuous
|
338
|
+
1 - resolve on branch (before new cuts)
|
339
|
+
2 - after new cuts
|
340
|
+
3 - obsolete code or something modified problem in unexpected way
|
341
|
+
10 - after strong branching has fixed variables at root
|
342
|
+
11 - after strong branching has fixed variables in tree
|
343
|
+
|
344
|
+
returns 1 feasible, 0 infeasible, -1 feasible but skip cuts
|
345
|
+
*/
|
346
|
+
int resolve(CbcNodeInfo * parent, int whereFrom,
|
347
|
+
double * saveSolution = NULL,
|
348
|
+
double * saveLower = NULL,
|
349
|
+
double * saveUpper = NULL);
|
350
|
+
/// Make given rows (L or G) into global cuts and remove from lp
|
351
|
+
void makeGlobalCuts(int numberRows, const int * which);
|
352
|
+
/// Make given cut into a global cut
|
353
|
+
int makeGlobalCut(const OsiRowCut * cut);
|
354
|
+
/// Make given cut into a global cut
|
355
|
+
int makeGlobalCut(const OsiRowCut & cut);
|
356
|
+
/// Make given column cut into a global cut
|
357
|
+
void makeGlobalCut(const OsiColCut * cut);
|
358
|
+
/// Make given column cut into a global cut
|
359
|
+
void makeGlobalCut(const OsiColCut & cut);
|
360
|
+
/// Make partial cut into a global cut and save
|
361
|
+
void makePartialCut(const OsiRowCut * cut, const OsiSolverInterface * solver=NULL);
|
362
|
+
/// Make partial cuts into global cuts
|
363
|
+
void makeGlobalCuts();
|
364
|
+
/// Which cut generator generated this cut
|
365
|
+
inline const int * whichGenerator() const
|
366
|
+
{ return whichGenerator_;}
|
367
|
+
//@}
|
368
|
+
|
369
|
+
/** \name Presolve methods */
|
370
|
+
//@{
|
371
|
+
|
372
|
+
/** Identify cliques and construct corresponding objects.
|
373
|
+
|
374
|
+
Find cliques with size in the range
|
375
|
+
[\p atLeastThisMany, \p lessThanThis] and construct corresponding
|
376
|
+
CbcClique objects.
|
377
|
+
If \p makeEquality is true then a new model may be returned if
|
378
|
+
modifications had to be made, otherwise \c this is returned.
|
379
|
+
If the problem is infeasible #numberObjects_ is set to -1.
|
380
|
+
A client must use deleteObjects() before a second call to findCliques().
|
381
|
+
If priorities exist, clique priority is set to the default.
|
382
|
+
*/
|
383
|
+
CbcModel * findCliques(bool makeEquality, int atLeastThisMany,
|
384
|
+
int lessThanThis, int defaultValue = 1000);
|
385
|
+
|
386
|
+
/** Do integer presolve, creating a new (presolved) model.
|
387
|
+
|
388
|
+
Returns the new model, or NULL if feasibility is lost.
|
389
|
+
If weak is true then just does a normal presolve
|
390
|
+
|
391
|
+
\todo It remains to work out the cleanest way of getting a solution to
|
392
|
+
the original problem at the end. So this is very preliminary.
|
393
|
+
*/
|
394
|
+
CbcModel * integerPresolve(bool weak = false);
|
395
|
+
|
396
|
+
/** Do integer presolve, modifying the current model.
|
397
|
+
|
398
|
+
Returns true if the model remains feasible after presolve.
|
399
|
+
*/
|
400
|
+
bool integerPresolveThisModel(OsiSolverInterface * originalSolver, bool weak = false);
|
401
|
+
|
402
|
+
|
403
|
+
/// Put back information into the original model after integer presolve.
|
404
|
+
void originalModel(CbcModel * presolvedModel, bool weak);
|
405
|
+
|
406
|
+
/** \brief For variables involved in VUB constraints, see if we can tighten
|
407
|
+
bounds by solving lp's
|
408
|
+
|
409
|
+
Returns false if feasibility is lost.
|
410
|
+
If CglProbing is available, it will be tried as well to see if it can
|
411
|
+
tighten bounds.
|
412
|
+
This routine is just a front end for tightenVubs(int,const int*,double).
|
413
|
+
|
414
|
+
If <tt>type = -1</tt> all variables are processed (could be very slow).
|
415
|
+
If <tt>type = 0</tt> only variables involved in VUBs are processed.
|
416
|
+
If <tt>type = n > 0</tt>, only the n most expensive VUB variables
|
417
|
+
are processed, where it is assumed that x is at its maximum so delta
|
418
|
+
would have to go to 1 (if x not at bound).
|
419
|
+
|
420
|
+
If \p allowMultipleBinary is true, then a VUB constraint is a row with
|
421
|
+
one continuous variable and any number of binary variables.
|
422
|
+
|
423
|
+
If <tt>useCutoff < 1.0e30</tt>, the original objective is installed as a
|
424
|
+
constraint with \p useCutoff as a bound.
|
425
|
+
*/
|
426
|
+
bool tightenVubs(int type, bool allowMultipleBinary = false,
|
427
|
+
double useCutoff = 1.0e50);
|
428
|
+
|
429
|
+
/** \brief For variables involved in VUB constraints, see if we can tighten
|
430
|
+
bounds by solving lp's
|
431
|
+
|
432
|
+
This version is just handed a list of variables to be processed.
|
433
|
+
*/
|
434
|
+
bool tightenVubs(int numberVubs, const int * which,
|
435
|
+
double useCutoff = 1.0e50);
|
436
|
+
/**
|
437
|
+
Analyze problem to find a minimum change in the objective function.
|
438
|
+
*/
|
439
|
+
void analyzeObjective();
|
440
|
+
|
441
|
+
/**
|
442
|
+
Add additional integers.
|
443
|
+
*/
|
444
|
+
void AddIntegers();
|
445
|
+
/**
|
446
|
+
Save copy of the model.
|
447
|
+
*/
|
448
|
+
void saveModel(OsiSolverInterface * saveSolver, double * checkCutoffForRestart, bool * feasible);
|
449
|
+
/**
|
450
|
+
Flip direction of optimization on all models
|
451
|
+
*/
|
452
|
+
void flipModel();
|
453
|
+
|
454
|
+
//@}
|
455
|
+
|
456
|
+
/** \name Object manipulation routines
|
457
|
+
|
458
|
+
See OsiObject for an explanation of `object' in the context of CbcModel.
|
459
|
+
*/
|
460
|
+
//@{
|
461
|
+
|
462
|
+
/// Get the number of objects
|
463
|
+
inline int numberObjects() const {
|
464
|
+
return numberObjects_;
|
465
|
+
}
|
466
|
+
/// Set the number of objects
|
467
|
+
inline void setNumberObjects(int number) {
|
468
|
+
numberObjects_ = number;
|
469
|
+
}
|
470
|
+
|
471
|
+
/// Get the array of objects
|
472
|
+
inline OsiObject ** objects() const {
|
473
|
+
return object_;
|
474
|
+
}
|
475
|
+
|
476
|
+
/// Get the specified object
|
477
|
+
const inline OsiObject * object(int which) const {
|
478
|
+
return object_[which];
|
479
|
+
}
|
480
|
+
/// Get the specified object
|
481
|
+
inline OsiObject * modifiableObject(int which) const {
|
482
|
+
return object_[which];
|
483
|
+
}
|
484
|
+
|
485
|
+
void setOptionalInteger(int index);
|
486
|
+
|
487
|
+
/// Delete all object information (and just back to integers if true)
|
488
|
+
void deleteObjects(bool findIntegers = true);
|
489
|
+
|
490
|
+
/** Add in object information.
|
491
|
+
|
492
|
+
Objects are cloned; the owner can delete the originals.
|
493
|
+
*/
|
494
|
+
void addObjects(int numberObjects, OsiObject ** objects);
|
495
|
+
|
496
|
+
/** Add in object information.
|
497
|
+
|
498
|
+
Objects are cloned; the owner can delete the originals.
|
499
|
+
*/
|
500
|
+
void addObjects(int numberObjects, CbcObject ** objects);
|
501
|
+
|
502
|
+
/// Ensure attached objects point to this model.
|
503
|
+
void synchronizeModel() ;
|
504
|
+
|
505
|
+
/** \brief Identify integer variables and create corresponding objects.
|
506
|
+
|
507
|
+
Record integer variables and create an CbcSimpleInteger object for each
|
508
|
+
one.
|
509
|
+
If \p startAgain is true, a new scan is forced, overwriting any existing
|
510
|
+
integer variable information.
|
511
|
+
If type > 0 then 1==PseudoCost, 2 new ones low priority
|
512
|
+
*/
|
513
|
+
|
514
|
+
void findIntegers(bool startAgain, int type = 0);
|
515
|
+
|
516
|
+
#ifdef SWITCH_VARIABLES
|
517
|
+
/// Convert Dynamic to Switching
|
518
|
+
int findSwitching();
|
519
|
+
/// Fix associated variables
|
520
|
+
int fixAssociated(OsiSolverInterface * solver,int cleanBasis);
|
521
|
+
/// Debug associated variables
|
522
|
+
int checkAssociated(const OsiSolverInterface * solver,
|
523
|
+
const double * solution, int printLevel);
|
524
|
+
#endif
|
525
|
+
//@}
|
526
|
+
|
527
|
+
//---------------------------------------------------------------------------
|
528
|
+
|
529
|
+
/**@name Parameter set/get methods
|
530
|
+
|
531
|
+
The set methods return true if the parameter was set to the given value,
|
532
|
+
false if the value of the parameter is out of range.
|
533
|
+
|
534
|
+
The get methods return the value of the parameter.
|
535
|
+
|
536
|
+
*/
|
537
|
+
//@{
|
538
|
+
/// Set an integer parameter
|
539
|
+
inline bool setIntParam(CbcIntParam key, int value) {
|
540
|
+
intParam_[key] = value;
|
541
|
+
return true;
|
542
|
+
}
|
543
|
+
/// Set a double parameter
|
544
|
+
inline bool setDblParam(CbcDblParam key, double value) {
|
545
|
+
dblParam_[key] = value;
|
546
|
+
return true;
|
547
|
+
}
|
548
|
+
/// Get an integer parameter
|
549
|
+
inline int getIntParam(CbcIntParam key) const {
|
550
|
+
return intParam_[key];
|
551
|
+
}
|
552
|
+
/// Get a double parameter
|
553
|
+
inline double getDblParam(CbcDblParam key) const {
|
554
|
+
return dblParam_[key];
|
555
|
+
}
|
556
|
+
/*! \brief Set cutoff bound on the objective function.
|
557
|
+
|
558
|
+
When using strict comparison, the bound is adjusted by a tolerance to
|
559
|
+
avoid accidentally cutting off the optimal solution.
|
560
|
+
*/
|
561
|
+
void setCutoff(double value) ;
|
562
|
+
|
563
|
+
/// Get the cutoff bound on the objective function - always as minimize
|
564
|
+
inline double getCutoff() const { //double value ;
|
565
|
+
//solver_->getDblParam(OsiDualObjectiveLimit,value) ;
|
566
|
+
//assert( dblParam_[CbcCurrentCutoff]== value * solver_->getObjSense());
|
567
|
+
return dblParam_[CbcCurrentCutoff];
|
568
|
+
}
|
569
|
+
|
570
|
+
/// Set the \link CbcModel::CbcMaxNumNode maximum node limit \endlink
|
571
|
+
inline bool setMaximumNodes( int value) {
|
572
|
+
return setIntParam(CbcMaxNumNode, value);
|
573
|
+
}
|
574
|
+
|
575
|
+
/// Get the \link CbcModel::CbcMaxNumNode maximum node limit \endlink
|
576
|
+
inline int getMaximumNodes() const {
|
577
|
+
return getIntParam(CbcMaxNumNode);
|
578
|
+
}
|
579
|
+
|
580
|
+
/** Set the
|
581
|
+
\link CbcModel::CbcMaxNumSol maximum number of solutions \endlink
|
582
|
+
desired.
|
583
|
+
*/
|
584
|
+
inline bool setMaximumSolutions( int value) {
|
585
|
+
return setIntParam(CbcMaxNumSol, value);
|
586
|
+
}
|
587
|
+
/** Get the
|
588
|
+
\link CbcModel::CbcMaxNumSol maximum number of solutions \endlink
|
589
|
+
desired.
|
590
|
+
*/
|
591
|
+
inline int getMaximumSolutions() const {
|
592
|
+
return getIntParam(CbcMaxNumSol);
|
593
|
+
}
|
594
|
+
/// Set the printing mode
|
595
|
+
inline bool setPrintingMode( int value) {
|
596
|
+
return setIntParam(CbcPrinting, value);
|
597
|
+
}
|
598
|
+
|
599
|
+
/// Get the printing mode
|
600
|
+
inline int getPrintingMode() const {
|
601
|
+
return getIntParam(CbcPrinting);
|
602
|
+
}
|
603
|
+
|
604
|
+
/** Set the
|
605
|
+
\link CbcModel::CbcMaximumSeconds maximum number of seconds \endlink
|
606
|
+
desired.
|
607
|
+
*/
|
608
|
+
inline bool setMaximumSeconds( double value) {
|
609
|
+
return setDblParam(CbcMaximumSeconds, value);
|
610
|
+
}
|
611
|
+
/** Get the
|
612
|
+
\link CbcModel::CbcMaximumSeconds maximum number of seconds \endlink
|
613
|
+
desired.
|
614
|
+
*/
|
615
|
+
inline double getMaximumSeconds() const {
|
616
|
+
return getDblParam(CbcMaximumSeconds);
|
617
|
+
}
|
618
|
+
/// Current time since start of branchAndbound
|
619
|
+
double getCurrentSeconds() const ;
|
620
|
+
|
621
|
+
/// Return true if maximum time reached
|
622
|
+
bool maximumSecondsReached() const ;
|
623
|
+
|
624
|
+
/** Set the
|
625
|
+
\link CbcModel::CbcIntegerTolerance integrality tolerance \endlink
|
626
|
+
*/
|
627
|
+
inline bool setIntegerTolerance( double value) {
|
628
|
+
return setDblParam(CbcIntegerTolerance, value);
|
629
|
+
}
|
630
|
+
/** Get the
|
631
|
+
\link CbcModel::CbcIntegerTolerance integrality tolerance \endlink
|
632
|
+
*/
|
633
|
+
inline double getIntegerTolerance() const {
|
634
|
+
return getDblParam(CbcIntegerTolerance);
|
635
|
+
}
|
636
|
+
|
637
|
+
/** Set the
|
638
|
+
\link CbcModel::CbcInfeasibilityWeight
|
639
|
+
weight per integer infeasibility \endlink
|
640
|
+
*/
|
641
|
+
inline bool setInfeasibilityWeight( double value) {
|
642
|
+
return setDblParam(CbcInfeasibilityWeight, value);
|
643
|
+
}
|
644
|
+
/** Get the
|
645
|
+
\link CbcModel::CbcInfeasibilityWeight
|
646
|
+
weight per integer infeasibility \endlink
|
647
|
+
*/
|
648
|
+
inline double getInfeasibilityWeight() const {
|
649
|
+
return getDblParam(CbcInfeasibilityWeight);
|
650
|
+
}
|
651
|
+
|
652
|
+
/** Set the \link CbcModel::CbcAllowableGap allowable gap \endlink
|
653
|
+
between the best known solution and the best possible solution.
|
654
|
+
*/
|
655
|
+
inline bool setAllowableGap( double value) {
|
656
|
+
return setDblParam(CbcAllowableGap, value);
|
657
|
+
}
|
658
|
+
/** Get the \link CbcModel::CbcAllowableGap allowable gap \endlink
|
659
|
+
between the best known solution and the best possible solution.
|
660
|
+
*/
|
661
|
+
inline double getAllowableGap() const {
|
662
|
+
return getDblParam(CbcAllowableGap);
|
663
|
+
}
|
664
|
+
|
665
|
+
/** Set the \link CbcModel::CbcAllowableFractionGap fraction allowable gap \endlink
|
666
|
+
between the best known solution and the best possible solution.
|
667
|
+
*/
|
668
|
+
inline bool setAllowableFractionGap( double value) {
|
669
|
+
return setDblParam(CbcAllowableFractionGap, value);
|
670
|
+
}
|
671
|
+
/** Get the \link CbcModel::CbcAllowableFractionGap fraction allowable gap \endlink
|
672
|
+
between the best known solution and the best possible solution.
|
673
|
+
*/
|
674
|
+
inline double getAllowableFractionGap() const {
|
675
|
+
return getDblParam(CbcAllowableFractionGap);
|
676
|
+
}
|
677
|
+
/** Set the \link CbcModel::CbcAllowableFractionGap percentage allowable gap \endlink
|
678
|
+
between the best known solution and the best possible solution.
|
679
|
+
*/
|
680
|
+
inline bool setAllowablePercentageGap( double value) {
|
681
|
+
return setDblParam(CbcAllowableFractionGap, value*0.01);
|
682
|
+
}
|
683
|
+
/** Get the \link CbcModel::CbcAllowableFractionGap percentage allowable gap \endlink
|
684
|
+
between the best known solution and the best possible solution.
|
685
|
+
*/
|
686
|
+
inline double getAllowablePercentageGap() const {
|
687
|
+
return 100.0*getDblParam(CbcAllowableFractionGap);
|
688
|
+
}
|
689
|
+
/** Set the \link CbcModel::CbcHeuristicGap heuristic gap \endlink
|
690
|
+
between the best known solution and the best possible solution.
|
691
|
+
*/
|
692
|
+
inline bool setHeuristicGap( double value) {
|
693
|
+
return setDblParam(CbcHeuristicGap, value);
|
694
|
+
}
|
695
|
+
/** Get the \link CbcModel::CbcHeuristicGap heuristic gap \endlink
|
696
|
+
between the best known solution and the best possible solution.
|
697
|
+
*/
|
698
|
+
inline double getHeuristicGap() const {
|
699
|
+
return getDblParam(CbcHeuristicGap);
|
700
|
+
}
|
701
|
+
|
702
|
+
/** Set the \link CbcModel::CbcHeuristicFractionGap fraction heuristic gap \endlink
|
703
|
+
between the best known solution and the best possible solution.
|
704
|
+
*/
|
705
|
+
inline bool setHeuristicFractionGap( double value) {
|
706
|
+
return setDblParam(CbcHeuristicFractionGap, value);
|
707
|
+
}
|
708
|
+
/** Get the \link CbcModel::CbcHeuristicFractionGap fraction heuristic gap \endlink
|
709
|
+
between the best known solution and the best possible solution.
|
710
|
+
*/
|
711
|
+
inline double getHeuristicFractionGap() const {
|
712
|
+
return getDblParam(CbcHeuristicFractionGap);
|
713
|
+
}
|
714
|
+
/** Set the
|
715
|
+
\link CbcModel::CbcCutoffIncrement \endlink
|
716
|
+
desired.
|
717
|
+
*/
|
718
|
+
inline bool setCutoffIncrement( double value) {
|
719
|
+
return setDblParam(CbcCutoffIncrement, value);
|
720
|
+
}
|
721
|
+
/** Get the
|
722
|
+
\link CbcModel::CbcCutoffIncrement \endlink
|
723
|
+
desired.
|
724
|
+
*/
|
725
|
+
inline double getCutoffIncrement() const {
|
726
|
+
return getDblParam(CbcCutoffIncrement);
|
727
|
+
}
|
728
|
+
/// See if can stop on gap
|
729
|
+
bool canStopOnGap() const;
|
730
|
+
|
731
|
+
/** Pass in target solution and optional priorities.
|
732
|
+
If priorities then >0 means only branch if incorrect
|
733
|
+
while <0 means branch even if correct. +1 or -1 are
|
734
|
+
highest priority */
|
735
|
+
void setHotstartSolution(const double * solution, const int * priorities = NULL) ;
|
736
|
+
|
737
|
+
/// Set the minimum drop to continue cuts
|
738
|
+
inline void setMinimumDrop(double value) {
|
739
|
+
minimumDrop_ = value;
|
740
|
+
}
|
741
|
+
/// Get the minimum drop to continue cuts
|
742
|
+
inline double getMinimumDrop() const {
|
743
|
+
return minimumDrop_;
|
744
|
+
}
|
745
|
+
|
746
|
+
/** Set the maximum number of cut passes at root node (default 20)
|
747
|
+
Minimum drop can also be used for fine tuning */
|
748
|
+
inline void setMaximumCutPassesAtRoot(int value) {
|
749
|
+
maximumCutPassesAtRoot_ = value;
|
750
|
+
}
|
751
|
+
/** Get the maximum number of cut passes at root node */
|
752
|
+
inline int getMaximumCutPassesAtRoot() const {
|
753
|
+
return maximumCutPassesAtRoot_;
|
754
|
+
}
|
755
|
+
|
756
|
+
/** Set the maximum number of cut passes at other nodes (default 10)
|
757
|
+
Minimum drop can also be used for fine tuning */
|
758
|
+
inline void setMaximumCutPasses(int value) {
|
759
|
+
maximumCutPasses_ = value;
|
760
|
+
}
|
761
|
+
/** Get the maximum number of cut passes at other nodes (default 10) */
|
762
|
+
inline int getMaximumCutPasses() const {
|
763
|
+
return maximumCutPasses_;
|
764
|
+
}
|
765
|
+
/** Get current cut pass number in this round of cuts.
|
766
|
+
(1 is first pass) */
|
767
|
+
inline int getCurrentPassNumber() const {
|
768
|
+
return currentPassNumber_;
|
769
|
+
}
|
770
|
+
/** Set current cut pass number in this round of cuts.
|
771
|
+
(1 is first pass) */
|
772
|
+
inline void setCurrentPassNumber(int value) {
|
773
|
+
currentPassNumber_ = value;
|
774
|
+
}
|
775
|
+
|
776
|
+
/** Set the maximum number of candidates to be evaluated for strong
|
777
|
+
branching.
|
778
|
+
|
779
|
+
A value of 0 disables strong branching.
|
780
|
+
*/
|
781
|
+
void setNumberStrong(int number);
|
782
|
+
/** Get the maximum number of candidates to be evaluated for strong
|
783
|
+
branching.
|
784
|
+
*/
|
785
|
+
inline int numberStrong() const {
|
786
|
+
return numberStrong_;
|
787
|
+
}
|
788
|
+
/** Set global preferred way to branch
|
789
|
+
-1 down, +1 up, 0 no preference */
|
790
|
+
inline void setPreferredWay(int value) {
|
791
|
+
preferredWay_ = value;
|
792
|
+
}
|
793
|
+
/** Get the preferred way to branch (default 0) */
|
794
|
+
inline int getPreferredWay() const {
|
795
|
+
return preferredWay_;
|
796
|
+
}
|
797
|
+
/// Get at which depths to do cuts
|
798
|
+
inline int whenCuts() const {
|
799
|
+
return whenCuts_;
|
800
|
+
}
|
801
|
+
/// Set at which depths to do cuts
|
802
|
+
inline void setWhenCuts(int value) {
|
803
|
+
whenCuts_ = value;
|
804
|
+
}
|
805
|
+
/** Return true if we want to do cuts
|
806
|
+
If allowForTopOfTree zero then just does on multiples of depth
|
807
|
+
if 1 then allows for doing at top of tree
|
808
|
+
if 2 then says if cuts allowed anywhere apart from root
|
809
|
+
*/
|
810
|
+
bool doCutsNow(int allowForTopOfTree) const;
|
811
|
+
|
812
|
+
/** Set the number of branches before pseudo costs believed
|
813
|
+
in dynamic strong branching.
|
814
|
+
|
815
|
+
A value of 0 disables dynamic strong branching.
|
816
|
+
*/
|
817
|
+
void setNumberBeforeTrust(int number);
|
818
|
+
/** get the number of branches before pseudo costs believed
|
819
|
+
in dynamic strong branching. */
|
820
|
+
inline int numberBeforeTrust() const {
|
821
|
+
return numberBeforeTrust_;
|
822
|
+
}
|
823
|
+
/** Set the number of variables for which to compute penalties
|
824
|
+
in dynamic strong branching.
|
825
|
+
|
826
|
+
A value of 0 disables penalties.
|
827
|
+
*/
|
828
|
+
void setNumberPenalties(int number);
|
829
|
+
/** get the number of variables for which to compute penalties
|
830
|
+
in dynamic strong branching. */
|
831
|
+
inline int numberPenalties() const {
|
832
|
+
return numberPenalties_;
|
833
|
+
}
|
834
|
+
/// Pointer to top of tree
|
835
|
+
inline const CbcFullNodeInfo * topOfTree() const
|
836
|
+
{ return topOfTree_;}
|
837
|
+
/// Number of analyze iterations to do
|
838
|
+
inline void setNumberAnalyzeIterations(int number) {
|
839
|
+
numberAnalyzeIterations_ = number;
|
840
|
+
}
|
841
|
+
inline int numberAnalyzeIterations() const {
|
842
|
+
return numberAnalyzeIterations_;
|
843
|
+
}
|
844
|
+
/** Get scale factor to make penalties match strong.
|
845
|
+
Should/will be computed */
|
846
|
+
inline double penaltyScaleFactor() const {
|
847
|
+
return penaltyScaleFactor_;
|
848
|
+
}
|
849
|
+
/** Set scale factor to make penalties match strong.
|
850
|
+
Should/will be computed */
|
851
|
+
void setPenaltyScaleFactor(double value);
|
852
|
+
/** Problem type as set by user or found by analysis. This will be extended
|
853
|
+
0 - not known
|
854
|
+
1 - Set partitioning <=
|
855
|
+
2 - Set partitioning ==
|
856
|
+
3 - Set covering
|
857
|
+
4 - all +- 1 or all +1 and odd
|
858
|
+
*/
|
859
|
+
void inline setProblemType(int number) {
|
860
|
+
problemType_ = number;
|
861
|
+
}
|
862
|
+
inline int problemType() const {
|
863
|
+
return problemType_;
|
864
|
+
}
|
865
|
+
/// Current depth
|
866
|
+
inline int currentDepth() const {
|
867
|
+
return currentDepth_;
|
868
|
+
}
|
869
|
+
|
870
|
+
/// Set how often to scan global cuts
|
871
|
+
void setHowOftenGlobalScan(int number);
|
872
|
+
/// Get how often to scan global cuts
|
873
|
+
inline int howOftenGlobalScan() const {
|
874
|
+
return howOftenGlobalScan_;
|
875
|
+
}
|
876
|
+
/// Original columns as created by integerPresolve or preprocessing
|
877
|
+
inline int * originalColumns() const {
|
878
|
+
return originalColumns_;
|
879
|
+
}
|
880
|
+
/// Set original columns as created by preprocessing
|
881
|
+
void setOriginalColumns(const int * originalColumns,
|
882
|
+
int numberGood=COIN_INT_MAX) ;
|
883
|
+
/// Create conflict cut (well - most of)
|
884
|
+
OsiRowCut * conflictCut(const OsiSolverInterface * solver, bool & localCuts);
|
885
|
+
|
886
|
+
/** Set the print frequency.
|
887
|
+
|
888
|
+
Controls the number of nodes evaluated between status prints.
|
889
|
+
If <tt>number <=0</tt> the print frequency is set to 100 nodes for large
|
890
|
+
problems, 1000 for small problems.
|
891
|
+
Print frequency has very slight overhead if small.
|
892
|
+
*/
|
893
|
+
inline void setPrintFrequency(int number) {
|
894
|
+
printFrequency_ = number;
|
895
|
+
}
|
896
|
+
/// Get the print frequency
|
897
|
+
inline int printFrequency() const {
|
898
|
+
return printFrequency_;
|
899
|
+
}
|
900
|
+
//@}
|
901
|
+
|
902
|
+
//---------------------------------------------------------------------------
|
903
|
+
///@name Methods returning info on how the solution process terminated
|
904
|
+
//@{
|
905
|
+
/// Are there a numerical difficulties?
|
906
|
+
bool isAbandoned() const;
|
907
|
+
/// Is optimality proven?
|
908
|
+
bool isProvenOptimal() const;
|
909
|
+
/// Is infeasiblity proven (or none better than cutoff)?
|
910
|
+
bool isProvenInfeasible() const;
|
911
|
+
/// Was continuous solution unbounded
|
912
|
+
bool isContinuousUnbounded() const;
|
913
|
+
/// Was continuous solution unbounded
|
914
|
+
bool isProvenDualInfeasible() const;
|
915
|
+
/// Node limit reached?
|
916
|
+
bool isNodeLimitReached() const;
|
917
|
+
/// Time limit reached?
|
918
|
+
bool isSecondsLimitReached() const;
|
919
|
+
/// Solution limit reached?
|
920
|
+
bool isSolutionLimitReached() const;
|
921
|
+
/// Get how many iterations it took to solve the problem.
|
922
|
+
inline int getIterationCount() const {
|
923
|
+
return numberIterations_;
|
924
|
+
}
|
925
|
+
/// Increment how many iterations it took to solve the problem.
|
926
|
+
inline void incrementIterationCount(int value) {
|
927
|
+
numberIterations_ += value;
|
928
|
+
}
|
929
|
+
/// Get how many Nodes it took to solve the problem (including those in complete fathoming B&B inside CLP).
|
930
|
+
inline int getNodeCount() const {
|
931
|
+
return numberNodes_;
|
932
|
+
}
|
933
|
+
/// Increment how many nodes it took to solve the problem.
|
934
|
+
inline void incrementNodeCount(int value) {
|
935
|
+
numberNodes_ += value;
|
936
|
+
}
|
937
|
+
/// Get how many Nodes were enumerated in complete fathoming B&B inside CLP
|
938
|
+
inline int getExtraNodeCount() const {
|
939
|
+
return numberExtraNodes_;
|
940
|
+
}
|
941
|
+
/// Get how many times complete fathoming B&B was done
|
942
|
+
inline int getFathomCount() const {
|
943
|
+
return numberFathoms_;
|
944
|
+
}
|
945
|
+
/** Final status of problem
|
946
|
+
Some of these can be found out by is...... functions
|
947
|
+
-1 before branchAndBound
|
948
|
+
0 finished - check isProvenOptimal or isProvenInfeasible to see if solution found
|
949
|
+
(or check value of best solution)
|
950
|
+
1 stopped - on maxnodes, maxsols, maxtime
|
951
|
+
2 difficulties so run was abandoned
|
952
|
+
(5 event user programmed event occurred)
|
953
|
+
*/
|
954
|
+
inline int status() const {
|
955
|
+
return status_;
|
956
|
+
}
|
957
|
+
inline void setProblemStatus(int value) {
|
958
|
+
status_ = value;
|
959
|
+
}
|
960
|
+
/** Secondary status of problem
|
961
|
+
-1 unset (status_ will also be -1)
|
962
|
+
0 search completed with solution
|
963
|
+
1 linear relaxation not feasible (or worse than cutoff)
|
964
|
+
2 stopped on gap
|
965
|
+
3 stopped on nodes
|
966
|
+
4 stopped on time
|
967
|
+
5 stopped on user event
|
968
|
+
6 stopped on solutions
|
969
|
+
7 linear relaxation unbounded
|
970
|
+
8 stopped on iteration limit
|
971
|
+
*/
|
972
|
+
inline int secondaryStatus() const {
|
973
|
+
return secondaryStatus_;
|
974
|
+
}
|
975
|
+
inline void setSecondaryStatus(int value) {
|
976
|
+
secondaryStatus_ = value;
|
977
|
+
}
|
978
|
+
/// Are there numerical difficulties (for initialSolve) ?
|
979
|
+
bool isInitialSolveAbandoned() const ;
|
980
|
+
/// Is optimality proven (for initialSolve) ?
|
981
|
+
bool isInitialSolveProvenOptimal() const ;
|
982
|
+
/// Is primal infeasiblity proven (for initialSolve) ?
|
983
|
+
bool isInitialSolveProvenPrimalInfeasible() const ;
|
984
|
+
/// Is dual infeasiblity proven (for initialSolve) ?
|
985
|
+
bool isInitialSolveProvenDualInfeasible() const ;
|
986
|
+
|
987
|
+
//@}
|
988
|
+
|
989
|
+
//---------------------------------------------------------------------------
|
990
|
+
/**@name Problem information methods
|
991
|
+
|
992
|
+
These methods call the solver's query routines to return
|
993
|
+
information about the problem referred to by the current object.
|
994
|
+
Querying a problem that has no data associated with it result in
|
995
|
+
zeros for the number of rows and columns, and NULL pointers from
|
996
|
+
the methods that return vectors.
|
997
|
+
|
998
|
+
Const pointers returned from any data-query method are valid as
|
999
|
+
long as the data is unchanged and the solver is not called.
|
1000
|
+
*/
|
1001
|
+
//@{
|
1002
|
+
/// Number of rows in continuous (root) problem.
|
1003
|
+
inline int numberRowsAtContinuous() const {
|
1004
|
+
return numberRowsAtContinuous_;
|
1005
|
+
}
|
1006
|
+
|
1007
|
+
/// Get number of columns
|
1008
|
+
inline int getNumCols() const {
|
1009
|
+
return solver_->getNumCols();
|
1010
|
+
}
|
1011
|
+
|
1012
|
+
/// Get number of rows
|
1013
|
+
inline int getNumRows() const {
|
1014
|
+
return solver_->getNumRows();
|
1015
|
+
}
|
1016
|
+
|
1017
|
+
/// Get number of nonzero elements
|
1018
|
+
inline CoinBigIndex getNumElements() const {
|
1019
|
+
return solver_->getNumElements();
|
1020
|
+
}
|
1021
|
+
|
1022
|
+
/// Number of integers in problem
|
1023
|
+
inline int numberIntegers() const {
|
1024
|
+
return numberIntegers_;
|
1025
|
+
}
|
1026
|
+
// Integer variables
|
1027
|
+
inline const int * integerVariable() const {
|
1028
|
+
return integerVariable_;
|
1029
|
+
}
|
1030
|
+
/// Whether or not integer
|
1031
|
+
inline char integerType(int i) const {
|
1032
|
+
assert (integerInfo_);
|
1033
|
+
assert (integerInfo_[i] == 0 || integerInfo_[i] == 1);
|
1034
|
+
return integerInfo_[i];
|
1035
|
+
}
|
1036
|
+
/// Whether or not integer
|
1037
|
+
inline const char * integerType() const {
|
1038
|
+
return integerInfo_;
|
1039
|
+
}
|
1040
|
+
|
1041
|
+
/// Get pointer to array[getNumCols()] of column lower bounds
|
1042
|
+
inline const double * getColLower() const {
|
1043
|
+
return solver_->getColLower();
|
1044
|
+
}
|
1045
|
+
|
1046
|
+
/// Get pointer to array[getNumCols()] of column upper bounds
|
1047
|
+
inline const double * getColUpper() const {
|
1048
|
+
return solver_->getColUpper();
|
1049
|
+
}
|
1050
|
+
|
1051
|
+
/** Get pointer to array[getNumRows()] of row constraint senses.
|
1052
|
+
<ul>
|
1053
|
+
<li>'L': <= constraint
|
1054
|
+
<li>'E': = constraint
|
1055
|
+
<li>'G': >= constraint
|
1056
|
+
<li>'R': ranged constraint
|
1057
|
+
<li>'N': free constraint
|
1058
|
+
</ul>
|
1059
|
+
*/
|
1060
|
+
inline const char * getRowSense() const {
|
1061
|
+
return solver_->getRowSense();
|
1062
|
+
}
|
1063
|
+
|
1064
|
+
/** Get pointer to array[getNumRows()] of rows right-hand sides
|
1065
|
+
<ul>
|
1066
|
+
<li> if rowsense()[i] == 'L' then rhs()[i] == rowupper()[i]
|
1067
|
+
<li> if rowsense()[i] == 'G' then rhs()[i] == rowlower()[i]
|
1068
|
+
<li> if rowsense()[i] == 'R' then rhs()[i] == rowupper()[i]
|
1069
|
+
<li> if rowsense()[i] == 'N' then rhs()[i] == 0.0
|
1070
|
+
</ul>
|
1071
|
+
*/
|
1072
|
+
inline const double * getRightHandSide() const {
|
1073
|
+
return solver_->getRightHandSide();
|
1074
|
+
}
|
1075
|
+
|
1076
|
+
/** Get pointer to array[getNumRows()] of row ranges.
|
1077
|
+
<ul>
|
1078
|
+
<li> if rowsense()[i] == 'R' then
|
1079
|
+
rowrange()[i] == rowupper()[i] - rowlower()[i]
|
1080
|
+
<li> if rowsense()[i] != 'R' then
|
1081
|
+
rowrange()[i] is 0.0
|
1082
|
+
</ul>
|
1083
|
+
*/
|
1084
|
+
inline const double * getRowRange() const {
|
1085
|
+
return solver_->getRowRange();
|
1086
|
+
}
|
1087
|
+
|
1088
|
+
/// Get pointer to array[getNumRows()] of row lower bounds
|
1089
|
+
inline const double * getRowLower() const {
|
1090
|
+
return solver_->getRowLower();
|
1091
|
+
}
|
1092
|
+
|
1093
|
+
/// Get pointer to array[getNumRows()] of row upper bounds
|
1094
|
+
inline const double * getRowUpper() const {
|
1095
|
+
return solver_->getRowUpper();
|
1096
|
+
}
|
1097
|
+
|
1098
|
+
/// Get pointer to array[getNumCols()] of objective function coefficients
|
1099
|
+
inline const double * getObjCoefficients() const {
|
1100
|
+
return solver_->getObjCoefficients();
|
1101
|
+
}
|
1102
|
+
|
1103
|
+
/// Get objective function sense (1 for min (default), -1 for max)
|
1104
|
+
inline double getObjSense() const {
|
1105
|
+
//assert (dblParam_[CbcOptimizationDirection]== solver_->getObjSense());
|
1106
|
+
return dblParam_[CbcOptimizationDirection];
|
1107
|
+
}
|
1108
|
+
|
1109
|
+
/// Return true if variable is continuous
|
1110
|
+
inline bool isContinuous(int colIndex) const {
|
1111
|
+
return solver_->isContinuous(colIndex);
|
1112
|
+
}
|
1113
|
+
|
1114
|
+
/// Return true if variable is binary
|
1115
|
+
inline bool isBinary(int colIndex) const {
|
1116
|
+
return solver_->isBinary(colIndex);
|
1117
|
+
}
|
1118
|
+
|
1119
|
+
/** Return true if column is integer.
|
1120
|
+
Note: This function returns true if the the column
|
1121
|
+
is binary or a general integer.
|
1122
|
+
*/
|
1123
|
+
inline bool isInteger(int colIndex) const {
|
1124
|
+
return solver_->isInteger(colIndex);
|
1125
|
+
}
|
1126
|
+
|
1127
|
+
/// Return true if variable is general integer
|
1128
|
+
inline bool isIntegerNonBinary(int colIndex) const {
|
1129
|
+
return solver_->isIntegerNonBinary(colIndex);
|
1130
|
+
}
|
1131
|
+
|
1132
|
+
/// Return true if variable is binary and not fixed at either bound
|
1133
|
+
inline bool isFreeBinary(int colIndex) const {
|
1134
|
+
return solver_->isFreeBinary(colIndex) ;
|
1135
|
+
}
|
1136
|
+
|
1137
|
+
/// Get pointer to row-wise copy of matrix
|
1138
|
+
inline const CoinPackedMatrix * getMatrixByRow() const {
|
1139
|
+
return solver_->getMatrixByRow();
|
1140
|
+
}
|
1141
|
+
|
1142
|
+
/// Get pointer to column-wise copy of matrix
|
1143
|
+
inline const CoinPackedMatrix * getMatrixByCol() const {
|
1144
|
+
return solver_->getMatrixByCol();
|
1145
|
+
}
|
1146
|
+
|
1147
|
+
/// Get solver's value for infinity
|
1148
|
+
inline double getInfinity() const {
|
1149
|
+
return solver_->getInfinity();
|
1150
|
+
}
|
1151
|
+
/// Get pointer to array[getNumCols()] (for speed) of column lower bounds
|
1152
|
+
inline const double * getCbcColLower() const {
|
1153
|
+
return cbcColLower_;
|
1154
|
+
}
|
1155
|
+
/// Get pointer to array[getNumCols()] (for speed) of column upper bounds
|
1156
|
+
inline const double * getCbcColUpper() const {
|
1157
|
+
return cbcColUpper_;
|
1158
|
+
}
|
1159
|
+
/// Get pointer to array[getNumRows()] (for speed) of row lower bounds
|
1160
|
+
inline const double * getCbcRowLower() const {
|
1161
|
+
return cbcRowLower_;
|
1162
|
+
}
|
1163
|
+
/// Get pointer to array[getNumRows()] (for speed) of row upper bounds
|
1164
|
+
inline const double * getCbcRowUpper() const {
|
1165
|
+
return cbcRowUpper_;
|
1166
|
+
}
|
1167
|
+
/// Get pointer to array[getNumCols()] (for speed) of primal solution vector
|
1168
|
+
inline const double * getCbcColSolution() const {
|
1169
|
+
return cbcColSolution_;
|
1170
|
+
}
|
1171
|
+
/// Get pointer to array[getNumRows()] (for speed) of dual prices
|
1172
|
+
inline const double * getCbcRowPrice() const {
|
1173
|
+
return cbcRowPrice_;
|
1174
|
+
}
|
1175
|
+
/// Get a pointer to array[getNumCols()] (for speed) of reduced costs
|
1176
|
+
inline const double * getCbcReducedCost() const {
|
1177
|
+
return cbcReducedCost_;
|
1178
|
+
}
|
1179
|
+
/// Get pointer to array[getNumRows()] (for speed) of row activity levels.
|
1180
|
+
inline const double * getCbcRowActivity() const {
|
1181
|
+
return cbcRowActivity_;
|
1182
|
+
}
|
1183
|
+
//@}
|
1184
|
+
|
1185
|
+
|
1186
|
+
/**@name Methods related to querying the solution */
|
1187
|
+
//@{
|
1188
|
+
/// Holds solution at continuous (after cuts if branchAndBound called)
|
1189
|
+
inline double * continuousSolution() const {
|
1190
|
+
return continuousSolution_;
|
1191
|
+
}
|
1192
|
+
/** Array marked whenever a solution is found if non-zero.
|
1193
|
+
Code marks if heuristic returns better so heuristic
|
1194
|
+
need only mark if it wants to on solutions which
|
1195
|
+
are worse than current */
|
1196
|
+
inline int * usedInSolution() const {
|
1197
|
+
return usedInSolution_;
|
1198
|
+
}
|
1199
|
+
/// Increases usedInSolution for nonzeros
|
1200
|
+
void incrementUsed(const double * solution);
|
1201
|
+
/// Record a new incumbent solution and update objectiveValue
|
1202
|
+
void setBestSolution(CBC_Message how,
|
1203
|
+
double & objectiveValue, const double *solution,
|
1204
|
+
int fixVariables = 0);
|
1205
|
+
/// Just update objectiveValue
|
1206
|
+
void setBestObjectiveValue( double objectiveValue);
|
1207
|
+
/// Deals with event handler and solution
|
1208
|
+
CbcEventHandler::CbcAction dealWithEventHandler(CbcEventHandler::CbcEvent event,
|
1209
|
+
double objValue,
|
1210
|
+
const double * solution);
|
1211
|
+
|
1212
|
+
/** Call this to really test if a valid solution can be feasible
|
1213
|
+
Solution is number columns in size.
|
1214
|
+
If fixVariables true then bounds of continuous solver updated.
|
1215
|
+
Returns objective value (worse than cutoff if not feasible)
|
1216
|
+
Previously computed objective value is now passed in (in case user does not do solve)
|
1217
|
+
virtual so user can override
|
1218
|
+
*/
|
1219
|
+
virtual double checkSolution(double cutoff, double * solution,
|
1220
|
+
int fixVariables, double originalObjValue);
|
1221
|
+
/** Test the current solution for feasiblility.
|
1222
|
+
|
1223
|
+
Scan all objects for indications of infeasibility. This is broken down
|
1224
|
+
into simple integer infeasibility (\p numberIntegerInfeasibilities)
|
1225
|
+
and all other reports of infeasibility (\p numberObjectInfeasibilities).
|
1226
|
+
*/
|
1227
|
+
bool feasibleSolution(int & numberIntegerInfeasibilities,
|
1228
|
+
int & numberObjectInfeasibilities) const;
|
1229
|
+
|
1230
|
+
/** Solution to the most recent lp relaxation.
|
1231
|
+
|
1232
|
+
The solver's solution to the most recent lp relaxation.
|
1233
|
+
*/
|
1234
|
+
|
1235
|
+
inline double * currentSolution() const {
|
1236
|
+
return currentSolution_;
|
1237
|
+
}
|
1238
|
+
/** For testing infeasibilities - will point to
|
1239
|
+
currentSolution_ or solver-->getColSolution()
|
1240
|
+
*/
|
1241
|
+
inline const double * testSolution() const {
|
1242
|
+
return testSolution_;
|
1243
|
+
}
|
1244
|
+
inline void setTestSolution(const double * solution) {
|
1245
|
+
testSolution_ = solution;
|
1246
|
+
}
|
1247
|
+
/// Make sure region there and optionally copy solution
|
1248
|
+
void reserveCurrentSolution(const double * solution = NULL);
|
1249
|
+
|
1250
|
+
/// Get pointer to array[getNumCols()] of primal solution vector
|
1251
|
+
inline const double * getColSolution() const {
|
1252
|
+
return solver_->getColSolution();
|
1253
|
+
}
|
1254
|
+
|
1255
|
+
/// Get pointer to array[getNumRows()] of dual prices
|
1256
|
+
inline const double * getRowPrice() const {
|
1257
|
+
return solver_->getRowPrice();
|
1258
|
+
}
|
1259
|
+
|
1260
|
+
/// Get a pointer to array[getNumCols()] of reduced costs
|
1261
|
+
inline const double * getReducedCost() const {
|
1262
|
+
return solver_->getReducedCost();
|
1263
|
+
}
|
1264
|
+
|
1265
|
+
/// Get pointer to array[getNumRows()] of row activity levels.
|
1266
|
+
inline const double * getRowActivity() const {
|
1267
|
+
return solver_->getRowActivity();
|
1268
|
+
}
|
1269
|
+
|
1270
|
+
/// Get current objective function value
|
1271
|
+
inline double getCurrentObjValue() const {
|
1272
|
+
return dblParam_[CbcCurrentObjectiveValue];
|
1273
|
+
}
|
1274
|
+
/// Get current minimization objective function value
|
1275
|
+
inline double getCurrentMinimizationObjValue() const {
|
1276
|
+
return dblParam_[CbcCurrentMinimizationObjectiveValue];
|
1277
|
+
}
|
1278
|
+
|
1279
|
+
/// Get best objective function value as minimization
|
1280
|
+
inline double getMinimizationObjValue() const {
|
1281
|
+
return bestObjective_;
|
1282
|
+
}
|
1283
|
+
/// Set best objective function value as minimization
|
1284
|
+
inline void setMinimizationObjValue(double value) {
|
1285
|
+
bestObjective_ = value;
|
1286
|
+
}
|
1287
|
+
|
1288
|
+
/// Get best objective function value
|
1289
|
+
inline double getObjValue() const {
|
1290
|
+
return bestObjective_ * solver_->getObjSense() ;
|
1291
|
+
}
|
1292
|
+
/** Get best possible objective function value.
|
1293
|
+
This is better of best possible left on tree
|
1294
|
+
and best solution found.
|
1295
|
+
If called from within branch and cut may be optimistic.
|
1296
|
+
*/
|
1297
|
+
double getBestPossibleObjValue() const;
|
1298
|
+
/// Set best objective function value
|
1299
|
+
inline void setObjValue(double value) {
|
1300
|
+
bestObjective_ = value * solver_->getObjSense() ;
|
1301
|
+
}
|
1302
|
+
/// Get solver objective function value (as minimization)
|
1303
|
+
inline double getSolverObjValue() const {
|
1304
|
+
return solver_->getObjValue() * solver_->getObjSense() ;
|
1305
|
+
}
|
1306
|
+
|
1307
|
+
/** The best solution to the integer programming problem.
|
1308
|
+
|
1309
|
+
The best solution to the integer programming problem found during
|
1310
|
+
the search. If no solution is found, the method returns null.
|
1311
|
+
*/
|
1312
|
+
|
1313
|
+
inline double * bestSolution() const {
|
1314
|
+
return bestSolution_;
|
1315
|
+
}
|
1316
|
+
/** User callable setBestSolution.
|
1317
|
+
If check false does not check valid
|
1318
|
+
If true then sees if feasible and warns if objective value
|
1319
|
+
worse than given (so just set to COIN_DBL_MAX if you don't care).
|
1320
|
+
If check true then does not save solution if not feasible
|
1321
|
+
*/
|
1322
|
+
void setBestSolution(const double * solution, int numberColumns,
|
1323
|
+
double objectiveValue, bool check = false);
|
1324
|
+
|
1325
|
+
/// Get number of solutions
|
1326
|
+
inline int getSolutionCount() const {
|
1327
|
+
return numberSolutions_;
|
1328
|
+
}
|
1329
|
+
|
1330
|
+
/// Set number of solutions (so heuristics will be different)
|
1331
|
+
inline void setSolutionCount(int value) {
|
1332
|
+
numberSolutions_ = value;
|
1333
|
+
}
|
1334
|
+
/// Number of saved solutions (including best)
|
1335
|
+
int numberSavedSolutions() const;
|
1336
|
+
/// Maximum number of extra saved solutions
|
1337
|
+
inline int maximumSavedSolutions() const {
|
1338
|
+
return maximumSavedSolutions_;
|
1339
|
+
}
|
1340
|
+
/// Set maximum number of extra saved solutions
|
1341
|
+
void setMaximumSavedSolutions(int value);
|
1342
|
+
/// Return a saved solution (0==best) - NULL if off end
|
1343
|
+
const double * savedSolution(int which) const;
|
1344
|
+
/// Return a saved solution objective (0==best) - COIN_DBL_MAX if off end
|
1345
|
+
double savedSolutionObjective(int which) const;
|
1346
|
+
/// Delete a saved solution and move others up
|
1347
|
+
void deleteSavedSolution(int which);
|
1348
|
+
|
1349
|
+
/** Current phase (so heuristics etc etc can find out).
|
1350
|
+
0 - initial solve
|
1351
|
+
1 - solve with cuts at root
|
1352
|
+
2 - solve with cuts
|
1353
|
+
3 - other e.g. strong branching
|
1354
|
+
4 - trying to validate a solution
|
1355
|
+
5 - at end of search
|
1356
|
+
*/
|
1357
|
+
inline int phase() const {
|
1358
|
+
return phase_;
|
1359
|
+
}
|
1360
|
+
|
1361
|
+
/// Get number of heuristic solutions
|
1362
|
+
inline int getNumberHeuristicSolutions() const {
|
1363
|
+
return numberHeuristicSolutions_;
|
1364
|
+
}
|
1365
|
+
/// Set number of heuristic solutions
|
1366
|
+
inline void setNumberHeuristicSolutions(int value) {
|
1367
|
+
numberHeuristicSolutions_ = value;
|
1368
|
+
}
|
1369
|
+
|
1370
|
+
/// Set objective function sense (1 for min (default), -1 for max,)
|
1371
|
+
inline void setObjSense(double s) {
|
1372
|
+
dblParam_[CbcOptimizationDirection] = s;
|
1373
|
+
solver_->setObjSense(s);
|
1374
|
+
}
|
1375
|
+
|
1376
|
+
/// Value of objective at continuous
|
1377
|
+
inline double getContinuousObjective() const {
|
1378
|
+
return originalContinuousObjective_;
|
1379
|
+
}
|
1380
|
+
inline void setContinuousObjective(double value) {
|
1381
|
+
originalContinuousObjective_ = value;
|
1382
|
+
}
|
1383
|
+
/// Number of infeasibilities at continuous
|
1384
|
+
inline int getContinuousInfeasibilities() const {
|
1385
|
+
return continuousInfeasibilities_;
|
1386
|
+
}
|
1387
|
+
inline void setContinuousInfeasibilities(int value) {
|
1388
|
+
continuousInfeasibilities_ = value;
|
1389
|
+
}
|
1390
|
+
/// Value of objective after root node cuts added
|
1391
|
+
inline double rootObjectiveAfterCuts() const {
|
1392
|
+
return continuousObjective_;
|
1393
|
+
}
|
1394
|
+
/// Sum of Changes to objective by first solve
|
1395
|
+
inline double sumChangeObjective() const {
|
1396
|
+
return sumChangeObjective1_;
|
1397
|
+
}
|
1398
|
+
/** Number of times global cuts violated. When global cut pool then this
|
1399
|
+
should be kept for each cut and type of cut */
|
1400
|
+
inline int numberGlobalViolations() const {
|
1401
|
+
return numberGlobalViolations_;
|
1402
|
+
}
|
1403
|
+
inline void clearNumberGlobalViolations() {
|
1404
|
+
numberGlobalViolations_ = 0;
|
1405
|
+
}
|
1406
|
+
/// Whether to force a resolve after takeOffCuts
|
1407
|
+
inline bool resolveAfterTakeOffCuts() const {
|
1408
|
+
return resolveAfterTakeOffCuts_;
|
1409
|
+
}
|
1410
|
+
inline void setResolveAfterTakeOffCuts(bool yesNo) {
|
1411
|
+
resolveAfterTakeOffCuts_ = yesNo;
|
1412
|
+
}
|
1413
|
+
/// Maximum number of rows
|
1414
|
+
inline int maximumRows() const {
|
1415
|
+
return maximumRows_;
|
1416
|
+
}
|
1417
|
+
/// Work basis for temporary use
|
1418
|
+
inline CoinWarmStartBasis & workingBasis() {
|
1419
|
+
return workingBasis_;
|
1420
|
+
}
|
1421
|
+
/// Get number of "iterations" to stop after
|
1422
|
+
inline int getStopNumberIterations() const {
|
1423
|
+
return stopNumberIterations_;
|
1424
|
+
}
|
1425
|
+
/// Set number of "iterations" to stop after
|
1426
|
+
inline void setStopNumberIterations(int value) {
|
1427
|
+
stopNumberIterations_ = value;
|
1428
|
+
}
|
1429
|
+
/// A pointer to model from CbcHeuristic
|
1430
|
+
inline CbcModel * heuristicModel() const
|
1431
|
+
{ return heuristicModel_;}
|
1432
|
+
/// Set a pointer to model from CbcHeuristic
|
1433
|
+
inline void setHeuristicModel(CbcModel * model)
|
1434
|
+
{ heuristicModel_ = model;}
|
1435
|
+
//@}
|
1436
|
+
|
1437
|
+
/** \name Node selection */
|
1438
|
+
//@{
|
1439
|
+
// Comparison functions (which may be overridden by inheritance)
|
1440
|
+
inline CbcCompareBase * nodeComparison() const {
|
1441
|
+
return nodeCompare_;
|
1442
|
+
}
|
1443
|
+
void setNodeComparison(CbcCompareBase * compare);
|
1444
|
+
void setNodeComparison(CbcCompareBase & compare);
|
1445
|
+
//@}
|
1446
|
+
|
1447
|
+
/** \name Problem feasibility checking */
|
1448
|
+
//@{
|
1449
|
+
// Feasibility functions (which may be overridden by inheritance)
|
1450
|
+
inline CbcFeasibilityBase * problemFeasibility() const {
|
1451
|
+
return problemFeasibility_;
|
1452
|
+
}
|
1453
|
+
void setProblemFeasibility(CbcFeasibilityBase * feasibility);
|
1454
|
+
void setProblemFeasibility(CbcFeasibilityBase & feasibility);
|
1455
|
+
//@}
|
1456
|
+
|
1457
|
+
/** \name Tree methods and subtree methods */
|
1458
|
+
//@{
|
1459
|
+
/// Tree method e.g. heap (which may be overridden by inheritance)
|
1460
|
+
inline CbcTree * tree() const {
|
1461
|
+
return tree_;
|
1462
|
+
}
|
1463
|
+
/// For modifying tree handling (original is cloned)
|
1464
|
+
void passInTreeHandler(CbcTree & tree);
|
1465
|
+
/** For passing in an CbcModel to do a sub Tree (with derived tree handlers).
|
1466
|
+
Passed in model must exist for duration of branch and bound
|
1467
|
+
*/
|
1468
|
+
void passInSubTreeModel(CbcModel & model);
|
1469
|
+
/** For retrieving a copy of subtree model with given OsiSolver.
|
1470
|
+
If no subtree model will use self (up to user to reset cutoff etc).
|
1471
|
+
If solver NULL uses current
|
1472
|
+
*/
|
1473
|
+
CbcModel * subTreeModel(OsiSolverInterface * solver = NULL) const;
|
1474
|
+
/// Returns number of times any subtree stopped on nodes, time etc
|
1475
|
+
inline int numberStoppedSubTrees() const {
|
1476
|
+
return numberStoppedSubTrees_;
|
1477
|
+
}
|
1478
|
+
/// Says a sub tree was stopped
|
1479
|
+
inline void incrementSubTreeStopped() {
|
1480
|
+
numberStoppedSubTrees_++;
|
1481
|
+
}
|
1482
|
+
/** Whether to automatically do presolve before branch and bound (subTrees).
|
1483
|
+
0 - no
|
1484
|
+
1 - ordinary presolve
|
1485
|
+
2 - integer presolve (dodgy)
|
1486
|
+
*/
|
1487
|
+
inline int typePresolve() const {
|
1488
|
+
return presolve_;
|
1489
|
+
}
|
1490
|
+
inline void setTypePresolve(int value) {
|
1491
|
+
presolve_ = value;
|
1492
|
+
}
|
1493
|
+
|
1494
|
+
//@}
|
1495
|
+
|
1496
|
+
/** \name Branching Decisions
|
1497
|
+
|
1498
|
+
See the CbcBranchDecision class for additional information.
|
1499
|
+
*/
|
1500
|
+
//@{
|
1501
|
+
|
1502
|
+
/// Get the current branching decision method.
|
1503
|
+
inline CbcBranchDecision * branchingMethod() const {
|
1504
|
+
return branchingMethod_;
|
1505
|
+
}
|
1506
|
+
/// Set the branching decision method.
|
1507
|
+
inline void setBranchingMethod(CbcBranchDecision * method) {
|
1508
|
+
delete branchingMethod_;
|
1509
|
+
branchingMethod_ = method->clone();
|
1510
|
+
}
|
1511
|
+
/** Set the branching method
|
1512
|
+
|
1513
|
+
\overload
|
1514
|
+
*/
|
1515
|
+
inline void setBranchingMethod(CbcBranchDecision & method) {
|
1516
|
+
delete branchingMethod_;
|
1517
|
+
branchingMethod_ = method.clone();
|
1518
|
+
}
|
1519
|
+
/// Get the current cut modifier method
|
1520
|
+
inline CbcCutModifier * cutModifier() const {
|
1521
|
+
return cutModifier_;
|
1522
|
+
}
|
1523
|
+
/// Set the cut modifier method
|
1524
|
+
void setCutModifier(CbcCutModifier * modifier);
|
1525
|
+
/** Set the cut modifier method
|
1526
|
+
|
1527
|
+
\overload
|
1528
|
+
*/
|
1529
|
+
void setCutModifier(CbcCutModifier & modifier);
|
1530
|
+
//@}
|
1531
|
+
|
1532
|
+
/** \name Row (constraint) and Column (variable) cut generation */
|
1533
|
+
//@{
|
1534
|
+
|
1535
|
+
/** State of search
|
1536
|
+
0 - no solution
|
1537
|
+
1 - only heuristic solutions
|
1538
|
+
2 - branched to a solution
|
1539
|
+
3 - no solution but many nodes
|
1540
|
+
*/
|
1541
|
+
inline int stateOfSearch() const {
|
1542
|
+
return stateOfSearch_;
|
1543
|
+
}
|
1544
|
+
inline void setStateOfSearch(int state) {
|
1545
|
+
stateOfSearch_ = state;
|
1546
|
+
}
|
1547
|
+
/// Strategy worked out - mainly at root node for use by CbcNode
|
1548
|
+
inline int searchStrategy() const {
|
1549
|
+
return searchStrategy_;
|
1550
|
+
}
|
1551
|
+
/// Set strategy worked out - mainly at root node for use by CbcNode
|
1552
|
+
inline void setSearchStrategy(int value) {
|
1553
|
+
searchStrategy_ = value;
|
1554
|
+
}
|
1555
|
+
/// Stong branching strategy
|
1556
|
+
inline int strongStrategy() const {
|
1557
|
+
return strongStrategy_;
|
1558
|
+
}
|
1559
|
+
/// Set strong branching strategy
|
1560
|
+
inline void setStrongStrategy(int value) {
|
1561
|
+
strongStrategy_ = value;
|
1562
|
+
}
|
1563
|
+
|
1564
|
+
/// Get the number of cut generators
|
1565
|
+
inline int numberCutGenerators() const {
|
1566
|
+
return numberCutGenerators_;
|
1567
|
+
}
|
1568
|
+
/// Get the list of cut generators
|
1569
|
+
inline CbcCutGenerator ** cutGenerators() const {
|
1570
|
+
return generator_;
|
1571
|
+
}
|
1572
|
+
///Get the specified cut generator
|
1573
|
+
inline CbcCutGenerator * cutGenerator(int i) const {
|
1574
|
+
return generator_[i];
|
1575
|
+
}
|
1576
|
+
///Get the specified cut generator before any changes
|
1577
|
+
inline CbcCutGenerator * virginCutGenerator(int i) const {
|
1578
|
+
return virginGenerator_[i];
|
1579
|
+
}
|
1580
|
+
/** Add one generator - up to user to delete generators.
|
1581
|
+
howoften affects how generator is used. 0 or 1 means always,
|
1582
|
+
>1 means every that number of nodes. Negative values have same
|
1583
|
+
meaning as positive but they may be switched off (-> -100) by code if
|
1584
|
+
not many cuts generated at continuous. -99 is just done at root.
|
1585
|
+
Name is just for printout.
|
1586
|
+
If depth >0 overrides how often generator is called (if howOften==-1 or >0).
|
1587
|
+
*/
|
1588
|
+
void addCutGenerator(CglCutGenerator * generator,
|
1589
|
+
int howOften = 1, const char * name = NULL,
|
1590
|
+
bool normal = true, bool atSolution = false,
|
1591
|
+
bool infeasible = false, int howOftenInSub = -100,
|
1592
|
+
int whatDepth = -1, int whatDepthInSub = -1);
|
1593
|
+
//@}
|
1594
|
+
/** \name Strategy and sub models
|
1595
|
+
|
1596
|
+
See the CbcStrategy class for additional information.
|
1597
|
+
*/
|
1598
|
+
//@{
|
1599
|
+
|
1600
|
+
/// Get the current strategy
|
1601
|
+
inline CbcStrategy * strategy() const {
|
1602
|
+
return strategy_;
|
1603
|
+
}
|
1604
|
+
/// Set the strategy. Clones
|
1605
|
+
void setStrategy(CbcStrategy & strategy);
|
1606
|
+
/// Set the strategy. assigns
|
1607
|
+
inline void setStrategy(CbcStrategy * strategy) {
|
1608
|
+
strategy_ = strategy;
|
1609
|
+
}
|
1610
|
+
/// Get the current parent model
|
1611
|
+
inline CbcModel * parentModel() const {
|
1612
|
+
return parentModel_;
|
1613
|
+
}
|
1614
|
+
/// Set the parent model
|
1615
|
+
inline void setParentModel(CbcModel & parentModel) {
|
1616
|
+
parentModel_ = &parentModel;
|
1617
|
+
}
|
1618
|
+
//@}
|
1619
|
+
|
1620
|
+
|
1621
|
+
/** \name Heuristics and priorities */
|
1622
|
+
//@{
|
1623
|
+
/*! \brief Add one heuristic - up to user to delete
|
1624
|
+
|
1625
|
+
The name is just used for print messages.
|
1626
|
+
*/
|
1627
|
+
void addHeuristic(CbcHeuristic * generator, const char *name = NULL,
|
1628
|
+
int before = -1);
|
1629
|
+
///Get the specified heuristic
|
1630
|
+
inline CbcHeuristic * heuristic(int i) const {
|
1631
|
+
return heuristic_[i];
|
1632
|
+
}
|
1633
|
+
/// Get the number of heuristics
|
1634
|
+
inline int numberHeuristics() const {
|
1635
|
+
return numberHeuristics_;
|
1636
|
+
}
|
1637
|
+
/// Set the number of heuristics
|
1638
|
+
inline void setNumberHeuristics(int value) {
|
1639
|
+
numberHeuristics_ = value;
|
1640
|
+
}
|
1641
|
+
/// Pointer to heuristic solver which found last solution (or NULL)
|
1642
|
+
inline CbcHeuristic * lastHeuristic() const {
|
1643
|
+
return lastHeuristic_;
|
1644
|
+
}
|
1645
|
+
/// set last heuristic which found a solution
|
1646
|
+
inline void setLastHeuristic(CbcHeuristic * last) {
|
1647
|
+
lastHeuristic_ = last;
|
1648
|
+
}
|
1649
|
+
|
1650
|
+
/** Pass in branching priorities.
|
1651
|
+
|
1652
|
+
If ifClique then priorities are on cliques otherwise priorities are
|
1653
|
+
on integer variables.
|
1654
|
+
Other type (if exists set to default)
|
1655
|
+
1 is highest priority. (well actually -INT_MAX is but that's ugly)
|
1656
|
+
If hotstart > 0 then branches are created to force
|
1657
|
+
the variable to the value given by best solution. This enables a
|
1658
|
+
sort of hot start. The node choice should be greatest depth
|
1659
|
+
and hotstart should normally be switched off after a solution.
|
1660
|
+
|
1661
|
+
If ifNotSimpleIntegers true then appended to normal integers
|
1662
|
+
|
1663
|
+
This is now deprecated except for simple usage. If user
|
1664
|
+
creates Cbcobjects then set priority in them
|
1665
|
+
|
1666
|
+
\internal Added for Kurt Spielberg.
|
1667
|
+
*/
|
1668
|
+
void passInPriorities(const int * priorities, bool ifNotSimpleIntegers);
|
1669
|
+
|
1670
|
+
/// Returns priority level for an object (or 1000 if no priorities exist)
|
1671
|
+
inline int priority(int sequence) const {
|
1672
|
+
return object_[sequence]->priority();
|
1673
|
+
}
|
1674
|
+
|
1675
|
+
/*! \brief Set an event handler
|
1676
|
+
|
1677
|
+
A clone of the handler passed as a parameter is stored in CbcModel.
|
1678
|
+
*/
|
1679
|
+
void passInEventHandler(const CbcEventHandler *eventHandler) ;
|
1680
|
+
|
1681
|
+
/*! \brief Retrieve a pointer to the event handler */
|
1682
|
+
inline CbcEventHandler* getEventHandler() const {
|
1683
|
+
return (eventHandler_) ;
|
1684
|
+
}
|
1685
|
+
|
1686
|
+
//@}
|
1687
|
+
|
1688
|
+
/**@name Setting/Accessing application data */
|
1689
|
+
//@{
|
1690
|
+
/** Set application data.
|
1691
|
+
|
1692
|
+
This is a pointer that the application can store into and
|
1693
|
+
retrieve from the solver interface.
|
1694
|
+
This field is available for the application to optionally
|
1695
|
+
define and use.
|
1696
|
+
*/
|
1697
|
+
void setApplicationData (void * appData);
|
1698
|
+
|
1699
|
+
/// Get application data
|
1700
|
+
void * getApplicationData() const;
|
1701
|
+
/**
|
1702
|
+
For advanced applications you may wish to modify the behavior of Cbc
|
1703
|
+
e.g. if the solver is a NLP solver then you may not have an exact
|
1704
|
+
optimum solution at each step. Information could be built into
|
1705
|
+
OsiSolverInterface but this is an alternative so that that interface
|
1706
|
+
does not have to be changed. If something similar is useful to
|
1707
|
+
enough solvers then it could be migrated
|
1708
|
+
You can also pass in by using solver->setAuxiliaryInfo.
|
1709
|
+
You should do that if solver is odd - if solver is normal simplex
|
1710
|
+
then use this.
|
1711
|
+
NOTE - characteristics are not cloned
|
1712
|
+
*/
|
1713
|
+
void passInSolverCharacteristics(OsiBabSolver * solverCharacteristics);
|
1714
|
+
/// Get solver characteristics
|
1715
|
+
inline const OsiBabSolver * solverCharacteristics() const {
|
1716
|
+
return solverCharacteristics_;
|
1717
|
+
}
|
1718
|
+
//@}
|
1719
|
+
|
1720
|
+
//---------------------------------------------------------------------------
|
1721
|
+
|
1722
|
+
/**@name Message handling etc */
|
1723
|
+
//@{
|
1724
|
+
/// Pass in Message handler (not deleted at end)
|
1725
|
+
void passInMessageHandler(CoinMessageHandler * handler);
|
1726
|
+
/// Set language
|
1727
|
+
void newLanguage(CoinMessages::Language language);
|
1728
|
+
inline void setLanguage(CoinMessages::Language language) {
|
1729
|
+
newLanguage(language);
|
1730
|
+
}
|
1731
|
+
/// Return handler
|
1732
|
+
inline CoinMessageHandler * messageHandler() const {
|
1733
|
+
return handler_;
|
1734
|
+
}
|
1735
|
+
/// Return messages
|
1736
|
+
inline CoinMessages & messages() {
|
1737
|
+
return messages_;
|
1738
|
+
}
|
1739
|
+
/// Return pointer to messages
|
1740
|
+
inline CoinMessages * messagesPointer() {
|
1741
|
+
return &messages_;
|
1742
|
+
}
|
1743
|
+
/// Set log level
|
1744
|
+
void setLogLevel(int value);
|
1745
|
+
/// Get log level
|
1746
|
+
inline int logLevel() const {
|
1747
|
+
return handler_->logLevel();
|
1748
|
+
}
|
1749
|
+
/** Set flag to say if handler_ is the default handler.
|
1750
|
+
|
1751
|
+
The default handler is deleted when the model is deleted. Other
|
1752
|
+
handlers (supplied by the client) will not be deleted.
|
1753
|
+
*/
|
1754
|
+
inline void setDefaultHandler(bool yesNo) {
|
1755
|
+
defaultHandler_ = yesNo;
|
1756
|
+
}
|
1757
|
+
/// Check default handler
|
1758
|
+
inline bool defaultHandler() const {
|
1759
|
+
return defaultHandler_;
|
1760
|
+
}
|
1761
|
+
//@}
|
1762
|
+
//---------------------------------------------------------------------------
|
1763
|
+
///@name Specialized
|
1764
|
+
//@{
|
1765
|
+
|
1766
|
+
/**
|
1767
|
+
Set special options
|
1768
|
+
0 bit (1) - check if cuts valid (if on debugger list)
|
1769
|
+
1 bit (2) - use current basis to check integer solution (rather than all slack)
|
1770
|
+
2 bit (4) - don't check integer solution (by solving LP)
|
1771
|
+
3 bit (8) - fast analyze
|
1772
|
+
4 bit (16) - non-linear model - so no well defined CoinPackedMatrix
|
1773
|
+
5 bit (32) - keep names
|
1774
|
+
6 bit (64) - try for dominated columns
|
1775
|
+
7 bit (128) - SOS type 1 but all declared integer
|
1776
|
+
8 bit (256) - Set to say solution just found, unset by doing cuts
|
1777
|
+
9 bit (512) - Try reduced model after 100 nodes
|
1778
|
+
10 bit (1024) - Switch on some heuristics even if seems unlikely
|
1779
|
+
11 bit (2048) - Mark as in small branch and bound
|
1780
|
+
12 bit (4096) - Funny cuts so do slow way (in some places)
|
1781
|
+
13 bit (8192) - Funny cuts so do slow way (in other places)
|
1782
|
+
14 bit (16384) - Use Cplex! for fathoming
|
1783
|
+
15 bit (32768) - Try reduced model after 0 nodes
|
1784
|
+
16 bit (65536) - Original model had integer bounds
|
1785
|
+
17 bit (131072) - Perturbation switched off
|
1786
|
+
18 bit (262144) - donor CbcModel
|
1787
|
+
19 bit (524288) - recipient CbcModel
|
1788
|
+
20 bit (1048576) - waiting for sub model to return
|
1789
|
+
22 bit (4194304) - do not initialize random seed in solver (user has)
|
1790
|
+
23 bit (8388608) - leave solver_ with cuts
|
1791
|
+
24 bit (16777216) - just get feasible if no cutoff
|
1792
|
+
*/
|
1793
|
+
inline void setSpecialOptions(int value) {
|
1794
|
+
specialOptions_ = value;
|
1795
|
+
}
|
1796
|
+
/// Get special options
|
1797
|
+
inline int specialOptions() const {
|
1798
|
+
return specialOptions_;
|
1799
|
+
}
|
1800
|
+
/// Set random seed
|
1801
|
+
inline void setRandomSeed(int value) {
|
1802
|
+
randomSeed_ = value;
|
1803
|
+
}
|
1804
|
+
/// Get random seed
|
1805
|
+
inline int getRandomSeed() const {
|
1806
|
+
return randomSeed_;
|
1807
|
+
}
|
1808
|
+
/// Set multiple root tries
|
1809
|
+
inline void setMultipleRootTries(int value) {
|
1810
|
+
multipleRootTries_ = value;
|
1811
|
+
}
|
1812
|
+
/// Get multiple root tries
|
1813
|
+
inline int getMultipleRootTries() const {
|
1814
|
+
return multipleRootTries_;
|
1815
|
+
}
|
1816
|
+
/// Tell model to stop on event
|
1817
|
+
inline void sayEventHappened()
|
1818
|
+
{ eventHappened_=true;}
|
1819
|
+
/// Says if normal solver i.e. has well defined CoinPackedMatrix
|
1820
|
+
inline bool normalSolver() const {
|
1821
|
+
return (specialOptions_&16) == 0;
|
1822
|
+
}
|
1823
|
+
/** Says if model is sitting there waiting for mini branch and bound to finish
|
1824
|
+
This is because an event handler may only have access to parent model in
|
1825
|
+
mini branch and bound
|
1826
|
+
*/
|
1827
|
+
inline bool waitingForMiniBranchAndBound() const {
|
1828
|
+
return (specialOptions_&1048576) != 0;
|
1829
|
+
}
|
1830
|
+
/** Set more special options
|
1831
|
+
at present bottom 6 bits used for shadow price mode
|
1832
|
+
1024 for experimental hotstart
|
1833
|
+
2048,4096 breaking out of cuts
|
1834
|
+
8192 slowly increase minimum drop
|
1835
|
+
16384 gomory
|
1836
|
+
32768 more heuristics in sub trees
|
1837
|
+
65536 no cuts in preprocessing
|
1838
|
+
131072 Time limits elapsed
|
1839
|
+
18 bit (262144) - Perturb fathom nodes
|
1840
|
+
19 bit (524288) - No limit on fathom nodes
|
1841
|
+
20 bit (1048576) - Reduce sum of infeasibilities before cuts
|
1842
|
+
21 bit (2097152) - Reduce sum of infeasibilities after cuts
|
1843
|
+
22 bit (4194304) - Conflict analysis
|
1844
|
+
23 bit (8388608) - Conflict analysis - temporary bit
|
1845
|
+
24 bit (16777216) - Add cutoff as LP constraint (out)
|
1846
|
+
25 bit (33554432) - diving/reordering
|
1847
|
+
26 bit (67108864) - load global cuts from file
|
1848
|
+
27 bit (134217728) - append binding global cuts to file
|
1849
|
+
28 bit (268435456) - idiot branching
|
1850
|
+
29 bit (536870912) - don't make fake objective
|
1851
|
+
30 bit (1073741824) - Funny SOS or similar - be careful
|
1852
|
+
*/
|
1853
|
+
inline void setMoreSpecialOptions(int value) {
|
1854
|
+
moreSpecialOptions_ = value;
|
1855
|
+
}
|
1856
|
+
/// Get more special options
|
1857
|
+
inline int moreSpecialOptions() const {
|
1858
|
+
return moreSpecialOptions_;
|
1859
|
+
}
|
1860
|
+
/** Set more more special options
|
1861
|
+
0 bit (1) - find switching variables
|
1862
|
+
1 bit (2) - using fake objective until solution
|
1863
|
+
2 bit (4) - switching variables exist
|
1864
|
+
3 bit (8) - skip most of setBestSolution checks
|
1865
|
+
4 bit (16) - very lightweight preprocessing in smallB&B
|
1866
|
+
5 bit (32) - event handler needs to be cloned when parallel
|
1867
|
+
6 bit (64) - testing - use probing to make cliques
|
1868
|
+
7/8 bit (128) - try orbital branching (if nauty)
|
1869
|
+
9 bit (512) - branching on objective (later)
|
1870
|
+
10 bit (1024) - branching on constraints (later)
|
1871
|
+
11/12 bit 2048 - intermittent cuts
|
1872
|
+
13/14 bit 8192 - go to bitter end in strong branching (first time)
|
1873
|
+
*/
|
1874
|
+
inline void setMoreSpecialOptions2(int value) {
|
1875
|
+
moreSpecialOptions2_ = value;
|
1876
|
+
}
|
1877
|
+
/// Get more special options2
|
1878
|
+
inline int moreSpecialOptions2() const {
|
1879
|
+
return moreSpecialOptions2_;
|
1880
|
+
}
|
1881
|
+
/// Set cutoff as constraint
|
1882
|
+
inline void setCutoffAsConstraint(bool yesNo) {
|
1883
|
+
cutoffRowNumber_ = (yesNo) ? -2 : -1;
|
1884
|
+
}
|
1885
|
+
/// Set time method
|
1886
|
+
inline void setUseElapsedTime(bool yesNo) {
|
1887
|
+
if (yesNo)
|
1888
|
+
moreSpecialOptions_ |= 131072;
|
1889
|
+
else
|
1890
|
+
moreSpecialOptions_ &= ~131072;
|
1891
|
+
}
|
1892
|
+
/// Get time method
|
1893
|
+
inline bool useElapsedTime() const {
|
1894
|
+
return (moreSpecialOptions_&131072)!=0;
|
1895
|
+
}
|
1896
|
+
/// Get useful temporary pointer
|
1897
|
+
inline void * temporaryPointer() const
|
1898
|
+
{ return temporaryPointer_;}
|
1899
|
+
/// Set useful temporary pointer
|
1900
|
+
inline void setTemporaryPointer(void * pointer)
|
1901
|
+
{ temporaryPointer_=pointer;}
|
1902
|
+
/// Go to dantzig pivot selection if easy problem (clp only)
|
1903
|
+
void goToDantzig(int numberNodes, ClpDualRowPivot *& savePivotMethod);
|
1904
|
+
/// Now we may not own objects - just point to solver's objects
|
1905
|
+
inline bool ownObjects() const {
|
1906
|
+
return ownObjects_;
|
1907
|
+
}
|
1908
|
+
/// Check original model before it gets messed up
|
1909
|
+
void checkModel();
|
1910
|
+
//@}
|
1911
|
+
//---------------------------------------------------------------------------
|
1912
|
+
|
1913
|
+
///@name Constructors and destructors etc
|
1914
|
+
//@{
|
1915
|
+
/// Default Constructor
|
1916
|
+
CbcModel();
|
1917
|
+
|
1918
|
+
/// Constructor from solver
|
1919
|
+
CbcModel(const OsiSolverInterface &);
|
1920
|
+
|
1921
|
+
/** Assign a solver to the model (model assumes ownership)
|
1922
|
+
|
1923
|
+
On return, \p solver will be NULL.
|
1924
|
+
If deleteSolver then current solver deleted (if model owned)
|
1925
|
+
|
1926
|
+
\note Parameter settings in the outgoing solver are not inherited by
|
1927
|
+
the incoming solver.
|
1928
|
+
*/
|
1929
|
+
void assignSolver(OsiSolverInterface *&solver, bool deleteSolver = true);
|
1930
|
+
|
1931
|
+
/** \brief Set ownership of solver
|
1932
|
+
|
1933
|
+
A parameter of false tells CbcModel it does not own the solver and
|
1934
|
+
should not delete it. Once you claim ownership of the solver, you're
|
1935
|
+
responsible for eventually deleting it. Note that CbcModel clones
|
1936
|
+
solvers with abandon. Unless you have a deep understanding of the
|
1937
|
+
workings of CbcModel, the only time you want to claim ownership is when
|
1938
|
+
you're about to delete the CbcModel object but want the solver to
|
1939
|
+
continue to exist (as, for example, when branchAndBound has finished
|
1940
|
+
and you want to hang on to the answer).
|
1941
|
+
*/
|
1942
|
+
inline void setModelOwnsSolver (bool ourSolver) {
|
1943
|
+
ownership_ = ourSolver ? (ownership_ | 0x80000000) : (ownership_ & (~0x80000000)) ;
|
1944
|
+
}
|
1945
|
+
|
1946
|
+
/*! \brief Get ownership of solver
|
1947
|
+
|
1948
|
+
A return value of true means that CbcModel owns the solver and will
|
1949
|
+
take responsibility for deleting it when that becomes necessary.
|
1950
|
+
*/
|
1951
|
+
inline bool modelOwnsSolver () {
|
1952
|
+
return ((ownership_&0x80000000) != 0) ;
|
1953
|
+
}
|
1954
|
+
|
1955
|
+
/** Copy constructor .
|
1956
|
+
If cloneHandler is true then message handler is cloned
|
1957
|
+
*/
|
1958
|
+
CbcModel(const CbcModel & rhs, bool cloneHandler = false);
|
1959
|
+
|
1960
|
+
/** Clone */
|
1961
|
+
virtual CbcModel *clone (bool cloneHandler);
|
1962
|
+
|
1963
|
+
/// Assignment operator
|
1964
|
+
CbcModel & operator=(const CbcModel& rhs);
|
1965
|
+
|
1966
|
+
/// Destructor
|
1967
|
+
virtual ~CbcModel ();
|
1968
|
+
|
1969
|
+
/// Returns solver - has current state
|
1970
|
+
inline OsiSolverInterface * solver() const {
|
1971
|
+
return solver_;
|
1972
|
+
}
|
1973
|
+
|
1974
|
+
/// Returns current solver - sets new one
|
1975
|
+
inline OsiSolverInterface * swapSolver(OsiSolverInterface * solver) {
|
1976
|
+
OsiSolverInterface * returnSolver = solver_;
|
1977
|
+
solver_ = solver;
|
1978
|
+
return returnSolver;
|
1979
|
+
}
|
1980
|
+
|
1981
|
+
/// Returns solver with continuous state
|
1982
|
+
inline OsiSolverInterface * continuousSolver() const {
|
1983
|
+
return continuousSolver_;
|
1984
|
+
}
|
1985
|
+
|
1986
|
+
/// Create solver with continuous state
|
1987
|
+
inline void createContinuousSolver() {
|
1988
|
+
continuousSolver_ = solver_->clone();
|
1989
|
+
}
|
1990
|
+
/// Clear solver with continuous state
|
1991
|
+
inline void clearContinuousSolver() {
|
1992
|
+
delete continuousSolver_;
|
1993
|
+
continuousSolver_ = NULL;
|
1994
|
+
}
|
1995
|
+
|
1996
|
+
/// A copy of the solver, taken at constructor or by saveReferenceSolver
|
1997
|
+
inline OsiSolverInterface * referenceSolver() const {
|
1998
|
+
return referenceSolver_;
|
1999
|
+
}
|
2000
|
+
|
2001
|
+
/// Save a copy of the current solver so can be reset to
|
2002
|
+
void saveReferenceSolver();
|
2003
|
+
|
2004
|
+
/** Uses a copy of reference solver to be current solver.
|
2005
|
+
Because of possible mismatches all exotic integer information is loat
|
2006
|
+
(apart from normal information in OsiSolverInterface)
|
2007
|
+
so SOS etc and priorities will have to be redone
|
2008
|
+
*/
|
2009
|
+
void resetToReferenceSolver();
|
2010
|
+
|
2011
|
+
/// Clears out as much as possible (except solver)
|
2012
|
+
void gutsOfDestructor();
|
2013
|
+
/** Clears out enough to reset CbcModel as if no branch and bound done
|
2014
|
+
*/
|
2015
|
+
void gutsOfDestructor2();
|
2016
|
+
/** Clears out enough to reset CbcModel cutoff etc
|
2017
|
+
*/
|
2018
|
+
void resetModel();
|
2019
|
+
/** Most of copy constructor
|
2020
|
+
mode - 0 copy but don't delete before
|
2021
|
+
1 copy and delete before
|
2022
|
+
2 copy and delete before (but use virgin generators)
|
2023
|
+
*/
|
2024
|
+
void gutsOfCopy(const CbcModel & rhs, int mode = 0);
|
2025
|
+
/// Move status, nodes etc etc across
|
2026
|
+
void moveInfo(const CbcModel & rhs);
|
2027
|
+
//@}
|
2028
|
+
|
2029
|
+
///@name Multithreading
|
2030
|
+
//@{
|
2031
|
+
/// Indicates whether Cbc library has been compiled with multithreading support
|
2032
|
+
static bool haveMultiThreadSupport();
|
2033
|
+
/// Get pointer to masterthread
|
2034
|
+
CbcThread * masterThread() const {
|
2035
|
+
return masterThread_;
|
2036
|
+
}
|
2037
|
+
/// Get pointer to walkback
|
2038
|
+
CbcNodeInfo ** walkback() const {
|
2039
|
+
return walkback_;
|
2040
|
+
}
|
2041
|
+
/// Get number of threads
|
2042
|
+
inline int getNumberThreads() const {
|
2043
|
+
return numberThreads_;
|
2044
|
+
}
|
2045
|
+
/// Set number of threads
|
2046
|
+
inline void setNumberThreads(int value) {
|
2047
|
+
numberThreads_ = value;
|
2048
|
+
}
|
2049
|
+
/// Get thread mode
|
2050
|
+
inline int getThreadMode() const {
|
2051
|
+
return threadMode_;
|
2052
|
+
}
|
2053
|
+
/** Set thread mode
|
2054
|
+
always use numberThreads for branching
|
2055
|
+
1 set then deterministic
|
2056
|
+
2 set then use numberThreads for root cuts
|
2057
|
+
4 set then use numberThreads in root mini branch and bound
|
2058
|
+
8 set and numberThreads - do heuristics numberThreads at a time
|
2059
|
+
8 set and numberThreads==0 do all heuristics at once
|
2060
|
+
default is 0
|
2061
|
+
*/
|
2062
|
+
inline void setThreadMode(int value) {
|
2063
|
+
threadMode_ = value;
|
2064
|
+
}
|
2065
|
+
/** Return
|
2066
|
+
-2 if deterministic threaded and main thread
|
2067
|
+
-1 if deterministic threaded and serial thread
|
2068
|
+
0 if serial
|
2069
|
+
1 if opportunistic threaded
|
2070
|
+
*/
|
2071
|
+
inline int parallelMode() const {
|
2072
|
+
if (!numberThreads_) {
|
2073
|
+
if ((threadMode_&1) == 0)
|
2074
|
+
return 0;
|
2075
|
+
else
|
2076
|
+
return -1;
|
2077
|
+
return 0;
|
2078
|
+
} else {
|
2079
|
+
if ((threadMode_&1) == 0)
|
2080
|
+
return 1;
|
2081
|
+
else
|
2082
|
+
return -2;
|
2083
|
+
}
|
2084
|
+
}
|
2085
|
+
/// Thread stuff for master
|
2086
|
+
inline CbcBaseModel * master() const
|
2087
|
+
{ return master_;}
|
2088
|
+
/// From here to end of section - code in CbcThread.cpp until class changed
|
2089
|
+
/// Returns true if locked
|
2090
|
+
bool isLocked() const;
|
2091
|
+
#ifdef CBC_THREAD
|
2092
|
+
/**
|
2093
|
+
Locks a thread if parallel so that stuff like cut pool
|
2094
|
+
can be updated and/or used.
|
2095
|
+
*/
|
2096
|
+
void lockThread();
|
2097
|
+
/**
|
2098
|
+
Unlocks a thread if parallel to say cut pool stuff not needed
|
2099
|
+
*/
|
2100
|
+
void unlockThread();
|
2101
|
+
#else
|
2102
|
+
inline void lockThread() {}
|
2103
|
+
inline void unlockThread() {}
|
2104
|
+
#endif
|
2105
|
+
/** Set information in a child
|
2106
|
+
-3 pass pointer to child thread info
|
2107
|
+
-2 just stop
|
2108
|
+
-1 delete simple child stuff
|
2109
|
+
0 delete opportunistic child stuff
|
2110
|
+
1 delete deterministic child stuff
|
2111
|
+
*/
|
2112
|
+
void setInfoInChild(int type, CbcThread * info);
|
2113
|
+
/** Move/copy information from one model to another
|
2114
|
+
-1 - initialization
|
2115
|
+
0 - from base model
|
2116
|
+
1 - to base model (and reset)
|
2117
|
+
2 - add in final statistics etc (and reset so can do clean destruction)
|
2118
|
+
*/
|
2119
|
+
void moveToModel(CbcModel * baseModel, int mode);
|
2120
|
+
/// Split up nodes
|
2121
|
+
int splitModel(int numberModels, CbcModel ** model,
|
2122
|
+
int numberNodes);
|
2123
|
+
/// Start threads
|
2124
|
+
void startSplitModel(int numberIterations);
|
2125
|
+
/// Merge models
|
2126
|
+
void mergeModels(int numberModel, CbcModel ** model,
|
2127
|
+
int numberNodes);
|
2128
|
+
//@}
|
2129
|
+
|
2130
|
+
///@name semi-private i.e. users should not use
|
2131
|
+
//@{
|
2132
|
+
/// Get how many Nodes it took to solve the problem.
|
2133
|
+
int getNodeCount2() const {
|
2134
|
+
return numberNodes2_;
|
2135
|
+
}
|
2136
|
+
/// Set pointers for speed
|
2137
|
+
void setPointers(const OsiSolverInterface * solver);
|
2138
|
+
/** Perform reduced cost fixing
|
2139
|
+
|
2140
|
+
Fixes integer variables at their current value based on reduced cost
|
2141
|
+
penalties. Returns number fixed
|
2142
|
+
*/
|
2143
|
+
int reducedCostFix() ;
|
2144
|
+
/** Makes all handlers same. If makeDefault 1 then makes top level
|
2145
|
+
default and rest point to that. If 2 then each is copy
|
2146
|
+
*/
|
2147
|
+
void synchronizeHandlers(int makeDefault);
|
2148
|
+
/// Save a solution to saved list
|
2149
|
+
void saveExtraSolution(const double * solution, double objectiveValue);
|
2150
|
+
/// Save a solution to best and move current to saved
|
2151
|
+
void saveBestSolution(const double * solution, double objectiveValue);
|
2152
|
+
/// Delete best and saved solutions
|
2153
|
+
void deleteSolutions();
|
2154
|
+
/// Encapsulates solver resolve
|
2155
|
+
int resolve(OsiSolverInterface * solver);
|
2156
|
+
#ifdef CLP_RESOLVE
|
2157
|
+
/// Special purpose resolve
|
2158
|
+
int resolveClp(OsiClpSolverInterface * solver, int type);
|
2159
|
+
#endif
|
2160
|
+
|
2161
|
+
/** Encapsulates choosing a variable -
|
2162
|
+
anyAction -2, infeasible (-1 round again), 0 done
|
2163
|
+
*/
|
2164
|
+
int chooseBranch(CbcNode * & newNode, int numberPassesLeft,
|
2165
|
+
CbcNode * oldNode, OsiCuts & cuts,
|
2166
|
+
bool & resolved, CoinWarmStartBasis *lastws,
|
2167
|
+
const double * lowerBefore, const double * upperBefore,
|
2168
|
+
OsiSolverBranch * & branches);
|
2169
|
+
int chooseBranch(CbcNode * newNode, int numberPassesLeft, bool & resolved);
|
2170
|
+
|
2171
|
+
/** Return an empty basis object of the specified size
|
2172
|
+
|
2173
|
+
A useful utility when constructing a basis for a subproblem from scratch.
|
2174
|
+
The object returned will be of the requested capacity and appropriate for
|
2175
|
+
the solver attached to the model.
|
2176
|
+
*/
|
2177
|
+
CoinWarmStartBasis *getEmptyBasis(int ns = 0, int na = 0) const ;
|
2178
|
+
|
2179
|
+
/** Remove inactive cuts from the model
|
2180
|
+
|
2181
|
+
An OsiSolverInterface is expected to maintain a valid basis, but not a
|
2182
|
+
valid solution, when loose cuts are deleted. Restoring a valid solution
|
2183
|
+
requires calling the solver to reoptimise. If it's certain the solution
|
2184
|
+
will not be required, set allowResolve to false to suppress
|
2185
|
+
reoptimisation.
|
2186
|
+
If saveCuts then slack cuts will be saved
|
2187
|
+
On input current cuts are cuts and newCuts
|
2188
|
+
on exit current cuts will be correct. Returns number dropped
|
2189
|
+
*/
|
2190
|
+
int takeOffCuts(OsiCuts &cuts,
|
2191
|
+
bool allowResolve, OsiCuts * saveCuts,
|
2192
|
+
int numberNewCuts = 0, const OsiRowCut ** newCuts = NULL) ;
|
2193
|
+
|
2194
|
+
/** Determine and install the active cuts that need to be added for
|
2195
|
+
the current subproblem
|
2196
|
+
|
2197
|
+
The whole truth is a bit more complicated. The first action is a call to
|
2198
|
+
addCuts1(). addCuts() then sorts through the list, installs the tight
|
2199
|
+
cuts in the model, and does bookkeeping (adjusts reference counts).
|
2200
|
+
The basis returned from addCuts1() is adjusted accordingly.
|
2201
|
+
|
2202
|
+
If it turns out that the node should really be fathomed by bound,
|
2203
|
+
addCuts() simply treats all the cuts as loose as it does the bookkeeping.
|
2204
|
+
|
2205
|
+
*/
|
2206
|
+
int addCuts(CbcNode * node, CoinWarmStartBasis *&lastws);
|
2207
|
+
|
2208
|
+
/** Traverse the tree from node to root and prep the model
|
2209
|
+
|
2210
|
+
addCuts1() begins the job of prepping the model to match the current
|
2211
|
+
subproblem. The model is stripped of all cuts, and the search tree is
|
2212
|
+
traversed from node to root to determine the changes required. Appropriate
|
2213
|
+
bounds changes are installed, a list of cuts is collected but not
|
2214
|
+
installed, and an appropriate basis (minus the cuts, but big enough to
|
2215
|
+
accommodate them) is constructed.
|
2216
|
+
|
2217
|
+
Returns true if new problem similar to old
|
2218
|
+
|
2219
|
+
\todo addCuts1() is called in contexts where it's known in advance that
|
2220
|
+
all that's desired is to determine a list of cuts and do the
|
2221
|
+
bookkeeping (adjust the reference counts). The work of installing
|
2222
|
+
bounds and building a basis goes to waste.
|
2223
|
+
*/
|
2224
|
+
bool addCuts1(CbcNode * node, CoinWarmStartBasis *&lastws);
|
2225
|
+
/** Returns bounds just before where - initially original bounds.
|
2226
|
+
Also sets downstream nodes (lower if force 1, upper if 2)
|
2227
|
+
*/
|
2228
|
+
void previousBounds (CbcNode * node, CbcNodeInfo * where, int iColumn,
|
2229
|
+
double & lower, double & upper, int force);
|
2230
|
+
/** Set objective value in a node. This is separated out so that
|
2231
|
+
odd solvers can use. It may look at extra information in
|
2232
|
+
solverCharacteriscs_ and will also use bound from parent node
|
2233
|
+
*/
|
2234
|
+
void setObjectiveValue(CbcNode * thisNode, const CbcNode * parentNode) const;
|
2235
|
+
|
2236
|
+
/** If numberBeforeTrust >0 then we are going to use CbcBranchDynamic.
|
2237
|
+
Scan and convert CbcSimpleInteger objects
|
2238
|
+
*/
|
2239
|
+
void convertToDynamic();
|
2240
|
+
/// Set numberBeforeTrust in all objects
|
2241
|
+
void synchronizeNumberBeforeTrust(int type = 0);
|
2242
|
+
/// Zap integer information in problem (may leave object info)
|
2243
|
+
void zapIntegerInformation(bool leaveObjects = true);
|
2244
|
+
/// Use cliques for pseudocost information - return nonzero if infeasible
|
2245
|
+
int cliquePseudoCosts(int doStatistics);
|
2246
|
+
/// Fill in useful estimates
|
2247
|
+
void pseudoShadow(int type);
|
2248
|
+
/** Return pseudo costs
|
2249
|
+
If not all integers or not pseudo costs - returns all zero
|
2250
|
+
Length of arrays are numberIntegers() and entries
|
2251
|
+
correspond to integerVariable()[i]
|
2252
|
+
User must allocate arrays before call
|
2253
|
+
*/
|
2254
|
+
void fillPseudoCosts(double * downCosts, double * upCosts,
|
2255
|
+
int * priority = NULL,
|
2256
|
+
int * numberDown = NULL, int * numberUp = NULL,
|
2257
|
+
int * numberDownInfeasible = NULL,
|
2258
|
+
int * numberUpInfeasible = NULL) const;
|
2259
|
+
/** Do heuristics at root.
|
2260
|
+
0 - don't delete
|
2261
|
+
1 - delete
|
2262
|
+
2 - just delete - don't even use
|
2263
|
+
*/
|
2264
|
+
void doHeuristicsAtRoot(int deleteHeuristicsAfterwards = 0);
|
2265
|
+
/// Adjust heuristics based on model
|
2266
|
+
void adjustHeuristics();
|
2267
|
+
/// Get the hotstart solution
|
2268
|
+
inline const double * hotstartSolution() const {
|
2269
|
+
return hotstartSolution_;
|
2270
|
+
}
|
2271
|
+
/// Get the hotstart priorities
|
2272
|
+
inline const int * hotstartPriorities() const {
|
2273
|
+
return hotstartPriorities_;
|
2274
|
+
}
|
2275
|
+
|
2276
|
+
/// Return the list of cuts initially collected for this subproblem
|
2277
|
+
inline CbcCountRowCut ** addedCuts() const {
|
2278
|
+
return addedCuts_;
|
2279
|
+
}
|
2280
|
+
/// Number of entries in the list returned by #addedCuts()
|
2281
|
+
inline int currentNumberCuts() const {
|
2282
|
+
return currentNumberCuts_;
|
2283
|
+
}
|
2284
|
+
/// Global cuts
|
2285
|
+
inline CbcRowCuts * globalCuts() {
|
2286
|
+
return &globalCuts_;
|
2287
|
+
}
|
2288
|
+
/// Get rid of global cuts
|
2289
|
+
inline void zapGlobalCuts() {
|
2290
|
+
globalCuts_ = CbcRowCuts();
|
2291
|
+
}
|
2292
|
+
/// Copy and set a pointer to a row cut which will be added instead of normal branching.
|
2293
|
+
void setNextRowCut(const OsiRowCut & cut);
|
2294
|
+
/// Get a pointer to current node (be careful)
|
2295
|
+
inline CbcNode * currentNode() const {
|
2296
|
+
return currentNode_;
|
2297
|
+
}
|
2298
|
+
/// Get a pointer to probing info
|
2299
|
+
inline CglTreeProbingInfo * probingInfo() const {
|
2300
|
+
return probingInfo_;
|
2301
|
+
}
|
2302
|
+
/// Thread specific random number generator
|
2303
|
+
inline CoinThreadRandom * randomNumberGenerator() {
|
2304
|
+
return &randomNumberGenerator_;
|
2305
|
+
}
|
2306
|
+
/// Set the number of iterations done in strong branching.
|
2307
|
+
inline void setNumberStrongIterations(int number) {
|
2308
|
+
numberStrongIterations_ = number;
|
2309
|
+
}
|
2310
|
+
/// Get the number of iterations done in strong branching.
|
2311
|
+
inline int numberStrongIterations() const {
|
2312
|
+
return numberStrongIterations_;
|
2313
|
+
}
|
2314
|
+
/// Get maximum number of iterations (designed to be used in heuristics)
|
2315
|
+
inline int maximumNumberIterations() const {
|
2316
|
+
return maximumNumberIterations_;
|
2317
|
+
}
|
2318
|
+
/// Set maximum number of iterations (designed to be used in heuristics)
|
2319
|
+
inline void setMaximumNumberIterations(int value) {
|
2320
|
+
maximumNumberIterations_ = value;
|
2321
|
+
}
|
2322
|
+
/// Symmetry information
|
2323
|
+
inline CbcSymmetry * symmetryInfo() const
|
2324
|
+
{ return symmetryInfo_;}
|
2325
|
+
/// Set depth for fast nodes
|
2326
|
+
inline void setFastNodeDepth(int value) {
|
2327
|
+
fastNodeDepth_ = value;
|
2328
|
+
}
|
2329
|
+
/// Get depth for fast nodes
|
2330
|
+
inline int fastNodeDepth() const {
|
2331
|
+
return fastNodeDepth_;
|
2332
|
+
}
|
2333
|
+
/// Get anything with priority >= this can be treated as continuous
|
2334
|
+
inline int continuousPriority() const {
|
2335
|
+
return continuousPriority_;
|
2336
|
+
}
|
2337
|
+
/// Set anything with priority >= this can be treated as continuous
|
2338
|
+
inline void setContinuousPriority(int value) {
|
2339
|
+
continuousPriority_ = value;
|
2340
|
+
}
|
2341
|
+
inline void incrementExtra(int nodes, int iterations, int fathoms=1) {
|
2342
|
+
numberExtraNodes_ += nodes;
|
2343
|
+
numberExtraIterations_ += iterations;
|
2344
|
+
numberFathoms_ += fathoms;
|
2345
|
+
}
|
2346
|
+
/// Zero extra
|
2347
|
+
inline void zeroExtra() {
|
2348
|
+
numberExtraNodes_ = 0;
|
2349
|
+
numberExtraIterations_ = 0;
|
2350
|
+
numberFathoms_ = 0;
|
2351
|
+
}
|
2352
|
+
/// Number of extra iterations
|
2353
|
+
inline int numberExtraIterations() const {
|
2354
|
+
return numberExtraIterations_;
|
2355
|
+
}
|
2356
|
+
/// Increment strong info
|
2357
|
+
void incrementStrongInfo(int numberTimes, int numberIterations,
|
2358
|
+
int numberFixed, bool ifInfeasible);
|
2359
|
+
/// Return strong info
|
2360
|
+
inline const int * strongInfo() const {
|
2361
|
+
return strongInfo_;
|
2362
|
+
}
|
2363
|
+
|
2364
|
+
/// Return mutable strong info
|
2365
|
+
inline int * mutableStrongInfo() {
|
2366
|
+
return strongInfo_;
|
2367
|
+
}
|
2368
|
+
/// Get stored row cuts for donor/recipient CbcModel
|
2369
|
+
CglStored * storedRowCuts() const {
|
2370
|
+
return storedRowCuts_;
|
2371
|
+
}
|
2372
|
+
/// Set stored row cuts for donor/recipient CbcModel
|
2373
|
+
void setStoredRowCuts(CglStored * cuts) {
|
2374
|
+
storedRowCuts_ = cuts;
|
2375
|
+
}
|
2376
|
+
/// Says whether all dynamic integers
|
2377
|
+
inline bool allDynamic () const {
|
2378
|
+
return ((ownership_&0x40000000) != 0) ;
|
2379
|
+
}
|
2380
|
+
/// Create C++ lines to get to current state
|
2381
|
+
void generateCpp( FILE * fp, int options);
|
2382
|
+
/// Generate an OsiBranchingInformation object
|
2383
|
+
OsiBranchingInformation usefulInformation() const;
|
2384
|
+
/** Warm start object produced by heuristic or strong branching
|
2385
|
+
|
2386
|
+
If get a valid integer solution outside branch and bound then it can take
|
2387
|
+
a reasonable time to solve LP which produces clean solution. If this object has
|
2388
|
+
any size then it will be used in solve.
|
2389
|
+
*/
|
2390
|
+
inline void setBestSolutionBasis(const CoinWarmStartBasis & bestSolutionBasis) {
|
2391
|
+
bestSolutionBasis_ = bestSolutionBasis;
|
2392
|
+
}
|
2393
|
+
/// Redo walkback arrays
|
2394
|
+
void redoWalkBack();
|
2395
|
+
//@}
|
2396
|
+
|
2397
|
+
void setMIPStart( const std::vector< std::pair< std::string, double > > &mips ) {
|
2398
|
+
this->mipStart_ = mips;
|
2399
|
+
}
|
2400
|
+
|
2401
|
+
const std::vector< std::pair< std::string, double > > &getMIPStart() {
|
2402
|
+
return this->mipStart_;
|
2403
|
+
}
|
2404
|
+
|
2405
|
+
|
2406
|
+
//---------------------------------------------------------------------------
|
2407
|
+
|
2408
|
+
private:
|
2409
|
+
///@name Private member data
|
2410
|
+
//@{
|
2411
|
+
|
2412
|
+
/// The solver associated with this model.
|
2413
|
+
OsiSolverInterface * solver_;
|
2414
|
+
|
2415
|
+
/** Ownership of objects and other stuff
|
2416
|
+
|
2417
|
+
0x80000000 model owns solver
|
2418
|
+
0x40000000 all variables CbcDynamicPseudoCost
|
2419
|
+
*/
|
2420
|
+
unsigned int ownership_ ;
|
2421
|
+
|
2422
|
+
/// A copy of the solver, taken at the continuous (root) node.
|
2423
|
+
OsiSolverInterface * continuousSolver_;
|
2424
|
+
|
2425
|
+
/// A copy of the solver, taken at constructor or by saveReferenceSolver
|
2426
|
+
OsiSolverInterface * referenceSolver_;
|
2427
|
+
|
2428
|
+
/// Message handler
|
2429
|
+
CoinMessageHandler * handler_;
|
2430
|
+
|
2431
|
+
/** Flag to say if handler_ is the default handler.
|
2432
|
+
|
2433
|
+
The default handler is deleted when the model is deleted. Other
|
2434
|
+
handlers (supplied by the client) will not be deleted.
|
2435
|
+
*/
|
2436
|
+
bool defaultHandler_;
|
2437
|
+
|
2438
|
+
/// Cbc messages
|
2439
|
+
CoinMessages messages_;
|
2440
|
+
|
2441
|
+
/// Array for integer parameters
|
2442
|
+
int intParam_[CbcLastIntParam];
|
2443
|
+
|
2444
|
+
/// Array for double parameters
|
2445
|
+
double dblParam_[CbcLastDblParam];
|
2446
|
+
|
2447
|
+
/** Pointer to an empty warm start object
|
2448
|
+
|
2449
|
+
It turns out to be useful to have this available as a base from
|
2450
|
+
which to build custom warm start objects. This is typed as CoinWarmStart
|
2451
|
+
rather than CoinWarmStartBasis to allow for the possibility that a
|
2452
|
+
client might want to apply a solver that doesn't use a basis-based warm
|
2453
|
+
start. See getEmptyBasis for an example of how this field can be used.
|
2454
|
+
*/
|
2455
|
+
mutable CoinWarmStart *emptyWarmStart_ ;
|
2456
|
+
|
2457
|
+
/// Best objective
|
2458
|
+
double bestObjective_;
|
2459
|
+
/// Best possible objective
|
2460
|
+
double bestPossibleObjective_;
|
2461
|
+
/// Sum of Changes to objective by first solve
|
2462
|
+
double sumChangeObjective1_;
|
2463
|
+
/// Sum of Changes to objective by subsequent solves
|
2464
|
+
double sumChangeObjective2_;
|
2465
|
+
|
2466
|
+
/// Array holding the incumbent (best) solution.
|
2467
|
+
double * bestSolution_;
|
2468
|
+
/// Arrays holding other solutions.
|
2469
|
+
double ** savedSolutions_;
|
2470
|
+
|
2471
|
+
/** Array holding the current solution.
|
2472
|
+
|
2473
|
+
This array is used more as a temporary.
|
2474
|
+
*/
|
2475
|
+
double * currentSolution_;
|
2476
|
+
/** For testing infeasibilities - will point to
|
2477
|
+
currentSolution_ or solver-->getColSolution()
|
2478
|
+
*/
|
2479
|
+
mutable const double * testSolution_;
|
2480
|
+
/** MIPstart values
|
2481
|
+
values for integer variables which will be converted to a complete integer initial feasible solution
|
2482
|
+
*/
|
2483
|
+
std::vector< std::pair< std::string, double > > mipStart_;
|
2484
|
+
/** Warm start object produced by heuristic or strong branching
|
2485
|
+
|
2486
|
+
If get a valid integer solution outside branch and bound then it can take
|
2487
|
+
a reasonable time to solve LP which produces clean solution. If this object has
|
2488
|
+
any size then it will be used in solve.
|
2489
|
+
*/
|
2490
|
+
CoinWarmStartBasis bestSolutionBasis_ ;
|
2491
|
+
/// Global cuts
|
2492
|
+
CbcRowCuts globalCuts_;
|
2493
|
+
/// Global conflict cuts
|
2494
|
+
CbcRowCuts * globalConflictCuts_;
|
2495
|
+
|
2496
|
+
/// Minimum degradation in objective value to continue cut generation
|
2497
|
+
double minimumDrop_;
|
2498
|
+
/// Number of solutions
|
2499
|
+
int numberSolutions_;
|
2500
|
+
/// Number of saved solutions
|
2501
|
+
int numberSavedSolutions_;
|
2502
|
+
/// Maximum number of saved solutions
|
2503
|
+
int maximumSavedSolutions_;
|
2504
|
+
/** State of search
|
2505
|
+
0 - no solution
|
2506
|
+
1 - only heuristic solutions
|
2507
|
+
2 - branched to a solution
|
2508
|
+
3 - no solution but many nodes
|
2509
|
+
*/
|
2510
|
+
int stateOfSearch_;
|
2511
|
+
/// At which depths to do cuts
|
2512
|
+
int whenCuts_;
|
2513
|
+
/// Hotstart solution
|
2514
|
+
double * hotstartSolution_;
|
2515
|
+
/// Hotstart priorities
|
2516
|
+
int * hotstartPriorities_;
|
2517
|
+
/// Number of heuristic solutions
|
2518
|
+
int numberHeuristicSolutions_;
|
2519
|
+
/// Cumulative number of nodes
|
2520
|
+
int numberNodes_;
|
2521
|
+
/** Cumulative number of nodes for statistics.
|
2522
|
+
Must fix to match up
|
2523
|
+
*/
|
2524
|
+
int numberNodes2_;
|
2525
|
+
/// Cumulative number of iterations
|
2526
|
+
int numberIterations_;
|
2527
|
+
/// Cumulative number of solves
|
2528
|
+
int numberSolves_;
|
2529
|
+
/// Status of problem - 0 finished, 1 stopped, 2 difficulties
|
2530
|
+
int status_;
|
2531
|
+
/** Secondary status of problem
|
2532
|
+
-1 unset (status_ will also be -1)
|
2533
|
+
0 search completed with solution
|
2534
|
+
1 linear relaxation not feasible (or worse than cutoff)
|
2535
|
+
2 stopped on gap
|
2536
|
+
3 stopped on nodes
|
2537
|
+
4 stopped on time
|
2538
|
+
5 stopped on user event
|
2539
|
+
6 stopped on solutions
|
2540
|
+
*/
|
2541
|
+
int secondaryStatus_;
|
2542
|
+
/// Number of integers in problem
|
2543
|
+
int numberIntegers_;
|
2544
|
+
/// Number of rows at continuous
|
2545
|
+
int numberRowsAtContinuous_;
|
2546
|
+
/**
|
2547
|
+
-1 - cutoff as constraint not activated
|
2548
|
+
-2 - waiting to activate
|
2549
|
+
>=0 - activated
|
2550
|
+
*/
|
2551
|
+
int cutoffRowNumber_;
|
2552
|
+
/// Maximum number of cuts
|
2553
|
+
int maximumNumberCuts_;
|
2554
|
+
/** Current phase (so heuristics etc etc can find out).
|
2555
|
+
0 - initial solve
|
2556
|
+
1 - solve with cuts at root
|
2557
|
+
2 - solve with cuts
|
2558
|
+
3 - other e.g. strong branching
|
2559
|
+
4 - trying to validate a solution
|
2560
|
+
5 - at end of search
|
2561
|
+
*/
|
2562
|
+
int phase_;
|
2563
|
+
|
2564
|
+
/// Number of entries in #addedCuts_
|
2565
|
+
int currentNumberCuts_;
|
2566
|
+
|
2567
|
+
/** Current limit on search tree depth
|
2568
|
+
|
2569
|
+
The allocated size of #walkback_. Increased as needed.
|
2570
|
+
*/
|
2571
|
+
int maximumDepth_;
|
2572
|
+
/** Array used to assemble the path between a node and the search tree root
|
2573
|
+
|
2574
|
+
The array is resized when necessary. #maximumDepth_ is the current
|
2575
|
+
allocated size.
|
2576
|
+
*/
|
2577
|
+
CbcNodeInfo ** walkback_;
|
2578
|
+
CbcNodeInfo ** lastNodeInfo_;
|
2579
|
+
const OsiRowCut ** lastCut_;
|
2580
|
+
int lastDepth_;
|
2581
|
+
int lastNumberCuts2_;
|
2582
|
+
int maximumCuts_;
|
2583
|
+
int * lastNumberCuts_;
|
2584
|
+
|
2585
|
+
/** The list of cuts initially collected for this subproblem
|
2586
|
+
|
2587
|
+
When the subproblem at this node is rebuilt, a set of cuts is collected
|
2588
|
+
for inclusion in the constraint system. If any of these cuts are
|
2589
|
+
subsequently removed because they have become loose, the corresponding
|
2590
|
+
entry is set to NULL.
|
2591
|
+
*/
|
2592
|
+
CbcCountRowCut ** addedCuts_;
|
2593
|
+
|
2594
|
+
/** A pointer to a row cut which will be added instead of normal branching.
|
2595
|
+
After use it should be set to NULL.
|
2596
|
+
*/
|
2597
|
+
OsiRowCut * nextRowCut_;
|
2598
|
+
|
2599
|
+
/// Current node so can be used elsewhere
|
2600
|
+
CbcNode * currentNode_;
|
2601
|
+
|
2602
|
+
/// Indices of integer variables
|
2603
|
+
int * integerVariable_;
|
2604
|
+
/// Whether of not integer
|
2605
|
+
char * integerInfo_;
|
2606
|
+
/// Holds solution at continuous (after cuts)
|
2607
|
+
double * continuousSolution_;
|
2608
|
+
/// Array marked whenever a solution is found if non-zero
|
2609
|
+
int * usedInSolution_;
|
2610
|
+
/**
|
2611
|
+
Special options
|
2612
|
+
0 bit (1) - check if cuts valid (if on debugger list)
|
2613
|
+
1 bit (2) - use current basis to check integer solution (rather than all slack)
|
2614
|
+
2 bit (4) - don't check integer solution (by solving LP)
|
2615
|
+
3 bit (8) - fast analyze
|
2616
|
+
4 bit (16) - non-linear model - so no well defined CoinPackedMatrix
|
2617
|
+
5 bit (32) - keep names
|
2618
|
+
6 bit (64) - try for dominated columns
|
2619
|
+
7 bit (128) - SOS type 1 but all declared integer
|
2620
|
+
8 bit (256) - Set to say solution just found, unset by doing cuts
|
2621
|
+
9 bit (512) - Try reduced model after 100 nodes
|
2622
|
+
10 bit (1024) - Switch on some heuristics even if seems unlikely
|
2623
|
+
11 bit (2048) - Mark as in small branch and bound
|
2624
|
+
12 bit (4096) - Funny cuts so do slow way (in some places)
|
2625
|
+
13 bit (8192) - Funny cuts so do slow way (in other places)
|
2626
|
+
14 bit (16384) - Use Cplex! for fathoming
|
2627
|
+
15 bit (32768) - Try reduced model after 0 nodes
|
2628
|
+
16 bit (65536) - Original model had integer bounds
|
2629
|
+
17 bit (131072) - Perturbation switched off
|
2630
|
+
18 bit (262144) - donor CbcModel
|
2631
|
+
19 bit (524288) - recipient CbcModel
|
2632
|
+
20 bit (1048576) - waiting for sub model to return
|
2633
|
+
22 bit (4194304) - do not initialize random seed in solver (user has)
|
2634
|
+
23 bit (8388608) - leave solver_ with cuts
|
2635
|
+
24 bit (16777216) - just get feasible if no cutoff
|
2636
|
+
*/
|
2637
|
+
int specialOptions_;
|
2638
|
+
/** More special options
|
2639
|
+
at present bottom 6 bits used for shadow price mode
|
2640
|
+
1024 for experimental hotstart
|
2641
|
+
2048,4096 breaking out of cuts
|
2642
|
+
8192 slowly increase minimum drop
|
2643
|
+
16384 gomory
|
2644
|
+
32768 more heuristics in sub trees
|
2645
|
+
65536 no cuts in preprocessing
|
2646
|
+
131072 Time limits elapsed
|
2647
|
+
18 bit (262144) - Perturb fathom nodes
|
2648
|
+
19 bit (524288) - No limit on fathom nodes
|
2649
|
+
20 bit (1048576) - Reduce sum of infeasibilities before cuts
|
2650
|
+
21 bit (2097152) - Reduce sum of infeasibilities after cuts
|
2651
|
+
*/
|
2652
|
+
int moreSpecialOptions_;
|
2653
|
+
/** More more special options
|
2654
|
+
0 bit (1) - find switching variables
|
2655
|
+
1 bit (2) - using fake objective until solution
|
2656
|
+
2 bit (4) - switching variables exist
|
2657
|
+
3 bit (8) - skip most of setBestSolution checks
|
2658
|
+
4 bit (16) - very lightweight preprocessing in smallB&B
|
2659
|
+
5 bit (32) - event handler needs to be cloned when parallel
|
2660
|
+
6 bit (64) - testing - use probing to make cliques
|
2661
|
+
7/8 bit (128) - try orbital branching (if nauty)
|
2662
|
+
9 bit (512) - branching on objective (later)
|
2663
|
+
10 bit (1024) - branching on constraints (later)
|
2664
|
+
11/12 bit 2048 - intermittent cuts
|
2665
|
+
*/
|
2666
|
+
int moreSpecialOptions2_;
|
2667
|
+
/// User node comparison function
|
2668
|
+
CbcCompareBase * nodeCompare_;
|
2669
|
+
/// User feasibility function (see CbcFeasibleBase.hpp)
|
2670
|
+
CbcFeasibilityBase * problemFeasibility_;
|
2671
|
+
/// Tree
|
2672
|
+
CbcTree * tree_;
|
2673
|
+
/// Pointer to top of tree
|
2674
|
+
CbcFullNodeInfo * topOfTree_;
|
2675
|
+
/// A pointer to model to be used for subtrees
|
2676
|
+
CbcModel * subTreeModel_;
|
2677
|
+
/// A pointer to model from CbcHeuristic
|
2678
|
+
CbcModel * heuristicModel_;
|
2679
|
+
/// Number of times any subtree stopped on nodes, time etc
|
2680
|
+
int numberStoppedSubTrees_;
|
2681
|
+
/// Variable selection function
|
2682
|
+
CbcBranchDecision * branchingMethod_;
|
2683
|
+
/// Cut modifier function
|
2684
|
+
CbcCutModifier * cutModifier_;
|
2685
|
+
/// Strategy
|
2686
|
+
CbcStrategy * strategy_;
|
2687
|
+
/// Parent model
|
2688
|
+
CbcModel * parentModel_;
|
2689
|
+
/** Whether to automatically do presolve before branch and bound.
|
2690
|
+
0 - no
|
2691
|
+
1 - ordinary presolve
|
2692
|
+
2 - integer presolve (dodgy)
|
2693
|
+
*/
|
2694
|
+
/// Pointer to array[getNumCols()] (for speed) of column lower bounds
|
2695
|
+
const double * cbcColLower_;
|
2696
|
+
/// Pointer to array[getNumCols()] (for speed) of column upper bounds
|
2697
|
+
const double * cbcColUpper_;
|
2698
|
+
/// Pointer to array[getNumRows()] (for speed) of row lower bounds
|
2699
|
+
const double * cbcRowLower_;
|
2700
|
+
/// Pointer to array[getNumRows()] (for speed) of row upper bounds
|
2701
|
+
const double * cbcRowUpper_;
|
2702
|
+
/// Pointer to array[getNumCols()] (for speed) of primal solution vector
|
2703
|
+
const double * cbcColSolution_;
|
2704
|
+
/// Pointer to array[getNumRows()] (for speed) of dual prices
|
2705
|
+
const double * cbcRowPrice_;
|
2706
|
+
/// Get a pointer to array[getNumCols()] (for speed) of reduced costs
|
2707
|
+
const double * cbcReducedCost_;
|
2708
|
+
/// Pointer to array[getNumRows()] (for speed) of row activity levels.
|
2709
|
+
const double * cbcRowActivity_;
|
2710
|
+
/// Pointer to user-defined data structure
|
2711
|
+
void * appData_;
|
2712
|
+
/// Presolve for CbcTreeLocal
|
2713
|
+
int presolve_;
|
2714
|
+
/** Maximum number of candidates to consider for strong branching.
|
2715
|
+
To disable strong branching, set this to 0.
|
2716
|
+
*/
|
2717
|
+
int numberStrong_;
|
2718
|
+
/** \brief The number of branches before pseudo costs believed
|
2719
|
+
in dynamic strong branching.
|
2720
|
+
|
2721
|
+
A value of 0 is off.
|
2722
|
+
*/
|
2723
|
+
int numberBeforeTrust_;
|
2724
|
+
/** \brief The number of variables for which to compute penalties
|
2725
|
+
in dynamic strong branching.
|
2726
|
+
*/
|
2727
|
+
int numberPenalties_;
|
2728
|
+
/// For threads - stop after this many "iterations"
|
2729
|
+
int stopNumberIterations_;
|
2730
|
+
/** Scale factor to make penalties match strong.
|
2731
|
+
Should/will be computed */
|
2732
|
+
double penaltyScaleFactor_;
|
2733
|
+
/// Number of analyze iterations to do
|
2734
|
+
int numberAnalyzeIterations_;
|
2735
|
+
/// Arrays with analysis results
|
2736
|
+
double * analyzeResults_;
|
2737
|
+
/// Useful temporary pointer
|
2738
|
+
void * temporaryPointer_;
|
2739
|
+
/// Number of nodes infeasible by normal branching (before cuts)
|
2740
|
+
int numberInfeasibleNodes_;
|
2741
|
+
/** Problem type as set by user or found by analysis. This will be extended
|
2742
|
+
0 - not known
|
2743
|
+
1 - Set partitioning <=
|
2744
|
+
2 - Set partitioning ==
|
2745
|
+
3 - Set covering
|
2746
|
+
*/
|
2747
|
+
int problemType_;
|
2748
|
+
/// Print frequency
|
2749
|
+
int printFrequency_;
|
2750
|
+
/// Number of cut generators
|
2751
|
+
int numberCutGenerators_;
|
2752
|
+
// Cut generators
|
2753
|
+
CbcCutGenerator ** generator_;
|
2754
|
+
// Cut generators before any changes
|
2755
|
+
CbcCutGenerator ** virginGenerator_;
|
2756
|
+
/// Number of heuristics
|
2757
|
+
int numberHeuristics_;
|
2758
|
+
/// Heuristic solvers
|
2759
|
+
CbcHeuristic ** heuristic_;
|
2760
|
+
/// Pointer to heuristic solver which found last solution (or NULL)
|
2761
|
+
CbcHeuristic * lastHeuristic_;
|
2762
|
+
/// Depth for fast nodes
|
2763
|
+
int fastNodeDepth_;
|
2764
|
+
/*! Pointer to the event handler */
|
2765
|
+
# ifdef CBC_ONLY_CLP
|
2766
|
+
ClpEventHandler *eventHandler_ ;
|
2767
|
+
# else
|
2768
|
+
CbcEventHandler *eventHandler_ ;
|
2769
|
+
# endif
|
2770
|
+
/// Symmetry information
|
2771
|
+
CbcSymmetry * symmetryInfo_;
|
2772
|
+
/// Total number of objects
|
2773
|
+
int numberObjects_;
|
2774
|
+
|
2775
|
+
/** \brief Integer and Clique and ... information
|
2776
|
+
|
2777
|
+
\note The code assumes that the first objects on the list will be
|
2778
|
+
SimpleInteger objects for each integer variable, followed by
|
2779
|
+
Clique objects. Portions of the code that understand Clique objects
|
2780
|
+
will fail if they do not immediately follow the SimpleIntegers.
|
2781
|
+
Large chunks of the code will fail if the first objects are not
|
2782
|
+
SimpleInteger. As of 2003.08, SimpleIntegers and Cliques are the only
|
2783
|
+
objects.
|
2784
|
+
*/
|
2785
|
+
OsiObject ** object_;
|
2786
|
+
/// Now we may not own objects - just point to solver's objects
|
2787
|
+
bool ownObjects_;
|
2788
|
+
|
2789
|
+
/// Original columns as created by integerPresolve or preprocessing
|
2790
|
+
int * originalColumns_;
|
2791
|
+
/// How often to scan global cuts
|
2792
|
+
int howOftenGlobalScan_;
|
2793
|
+
/** Number of times global cuts violated. When global cut pool then this
|
2794
|
+
should be kept for each cut and type of cut */
|
2795
|
+
int numberGlobalViolations_;
|
2796
|
+
/// Number of extra iterations in fast lp
|
2797
|
+
int numberExtraIterations_;
|
2798
|
+
/// Number of extra nodes in fast lp
|
2799
|
+
int numberExtraNodes_;
|
2800
|
+
/// Number of times fast lp entered
|
2801
|
+
int numberFathoms_;
|
2802
|
+
/** Value of objective at continuous
|
2803
|
+
(Well actually after initial round of cuts)
|
2804
|
+
*/
|
2805
|
+
double continuousObjective_;
|
2806
|
+
/** Value of objective before root node cuts added
|
2807
|
+
*/
|
2808
|
+
double originalContinuousObjective_;
|
2809
|
+
/// Number of infeasibilities at continuous
|
2810
|
+
int continuousInfeasibilities_;
|
2811
|
+
/// Maximum number of cut passes at root
|
2812
|
+
int maximumCutPassesAtRoot_;
|
2813
|
+
/// Maximum number of cut passes
|
2814
|
+
int maximumCutPasses_;
|
2815
|
+
/// Preferred way of branching
|
2816
|
+
int preferredWay_;
|
2817
|
+
/// Current cut pass number
|
2818
|
+
int currentPassNumber_;
|
2819
|
+
/// Maximum number of cuts (for whichGenerator_)
|
2820
|
+
int maximumWhich_;
|
2821
|
+
/// Maximum number of rows
|
2822
|
+
int maximumRows_;
|
2823
|
+
/// Random seed
|
2824
|
+
int randomSeed_;
|
2825
|
+
/// Multiple root tries
|
2826
|
+
int multipleRootTries_;
|
2827
|
+
/// Current depth
|
2828
|
+
int currentDepth_;
|
2829
|
+
/// Thread specific random number generator
|
2830
|
+
mutable CoinThreadRandom randomNumberGenerator_;
|
2831
|
+
/// Work basis for temporary use
|
2832
|
+
CoinWarmStartBasis workingBasis_;
|
2833
|
+
/// Which cut generator generated this cut
|
2834
|
+
int * whichGenerator_;
|
2835
|
+
/// Maximum number of statistics
|
2836
|
+
int maximumStatistics_;
|
2837
|
+
/// statistics
|
2838
|
+
CbcStatistics ** statistics_;
|
2839
|
+
/// Maximum depth reached
|
2840
|
+
int maximumDepthActual_;
|
2841
|
+
/// Number of reduced cost fixings
|
2842
|
+
double numberDJFixed_;
|
2843
|
+
/// Probing info
|
2844
|
+
CglTreeProbingInfo * probingInfo_;
|
2845
|
+
/// Number of fixed by analyze at root
|
2846
|
+
int numberFixedAtRoot_;
|
2847
|
+
/// Number fixed by analyze so far
|
2848
|
+
int numberFixedNow_;
|
2849
|
+
/// Whether stopping on gap
|
2850
|
+
bool stoppedOnGap_;
|
2851
|
+
/// Whether event happened
|
2852
|
+
mutable bool eventHappened_;
|
2853
|
+
/// Number of long strong goes
|
2854
|
+
int numberLongStrong_;
|
2855
|
+
/// Number of old active cuts
|
2856
|
+
int numberOldActiveCuts_;
|
2857
|
+
/// Number of new cuts
|
2858
|
+
int numberNewCuts_;
|
2859
|
+
/// Strategy worked out - mainly at root node
|
2860
|
+
int searchStrategy_;
|
2861
|
+
/** Strategy for strong branching
|
2862
|
+
0 - normal
|
2863
|
+
when to do all fractional
|
2864
|
+
1 - root node
|
2865
|
+
2 - depth less than modifier
|
2866
|
+
4 - if objective == best possible
|
2867
|
+
6 - as 2+4
|
2868
|
+
when to do all including satisfied
|
2869
|
+
10 - root node etc.
|
2870
|
+
If >=100 then do when depth <= strategy/100 (otherwise 5)
|
2871
|
+
*/
|
2872
|
+
int strongStrategy_;
|
2873
|
+
/// Number of iterations in strong branching
|
2874
|
+
int numberStrongIterations_;
|
2875
|
+
/** 0 - number times strong branching done, 1 - number fixed, 2 - number infeasible
|
2876
|
+
Second group of three is a snapshot at node [6] */
|
2877
|
+
int strongInfo_[7];
|
2878
|
+
/**
|
2879
|
+
For advanced applications you may wish to modify the behavior of Cbc
|
2880
|
+
e.g. if the solver is a NLP solver then you may not have an exact
|
2881
|
+
optimum solution at each step. This gives characteristics - just for one BAB.
|
2882
|
+
For actually saving/restoring a solution you need the actual solver one.
|
2883
|
+
*/
|
2884
|
+
OsiBabSolver * solverCharacteristics_;
|
2885
|
+
/// Whether to force a resolve after takeOffCuts
|
2886
|
+
bool resolveAfterTakeOffCuts_;
|
2887
|
+
/// Maximum number of iterations (designed to be used in heuristics)
|
2888
|
+
int maximumNumberIterations_;
|
2889
|
+
/// Anything with priority >= this can be treated as continuous
|
2890
|
+
int continuousPriority_;
|
2891
|
+
/// Number of outstanding update information items
|
2892
|
+
int numberUpdateItems_;
|
2893
|
+
/// Maximum number of outstanding update information items
|
2894
|
+
int maximumNumberUpdateItems_;
|
2895
|
+
/// Update items
|
2896
|
+
CbcObjectUpdateData * updateItems_;
|
2897
|
+
/// Stored row cuts for donor/recipient CbcModel
|
2898
|
+
CglStored * storedRowCuts_;
|
2899
|
+
/**
|
2900
|
+
Parallel
|
2901
|
+
0 - off
|
2902
|
+
1 - testing
|
2903
|
+
2-99 threads
|
2904
|
+
other special meanings
|
2905
|
+
*/
|
2906
|
+
int numberThreads_;
|
2907
|
+
/** thread mode
|
2908
|
+
always use numberThreads for branching
|
2909
|
+
1 set then deterministic
|
2910
|
+
2 set then use numberThreads for root cuts
|
2911
|
+
4 set then use numberThreads in root mini branch and bound
|
2912
|
+
default is 0
|
2913
|
+
*/
|
2914
|
+
int threadMode_;
|
2915
|
+
/// Number of global cuts on entry to a node
|
2916
|
+
int numberGlobalCutsIn_;
|
2917
|
+
/// Thread stuff for master
|
2918
|
+
CbcBaseModel * master_;
|
2919
|
+
/// Pointer to masterthread
|
2920
|
+
CbcThread * masterThread_;
|
2921
|
+
//@}
|
2922
|
+
};
|
2923
|
+
/// So we can use osiObject or CbcObject during transition
|
2924
|
+
void getIntegerInformation(const OsiObject * object, double & originalLower,
|
2925
|
+
double & originalUpper) ;
|
2926
|
+
// So we can call from other programs
|
2927
|
+
// Real main program
|
2928
|
+
class OsiClpSolverInterface;
|
2929
|
+
int CbcMain (int argc, const char *argv[], OsiClpSolverInterface & solver, CbcModel ** babSolver);
|
2930
|
+
int CbcMain (int argc, const char *argv[], CbcModel & babSolver);
|
2931
|
+
// four ways of calling
|
2932
|
+
int callCbc(const char * input2, OsiClpSolverInterface& solver1);
|
2933
|
+
int callCbc(const char * input2);
|
2934
|
+
int callCbc(const std::string input2, OsiClpSolverInterface& solver1);
|
2935
|
+
int callCbc(const std::string input2) ;
|
2936
|
+
// When we want to load up CbcModel with options first
|
2937
|
+
void CbcMain0 (CbcModel & babSolver);
|
2938
|
+
int CbcMain1 (int argc, const char *argv[], CbcModel & babSolver);
|
2939
|
+
// two ways of calling
|
2940
|
+
int callCbc(const char * input2, CbcModel & babSolver);
|
2941
|
+
int callCbc(const std::string input2, CbcModel & babSolver);
|
2942
|
+
// And when CbcMain0 already called to initialize
|
2943
|
+
int callCbc1(const char * input2, CbcModel & babSolver);
|
2944
|
+
int callCbc1(const std::string input2, CbcModel & babSolver);
|
2945
|
+
// And when CbcMain0 already called to initialize (with call back) (see CbcMain1 for whereFrom)
|
2946
|
+
int callCbc1(const char * input2, CbcModel & babSolver, int (CbcModel * currentSolver, int whereFrom));
|
2947
|
+
int callCbc1(const std::string input2, CbcModel & babSolver, int (CbcModel * currentSolver, int whereFrom));
|
2948
|
+
int CbcMain1 (int argc, const char *argv[], CbcModel & babSolver, int (CbcModel * currentSolver, int whereFrom));
|
2949
|
+
// For uniform setting of cut and heuristic options
|
2950
|
+
void setCutAndHeuristicOptions(CbcModel & model);
|
2951
|
+
#endif
|
2952
|
+
|