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,1054 @@
|
|
1
|
+
/* $Id: CoinModel.hpp 1691 2014-03-19 12:43:56Z forrest $ */
|
2
|
+
// Copyright (C) 2005, 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 CoinModel_H
|
7
|
+
#define CoinModel_H
|
8
|
+
|
9
|
+
#include "CoinModelUseful.hpp"
|
10
|
+
#include "CoinMessageHandler.hpp"
|
11
|
+
#include "CoinPackedMatrix.hpp"
|
12
|
+
#include "CoinFinite.hpp"
|
13
|
+
class CoinBaseModel {
|
14
|
+
|
15
|
+
public:
|
16
|
+
|
17
|
+
|
18
|
+
/**@name Constructors, destructor */
|
19
|
+
//@{
|
20
|
+
/// Default Constructor
|
21
|
+
CoinBaseModel ();
|
22
|
+
|
23
|
+
/// Copy constructor
|
24
|
+
CoinBaseModel ( const CoinBaseModel &rhs);
|
25
|
+
|
26
|
+
/// Assignment operator
|
27
|
+
CoinBaseModel & operator=( const CoinBaseModel& rhs);
|
28
|
+
|
29
|
+
/// Clone
|
30
|
+
virtual CoinBaseModel * clone() const=0;
|
31
|
+
|
32
|
+
/// Destructor
|
33
|
+
virtual ~CoinBaseModel () ;
|
34
|
+
//@}
|
35
|
+
|
36
|
+
/**@name For getting information */
|
37
|
+
//@{
|
38
|
+
/// Return number of rows
|
39
|
+
inline int numberRows() const
|
40
|
+
{ return numberRows_;}
|
41
|
+
/// Return number of columns
|
42
|
+
inline int numberColumns() const
|
43
|
+
{ return numberColumns_;}
|
44
|
+
/// Return number of elements
|
45
|
+
virtual CoinBigIndex numberElements() const = 0;
|
46
|
+
/** Returns the (constant) objective offset
|
47
|
+
This is the RHS entry for the objective row
|
48
|
+
*/
|
49
|
+
inline double objectiveOffset() const
|
50
|
+
{ return objectiveOffset_;}
|
51
|
+
/// Set objective offset
|
52
|
+
inline void setObjectiveOffset(double value)
|
53
|
+
{ objectiveOffset_=value;}
|
54
|
+
/// Direction of optimization (1 - minimize, -1 - maximize, 0 - ignore
|
55
|
+
inline double optimizationDirection() const {
|
56
|
+
return optimizationDirection_;
|
57
|
+
}
|
58
|
+
/// Set direction of optimization (1 - minimize, -1 - maximize, 0 - ignore
|
59
|
+
inline void setOptimizationDirection(double value)
|
60
|
+
{ optimizationDirection_=value;}
|
61
|
+
/// Get print level 0 - off, 1 - errors, 2 - more
|
62
|
+
inline int logLevel() const
|
63
|
+
{ return logLevel_;}
|
64
|
+
/// Set print level 0 - off, 1 - errors, 2 - more
|
65
|
+
void setLogLevel(int value);
|
66
|
+
/// Return the problem name
|
67
|
+
inline const char * getProblemName() const
|
68
|
+
{ return problemName_.c_str();}
|
69
|
+
/// Set problem name
|
70
|
+
void setProblemName(const char *name) ;
|
71
|
+
/// Set problem name
|
72
|
+
void setProblemName(const std::string &name) ;
|
73
|
+
/// Return the row block name
|
74
|
+
inline const std::string & getRowBlock() const
|
75
|
+
{ return rowBlockName_;}
|
76
|
+
/// Set row block name
|
77
|
+
inline void setRowBlock(const std::string &name)
|
78
|
+
{ rowBlockName_ = name;}
|
79
|
+
/// Return the column block name
|
80
|
+
inline const std::string & getColumnBlock() const
|
81
|
+
{ return columnBlockName_;}
|
82
|
+
/// Set column block name
|
83
|
+
inline void setColumnBlock(const std::string &name)
|
84
|
+
{ columnBlockName_ = name;}
|
85
|
+
/// Pass in message handler
|
86
|
+
void setMessageHandler(CoinMessageHandler * handler);
|
87
|
+
//@}
|
88
|
+
|
89
|
+
protected:
|
90
|
+
/**@name Data members */
|
91
|
+
//@{
|
92
|
+
/// Current number of rows
|
93
|
+
int numberRows_;
|
94
|
+
/// Current number of columns
|
95
|
+
int numberColumns_;
|
96
|
+
/// Direction of optimization (1 - minimize, -1 - maximize, 0 - ignore
|
97
|
+
double optimizationDirection_;
|
98
|
+
/// Objective offset to be passed on
|
99
|
+
double objectiveOffset_;
|
100
|
+
/// Problem name
|
101
|
+
std::string problemName_;
|
102
|
+
/// Rowblock name
|
103
|
+
std::string rowBlockName_;
|
104
|
+
/// Columnblock name
|
105
|
+
std::string columnBlockName_;
|
106
|
+
/// Message handler (Passed in)
|
107
|
+
CoinMessageHandler * handler_;
|
108
|
+
/// Messages
|
109
|
+
CoinMessages messages_;
|
110
|
+
|
111
|
+
/** Print level.
|
112
|
+
I could have gone for full message handling but this should normally
|
113
|
+
be silent and lightweight.
|
114
|
+
-1 - use passed in message handler
|
115
|
+
0 - no output
|
116
|
+
1 - on errors
|
117
|
+
2 - more detailed
|
118
|
+
*/
|
119
|
+
int logLevel_;
|
120
|
+
//@}
|
121
|
+
/// data
|
122
|
+
|
123
|
+
};
|
124
|
+
|
125
|
+
/**
|
126
|
+
This is a simple minded model which is stored in a format which makes
|
127
|
+
it easier to construct and modify but not efficient for algorithms. It has
|
128
|
+
to be passed across to ClpModel or OsiSolverInterface by addRows, addCol(umn)s
|
129
|
+
or loadProblem.
|
130
|
+
|
131
|
+
It may have up to four parts -
|
132
|
+
1) A matrix of doubles (or strings - see note A)
|
133
|
+
2) Column information including integer information and names
|
134
|
+
3) Row information including names
|
135
|
+
4) Quadratic objective (not implemented - but see A)
|
136
|
+
|
137
|
+
This class is meant to make it more efficient to build a model. It is at
|
138
|
+
its most efficient when all additions are done as addRow or as addCol but
|
139
|
+
not mixed. If only 1 and 2 exist then solver.addColumns may be used to pass to solver,
|
140
|
+
if only 1 and 3 exist then solver.addRows may be used. Otherwise solver.loadProblem
|
141
|
+
must be used.
|
142
|
+
|
143
|
+
If addRows and addColumns are mixed or if individual elements are set then the
|
144
|
+
speed will drop to some extent and more memory will be used.
|
145
|
+
|
146
|
+
It is also possible to iterate over existing elements and to access columns and rows
|
147
|
+
by name. Again each of these use memory and cpu time. However memory is unlikely
|
148
|
+
to be critical as most algorithms will use much more.
|
149
|
+
|
150
|
+
Notes:
|
151
|
+
A) Although this could be used to pass nonlinear information around the
|
152
|
+
only use at present is to have named values e.g. value1 which can then be
|
153
|
+
set to a value after model is created. I have no idea whether that could
|
154
|
+
be useful but I thought it might be fun.
|
155
|
+
Quadratic terms are allowed in strings! A solver could try and use this
|
156
|
+
if so - the convention is that 0.5* quadratic is stored
|
157
|
+
|
158
|
+
B) This class could be useful for modeling.
|
159
|
+
*/
|
160
|
+
|
161
|
+
class CoinModel : public CoinBaseModel {
|
162
|
+
|
163
|
+
public:
|
164
|
+
/**@name Useful methods for building model */
|
165
|
+
//@{
|
166
|
+
/** add a row - numberInRow may be zero */
|
167
|
+
void addRow(int numberInRow, const int * columns,
|
168
|
+
const double * elements, double rowLower=-COIN_DBL_MAX,
|
169
|
+
double rowUpper=COIN_DBL_MAX, const char * name=NULL);
|
170
|
+
/// add a column - numberInColumn may be zero */
|
171
|
+
void addColumn(int numberInColumn, const int * rows,
|
172
|
+
const double * elements,
|
173
|
+
double columnLower=0.0,
|
174
|
+
double columnUpper=COIN_DBL_MAX, double objectiveValue=0.0,
|
175
|
+
const char * name=NULL, bool isInteger=false);
|
176
|
+
/// add a column - numberInColumn may be zero */
|
177
|
+
inline void addCol(int numberInColumn, const int * rows,
|
178
|
+
const double * elements,
|
179
|
+
double columnLower=0.0,
|
180
|
+
double columnUpper=COIN_DBL_MAX, double objectiveValue=0.0,
|
181
|
+
const char * name=NULL, bool isInteger=false)
|
182
|
+
{ addColumn(numberInColumn, rows, elements, columnLower, columnUpper, objectiveValue,
|
183
|
+
name,isInteger);}
|
184
|
+
/// Sets value for row i and column j
|
185
|
+
inline void operator() (int i,int j,double value)
|
186
|
+
{ setElement(i,j,value);}
|
187
|
+
/// Sets value for row i and column j
|
188
|
+
void setElement(int i,int j,double value) ;
|
189
|
+
/** Gets sorted row - user must provide enough space
|
190
|
+
(easiest is allocate number of columns).
|
191
|
+
If column or element NULL then just returns number
|
192
|
+
Returns number of elements
|
193
|
+
*/
|
194
|
+
int getRow(int whichRow, int * column, double * element);
|
195
|
+
/** Gets sorted column - user must provide enough space
|
196
|
+
(easiest is allocate number of rows).
|
197
|
+
If row or element NULL then just returns number
|
198
|
+
Returns number of elements
|
199
|
+
*/
|
200
|
+
int getColumn(int whichColumn, int * column, double * element);
|
201
|
+
/// Sets quadratic value for column i and j
|
202
|
+
void setQuadraticElement(int i,int j,double value) ;
|
203
|
+
/// Sets value for row i and column j as string
|
204
|
+
inline void operator() (int i,int j,const char * value)
|
205
|
+
{ setElement(i,j,value);}
|
206
|
+
/// Sets value for row i and column j as string
|
207
|
+
void setElement(int i,int j,const char * value) ;
|
208
|
+
/// Associates a string with a value. Returns string id (or -1 if does not exist)
|
209
|
+
int associateElement(const char * stringValue, double value);
|
210
|
+
/** Sets rowLower (if row does not exist then
|
211
|
+
all rows up to this are defined with default values and no elements)
|
212
|
+
*/
|
213
|
+
void setRowLower(int whichRow,double rowLower);
|
214
|
+
/** Sets rowUpper (if row does not exist then
|
215
|
+
all rows up to this are defined with default values and no elements)
|
216
|
+
*/
|
217
|
+
void setRowUpper(int whichRow,double rowUpper);
|
218
|
+
/** Sets rowLower and rowUpper (if row does not exist then
|
219
|
+
all rows up to this are defined with default values and no elements)
|
220
|
+
*/
|
221
|
+
void setRowBounds(int whichRow,double rowLower,double rowUpper);
|
222
|
+
/** Sets name (if row does not exist then
|
223
|
+
all rows up to this are defined with default values and no elements)
|
224
|
+
*/
|
225
|
+
void setRowName(int whichRow,const char * rowName);
|
226
|
+
/** Sets columnLower (if column does not exist then
|
227
|
+
all columns up to this are defined with default values and no elements)
|
228
|
+
*/
|
229
|
+
void setColumnLower(int whichColumn,double columnLower);
|
230
|
+
/** Sets columnUpper (if column does not exist then
|
231
|
+
all columns up to this are defined with default values and no elements)
|
232
|
+
*/
|
233
|
+
void setColumnUpper(int whichColumn,double columnUpper);
|
234
|
+
/** Sets columnLower and columnUpper (if column does not exist then
|
235
|
+
all columns up to this are defined with default values and no elements)
|
236
|
+
*/
|
237
|
+
void setColumnBounds(int whichColumn,double columnLower,double columnUpper);
|
238
|
+
/** Sets columnObjective (if column does not exist then
|
239
|
+
all columns up to this are defined with default values and no elements)
|
240
|
+
*/
|
241
|
+
void setColumnObjective(int whichColumn,double columnObjective);
|
242
|
+
/** Sets name (if column does not exist then
|
243
|
+
all columns up to this are defined with default values and no elements)
|
244
|
+
*/
|
245
|
+
void setColumnName(int whichColumn,const char * columnName);
|
246
|
+
/** Sets integer state (if column does not exist then
|
247
|
+
all columns up to this are defined with default values and no elements)
|
248
|
+
*/
|
249
|
+
void setColumnIsInteger(int whichColumn,bool columnIsInteger);
|
250
|
+
/** Sets columnObjective (if column does not exist then
|
251
|
+
all columns up to this are defined with default values and no elements)
|
252
|
+
*/
|
253
|
+
inline void setObjective(int whichColumn,double columnObjective)
|
254
|
+
{ setColumnObjective( whichColumn, columnObjective);}
|
255
|
+
/** Sets integer state (if column does not exist then
|
256
|
+
all columns up to this are defined with default values and no elements)
|
257
|
+
*/
|
258
|
+
inline void setIsInteger(int whichColumn,bool columnIsInteger)
|
259
|
+
{ setColumnIsInteger( whichColumn, columnIsInteger);}
|
260
|
+
/** Sets integer (if column does not exist then
|
261
|
+
all columns up to this are defined with default values and no elements)
|
262
|
+
*/
|
263
|
+
inline void setInteger(int whichColumn)
|
264
|
+
{ setColumnIsInteger( whichColumn, true);}
|
265
|
+
/** Sets continuous (if column does not exist then
|
266
|
+
all columns up to this are defined with default values and no elements)
|
267
|
+
*/
|
268
|
+
inline void setContinuous(int whichColumn)
|
269
|
+
{ setColumnIsInteger( whichColumn, false);}
|
270
|
+
/** Sets columnLower (if column does not exist then
|
271
|
+
all columns up to this are defined with default values and no elements)
|
272
|
+
*/
|
273
|
+
inline void setColLower(int whichColumn,double columnLower)
|
274
|
+
{ setColumnLower( whichColumn, columnLower);}
|
275
|
+
/** Sets columnUpper (if column does not exist then
|
276
|
+
all columns up to this are defined with default values and no elements)
|
277
|
+
*/
|
278
|
+
inline void setColUpper(int whichColumn,double columnUpper)
|
279
|
+
{ setColumnUpper( whichColumn, columnUpper);}
|
280
|
+
/** Sets columnLower and columnUpper (if column does not exist then
|
281
|
+
all columns up to this are defined with default values and no elements)
|
282
|
+
*/
|
283
|
+
inline void setColBounds(int whichColumn,double columnLower,double columnUpper)
|
284
|
+
{ setColumnBounds( whichColumn, columnLower, columnUpper);}
|
285
|
+
/** Sets columnObjective (if column does not exist then
|
286
|
+
all columns up to this are defined with default values and no elements)
|
287
|
+
*/
|
288
|
+
inline void setColObjective(int whichColumn,double columnObjective)
|
289
|
+
{ setColumnObjective( whichColumn, columnObjective);}
|
290
|
+
/** Sets name (if column does not exist then
|
291
|
+
all columns up to this are defined with default values and no elements)
|
292
|
+
*/
|
293
|
+
inline void setColName(int whichColumn,const char * columnName)
|
294
|
+
{ setColumnName( whichColumn, columnName);}
|
295
|
+
/** Sets integer (if column does not exist then
|
296
|
+
all columns up to this are defined with default values and no elements)
|
297
|
+
*/
|
298
|
+
inline void setColIsInteger(int whichColumn,bool columnIsInteger)
|
299
|
+
{ setColumnIsInteger( whichColumn, columnIsInteger);}
|
300
|
+
/** Sets rowLower (if row does not exist then
|
301
|
+
all rows up to this are defined with default values and no elements)
|
302
|
+
*/
|
303
|
+
void setRowLower(int whichRow,const char * rowLower);
|
304
|
+
/** Sets rowUpper (if row does not exist then
|
305
|
+
all rows up to this are defined with default values and no elements)
|
306
|
+
*/
|
307
|
+
void setRowUpper(int whichRow,const char * rowUpper);
|
308
|
+
/** Sets columnLower (if column does not exist then
|
309
|
+
all columns up to this are defined with default values and no elements)
|
310
|
+
*/
|
311
|
+
void setColumnLower(int whichColumn,const char * columnLower);
|
312
|
+
/** Sets columnUpper (if column does not exist then
|
313
|
+
all columns up to this are defined with default values and no elements)
|
314
|
+
*/
|
315
|
+
void setColumnUpper(int whichColumn,const char * columnUpper);
|
316
|
+
/** Sets columnObjective (if column does not exist then
|
317
|
+
all columns up to this are defined with default values and no elements)
|
318
|
+
*/
|
319
|
+
void setColumnObjective(int whichColumn,const char * columnObjective);
|
320
|
+
/** Sets integer (if column does not exist then
|
321
|
+
all columns up to this are defined with default values and no elements)
|
322
|
+
*/
|
323
|
+
void setColumnIsInteger(int whichColumn,const char * columnIsInteger);
|
324
|
+
/** Sets columnObjective (if column does not exist then
|
325
|
+
all columns up to this are defined with default values and no elements)
|
326
|
+
*/
|
327
|
+
inline void setObjective(int whichColumn,const char * columnObjective)
|
328
|
+
{ setColumnObjective( whichColumn, columnObjective);}
|
329
|
+
/** Sets integer (if column does not exist then
|
330
|
+
all columns up to this are defined with default values and no elements)
|
331
|
+
*/
|
332
|
+
inline void setIsInteger(int whichColumn,const char * columnIsInteger)
|
333
|
+
{ setColumnIsInteger( whichColumn, columnIsInteger);}
|
334
|
+
/** Deletes all entries in row and bounds. Will be ignored by
|
335
|
+
writeMps etc and will be packed down if asked for. */
|
336
|
+
void deleteRow(int whichRow);
|
337
|
+
/** Deletes all entries in column and bounds and objective. Will be ignored by
|
338
|
+
writeMps etc and will be packed down if asked for. */
|
339
|
+
void deleteColumn(int whichColumn);
|
340
|
+
/** Deletes all entries in column and bounds. If last column the number of columns
|
341
|
+
will be decremented and true returned. */
|
342
|
+
inline void deleteCol(int whichColumn)
|
343
|
+
{ deleteColumn(whichColumn);}
|
344
|
+
/// Takes element out of matrix - returning position (<0 if not there);
|
345
|
+
int deleteElement(int row, int column);
|
346
|
+
/// Takes element out of matrix when position known
|
347
|
+
void deleteThisElement(int row, int column,int position);
|
348
|
+
/** Packs down all rows i.e. removes empty rows permanently. Empty rows
|
349
|
+
have no elements and feasible bounds. returns number of rows deleted. */
|
350
|
+
int packRows();
|
351
|
+
/** Packs down all columns i.e. removes empty columns permanently. Empty columns
|
352
|
+
have no elements and no objective. returns number of columns deleted. */
|
353
|
+
int packColumns();
|
354
|
+
/** Packs down all columns i.e. removes empty columns permanently. Empty columns
|
355
|
+
have no elements and no objective. returns number of columns deleted. */
|
356
|
+
inline int packCols()
|
357
|
+
{ return packColumns();}
|
358
|
+
/** Packs down all rows and columns. i.e. removes empty rows and columns permanently.
|
359
|
+
Empty rows have no elements and feasible bounds.
|
360
|
+
Empty columns have no elements and no objective.
|
361
|
+
returns number of rows+columns deleted. */
|
362
|
+
int pack();
|
363
|
+
|
364
|
+
/** Sets columnObjective array
|
365
|
+
*/
|
366
|
+
void setObjective(int numberColumns,const double * objective) ;
|
367
|
+
/** Sets columnLower array
|
368
|
+
*/
|
369
|
+
void setColumnLower(int numberColumns,const double * columnLower);
|
370
|
+
/** Sets columnLower array
|
371
|
+
*/
|
372
|
+
inline void setColLower(int numberColumns,const double * columnLower)
|
373
|
+
{ setColumnLower( numberColumns, columnLower);}
|
374
|
+
/** Sets columnUpper array
|
375
|
+
*/
|
376
|
+
void setColumnUpper(int numberColumns,const double * columnUpper);
|
377
|
+
/** Sets columnUpper array
|
378
|
+
*/
|
379
|
+
inline void setColUpper(int numberColumns,const double * columnUpper)
|
380
|
+
{ setColumnUpper( numberColumns, columnUpper);}
|
381
|
+
/** Sets rowLower array
|
382
|
+
*/
|
383
|
+
void setRowLower(int numberRows,const double * rowLower);
|
384
|
+
/** Sets rowUpper array
|
385
|
+
*/
|
386
|
+
void setRowUpper(int numberRows,const double * rowUpper);
|
387
|
+
|
388
|
+
/** Write the problem in MPS format to a file with the given filename.
|
389
|
+
|
390
|
+
\param compression can be set to three values to indicate what kind
|
391
|
+
of file should be written
|
392
|
+
<ul>
|
393
|
+
<li> 0: plain text (default)
|
394
|
+
<li> 1: gzip compressed (.gz is appended to \c filename)
|
395
|
+
<li> 2: bzip2 compressed (.bz2 is appended to \c filename) (TODO)
|
396
|
+
</ul>
|
397
|
+
If the library was not compiled with the requested compression then
|
398
|
+
writeMps falls back to writing a plain text file.
|
399
|
+
|
400
|
+
\param formatType specifies the precision to used for values in the
|
401
|
+
MPS file
|
402
|
+
<ul>
|
403
|
+
<li> 0: normal precision (default)
|
404
|
+
<li> 1: extra accuracy
|
405
|
+
<li> 2: IEEE hex
|
406
|
+
</ul>
|
407
|
+
|
408
|
+
\param numberAcross specifies whether 1 or 2 (default) values should be
|
409
|
+
specified on every data line in the MPS file.
|
410
|
+
|
411
|
+
not const as may change model e.g. fill in default bounds
|
412
|
+
*/
|
413
|
+
int writeMps(const char *filename, int compression = 0,
|
414
|
+
int formatType = 0, int numberAcross = 2, bool keepStrings=false) ;
|
415
|
+
|
416
|
+
/** Check two models against each other. Return nonzero if different.
|
417
|
+
Ignore names if that set.
|
418
|
+
May modify both models by cleaning up
|
419
|
+
*/
|
420
|
+
int differentModel(CoinModel & other, bool ignoreNames);
|
421
|
+
//@}
|
422
|
+
|
423
|
+
|
424
|
+
/**@name For structured models */
|
425
|
+
//@{
|
426
|
+
/// Pass in CoinPackedMatrix (and switch off element updates)
|
427
|
+
void passInMatrix(const CoinPackedMatrix & matrix);
|
428
|
+
/** Convert elements to CoinPackedMatrix (and switch off element updates).
|
429
|
+
Returns number of errors */
|
430
|
+
int convertMatrix();
|
431
|
+
/// Return a pointer to CoinPackedMatrix (or NULL)
|
432
|
+
inline const CoinPackedMatrix * packedMatrix() const
|
433
|
+
{ return packedMatrix_;}
|
434
|
+
/// Return pointers to original rows (for decomposition)
|
435
|
+
inline const int * originalRows() const
|
436
|
+
{ return rowType_;}
|
437
|
+
/// Return pointers to original columns (for decomposition)
|
438
|
+
inline const int * originalColumns() const
|
439
|
+
{ return columnType_;}
|
440
|
+
//@}
|
441
|
+
|
442
|
+
|
443
|
+
/**@name For getting information */
|
444
|
+
//@{
|
445
|
+
/// Return number of elements
|
446
|
+
inline CoinBigIndex numberElements() const
|
447
|
+
{ return numberElements_;}
|
448
|
+
/// Return elements as triples
|
449
|
+
inline const CoinModelTriple * elements() const
|
450
|
+
{ return elements_;}
|
451
|
+
/// Returns value for row i and column j
|
452
|
+
inline double operator() (int i,int j) const
|
453
|
+
{ return getElement(i,j);}
|
454
|
+
/// Returns value for row i and column j
|
455
|
+
double getElement(int i,int j) const;
|
456
|
+
/// Returns value for row rowName and column columnName
|
457
|
+
inline double operator() (const char * rowName,const char * columnName) const
|
458
|
+
{ return getElement(rowName,columnName);}
|
459
|
+
/// Returns value for row rowName and column columnName
|
460
|
+
double getElement(const char * rowName,const char * columnName) const;
|
461
|
+
/// Returns quadratic value for columns i and j
|
462
|
+
double getQuadraticElement(int i,int j) const;
|
463
|
+
/** Returns value for row i and column j as string.
|
464
|
+
Returns NULL if does not exist.
|
465
|
+
Returns "Numeric" if not a string
|
466
|
+
*/
|
467
|
+
const char * getElementAsString(int i,int j) const;
|
468
|
+
/** Returns pointer to element for row i column j.
|
469
|
+
Only valid until next modification.
|
470
|
+
NULL if element does not exist */
|
471
|
+
double * pointer (int i,int j) const;
|
472
|
+
/** Returns position in elements for row i column j.
|
473
|
+
Only valid until next modification.
|
474
|
+
-1 if element does not exist */
|
475
|
+
int position (int i,int j) const;
|
476
|
+
|
477
|
+
|
478
|
+
/** Returns first element in given row - index is -1 if none.
|
479
|
+
Index is given by .index and value by .value
|
480
|
+
*/
|
481
|
+
CoinModelLink firstInRow(int whichRow) const ;
|
482
|
+
/** Returns last element in given row - index is -1 if none.
|
483
|
+
Index is given by .index and value by .value
|
484
|
+
*/
|
485
|
+
CoinModelLink lastInRow(int whichRow) const ;
|
486
|
+
/** Returns first element in given column - index is -1 if none.
|
487
|
+
Index is given by .index and value by .value
|
488
|
+
*/
|
489
|
+
CoinModelLink firstInColumn(int whichColumn) const ;
|
490
|
+
/** Returns last element in given column - index is -1 if none.
|
491
|
+
Index is given by .index and value by .value
|
492
|
+
*/
|
493
|
+
CoinModelLink lastInColumn(int whichColumn) const ;
|
494
|
+
/** Returns next element in current row or column - index is -1 if none.
|
495
|
+
Index is given by .index and value by .value.
|
496
|
+
User could also tell because input.next would be NULL
|
497
|
+
*/
|
498
|
+
CoinModelLink next(CoinModelLink & current) const ;
|
499
|
+
/** Returns previous element in current row or column - index is -1 if none.
|
500
|
+
Index is given by .index and value by .value.
|
501
|
+
User could also tell because input.previous would be NULL
|
502
|
+
May not be correct if matrix updated.
|
503
|
+
*/
|
504
|
+
CoinModelLink previous(CoinModelLink & current) const ;
|
505
|
+
/** Returns first element in given quadratic column - index is -1 if none.
|
506
|
+
Index is given by .index and value by .value
|
507
|
+
May not be correct if matrix updated.
|
508
|
+
*/
|
509
|
+
CoinModelLink firstInQuadraticColumn(int whichColumn) const ;
|
510
|
+
/** Returns last element in given quadratic column - index is -1 if none.
|
511
|
+
Index is given by .index and value by .value
|
512
|
+
*/
|
513
|
+
CoinModelLink lastInQuadraticColumn(int whichColumn) const ;
|
514
|
+
/** Gets rowLower (if row does not exist then -COIN_DBL_MAX)
|
515
|
+
*/
|
516
|
+
double getRowLower(int whichRow) const ;
|
517
|
+
/** Gets rowUpper (if row does not exist then +COIN_DBL_MAX)
|
518
|
+
*/
|
519
|
+
double getRowUpper(int whichRow) const ;
|
520
|
+
/** Gets name (if row does not exist then NULL)
|
521
|
+
*/
|
522
|
+
const char * getRowName(int whichRow) const ;
|
523
|
+
inline double rowLower(int whichRow) const
|
524
|
+
{ return getRowLower(whichRow);}
|
525
|
+
/** Gets rowUpper (if row does not exist then COIN_DBL_MAX)
|
526
|
+
*/
|
527
|
+
inline double rowUpper(int whichRow) const
|
528
|
+
{ return getRowUpper(whichRow) ;}
|
529
|
+
/** Gets name (if row does not exist then NULL)
|
530
|
+
*/
|
531
|
+
inline const char * rowName(int whichRow) const
|
532
|
+
{ return getRowName(whichRow);}
|
533
|
+
/** Gets columnLower (if column does not exist then 0.0)
|
534
|
+
*/
|
535
|
+
double getColumnLower(int whichColumn) const ;
|
536
|
+
/** Gets columnUpper (if column does not exist then COIN_DBL_MAX)
|
537
|
+
*/
|
538
|
+
double getColumnUpper(int whichColumn) const ;
|
539
|
+
/** Gets columnObjective (if column does not exist then 0.0)
|
540
|
+
*/
|
541
|
+
double getColumnObjective(int whichColumn) const ;
|
542
|
+
/** Gets name (if column does not exist then NULL)
|
543
|
+
*/
|
544
|
+
const char * getColumnName(int whichColumn) const ;
|
545
|
+
/** Gets if integer (if column does not exist then false)
|
546
|
+
*/
|
547
|
+
bool getColumnIsInteger(int whichColumn) const ;
|
548
|
+
/** Gets columnLower (if column does not exist then 0.0)
|
549
|
+
*/
|
550
|
+
inline double columnLower(int whichColumn) const
|
551
|
+
{ return getColumnLower(whichColumn);}
|
552
|
+
/** Gets columnUpper (if column does not exist then COIN_DBL_MAX)
|
553
|
+
*/
|
554
|
+
inline double columnUpper(int whichColumn) const
|
555
|
+
{ return getColumnUpper(whichColumn) ;}
|
556
|
+
/** Gets columnObjective (if column does not exist then 0.0)
|
557
|
+
*/
|
558
|
+
inline double columnObjective(int whichColumn) const
|
559
|
+
{ return getColumnObjective(whichColumn);}
|
560
|
+
/** Gets columnObjective (if column does not exist then 0.0)
|
561
|
+
*/
|
562
|
+
inline double objective(int whichColumn) const
|
563
|
+
{ return getColumnObjective(whichColumn);}
|
564
|
+
/** Gets name (if column does not exist then NULL)
|
565
|
+
*/
|
566
|
+
inline const char * columnName(int whichColumn) const
|
567
|
+
{ return getColumnName(whichColumn);}
|
568
|
+
/** Gets if integer (if column does not exist then false)
|
569
|
+
*/
|
570
|
+
inline bool columnIsInteger(int whichColumn) const
|
571
|
+
{ return getColumnIsInteger(whichColumn);}
|
572
|
+
/** Gets if integer (if column does not exist then false)
|
573
|
+
*/
|
574
|
+
inline bool isInteger(int whichColumn) const
|
575
|
+
{ return getColumnIsInteger(whichColumn);}
|
576
|
+
/** Gets columnLower (if column does not exist then 0.0)
|
577
|
+
*/
|
578
|
+
inline double getColLower(int whichColumn) const
|
579
|
+
{ return getColumnLower(whichColumn);}
|
580
|
+
/** Gets columnUpper (if column does not exist then COIN_DBL_MAX)
|
581
|
+
*/
|
582
|
+
inline double getColUpper(int whichColumn) const
|
583
|
+
{ return getColumnUpper(whichColumn) ;}
|
584
|
+
/** Gets columnObjective (if column does not exist then 0.0)
|
585
|
+
*/
|
586
|
+
inline double getColObjective(int whichColumn) const
|
587
|
+
{ return getColumnObjective(whichColumn);}
|
588
|
+
/** Gets name (if column does not exist then NULL)
|
589
|
+
*/
|
590
|
+
inline const char * getColName(int whichColumn) const
|
591
|
+
{ return getColumnName(whichColumn);}
|
592
|
+
/** Gets if integer (if column does not exist then false)
|
593
|
+
*/
|
594
|
+
inline bool getColIsInteger(int whichColumn) const
|
595
|
+
{ return getColumnIsInteger(whichColumn);}
|
596
|
+
/** Gets rowLower (if row does not exist then -COIN_DBL_MAX)
|
597
|
+
*/
|
598
|
+
const char * getRowLowerAsString(int whichRow) const ;
|
599
|
+
/** Gets rowUpper (if row does not exist then +COIN_DBL_MAX)
|
600
|
+
*/
|
601
|
+
const char * getRowUpperAsString(int whichRow) const ;
|
602
|
+
inline const char * rowLowerAsString(int whichRow) const
|
603
|
+
{ return getRowLowerAsString(whichRow);}
|
604
|
+
/** Gets rowUpper (if row does not exist then COIN_DBL_MAX)
|
605
|
+
*/
|
606
|
+
inline const char * rowUpperAsString(int whichRow) const
|
607
|
+
{ return getRowUpperAsString(whichRow) ;}
|
608
|
+
/** Gets columnLower (if column does not exist then 0.0)
|
609
|
+
*/
|
610
|
+
const char * getColumnLowerAsString(int whichColumn) const ;
|
611
|
+
/** Gets columnUpper (if column does not exist then COIN_DBL_MAX)
|
612
|
+
*/
|
613
|
+
const char * getColumnUpperAsString(int whichColumn) const ;
|
614
|
+
/** Gets columnObjective (if column does not exist then 0.0)
|
615
|
+
*/
|
616
|
+
const char * getColumnObjectiveAsString(int whichColumn) const ;
|
617
|
+
/** Gets if integer (if column does not exist then false)
|
618
|
+
*/
|
619
|
+
const char * getColumnIsIntegerAsString(int whichColumn) const ;
|
620
|
+
/** Gets columnLower (if column does not exist then 0.0)
|
621
|
+
*/
|
622
|
+
inline const char * columnLowerAsString(int whichColumn) const
|
623
|
+
{ return getColumnLowerAsString(whichColumn);}
|
624
|
+
/** Gets columnUpper (if column does not exist then COIN_DBL_MAX)
|
625
|
+
*/
|
626
|
+
inline const char * columnUpperAsString(int whichColumn) const
|
627
|
+
{ return getColumnUpperAsString(whichColumn) ;}
|
628
|
+
/** Gets columnObjective (if column does not exist then 0.0)
|
629
|
+
*/
|
630
|
+
inline const char * columnObjectiveAsString(int whichColumn) const
|
631
|
+
{ return getColumnObjectiveAsString(whichColumn);}
|
632
|
+
/** Gets columnObjective (if column does not exist then 0.0)
|
633
|
+
*/
|
634
|
+
inline const char * objectiveAsString(int whichColumn) const
|
635
|
+
{ return getColumnObjectiveAsString(whichColumn);}
|
636
|
+
/** Gets if integer (if column does not exist then false)
|
637
|
+
*/
|
638
|
+
inline const char * columnIsIntegerAsString(int whichColumn) const
|
639
|
+
{ return getColumnIsIntegerAsString(whichColumn);}
|
640
|
+
/** Gets if integer (if column does not exist then false)
|
641
|
+
*/
|
642
|
+
inline const char * isIntegerAsString(int whichColumn) const
|
643
|
+
{ return getColumnIsIntegerAsString(whichColumn);}
|
644
|
+
/// Row index from row name (-1 if no names or no match)
|
645
|
+
int row(const char * rowName) const;
|
646
|
+
/// Column index from column name (-1 if no names or no match)
|
647
|
+
int column(const char * columnName) const;
|
648
|
+
/// Returns type
|
649
|
+
inline int type() const
|
650
|
+
{ return type_;}
|
651
|
+
/// returns unset value
|
652
|
+
inline double unsetValue() const
|
653
|
+
{ return -1.23456787654321e-97;}
|
654
|
+
/// Creates a packed matrix - return number of errors
|
655
|
+
int createPackedMatrix(CoinPackedMatrix & matrix,
|
656
|
+
const double * associated);
|
657
|
+
/** Fills in startPositive and startNegative with counts for +-1 matrix.
|
658
|
+
If not +-1 then startPositive[0]==-1 otherwise counts and
|
659
|
+
startPositive[numberColumns]== size
|
660
|
+
- return number of errors
|
661
|
+
*/
|
662
|
+
int countPlusMinusOne(CoinBigIndex * startPositive, CoinBigIndex * startNegative,
|
663
|
+
const double * associated);
|
664
|
+
/** Creates +-1 matrix given startPositive and startNegative counts for +-1 matrix.
|
665
|
+
*/
|
666
|
+
void createPlusMinusOne(CoinBigIndex * startPositive, CoinBigIndex * startNegative,
|
667
|
+
int * indices,
|
668
|
+
const double * associated);
|
669
|
+
/// Creates copies of various arrays - return number of errors
|
670
|
+
int createArrays(double * & rowLower, double * & rowUpper,
|
671
|
+
double * & columnLower, double * & columnUpper,
|
672
|
+
double * & objective, int * & integerType,
|
673
|
+
double * & associated);
|
674
|
+
/// Says if strings exist
|
675
|
+
inline bool stringsExist() const
|
676
|
+
{ return string_.numberItems()!=0;}
|
677
|
+
/// Return string array
|
678
|
+
inline const CoinModelHash * stringArray() const
|
679
|
+
{ return &string_;}
|
680
|
+
/// Returns associated array
|
681
|
+
inline double * associatedArray() const
|
682
|
+
{ return associated_;}
|
683
|
+
/// Return rowLower array
|
684
|
+
inline double * rowLowerArray() const
|
685
|
+
{ return rowLower_;}
|
686
|
+
/// Return rowUpper array
|
687
|
+
inline double * rowUpperArray() const
|
688
|
+
{ return rowUpper_;}
|
689
|
+
/// Return columnLower array
|
690
|
+
inline double * columnLowerArray() const
|
691
|
+
{ return columnLower_;}
|
692
|
+
/// Return columnUpper array
|
693
|
+
inline double * columnUpperArray() const
|
694
|
+
{ return columnUpper_;}
|
695
|
+
/// Return objective array
|
696
|
+
inline double * objectiveArray() const
|
697
|
+
{ return objective_;}
|
698
|
+
/// Return integerType array
|
699
|
+
inline int * integerTypeArray() const
|
700
|
+
{ return integerType_;}
|
701
|
+
/// Return row names array
|
702
|
+
inline const CoinModelHash * rowNames() const
|
703
|
+
{ return &rowName_;}
|
704
|
+
/// Return column names array
|
705
|
+
inline const CoinModelHash * columnNames() const
|
706
|
+
{ return &columnName_;}
|
707
|
+
/// Reset row names
|
708
|
+
inline void zapRowNames()
|
709
|
+
{ rowName_=CoinModelHash();}
|
710
|
+
/// Reset column names
|
711
|
+
inline void zapColumnNames()
|
712
|
+
{ columnName_=CoinModelHash();}
|
713
|
+
/// Returns array of 0 or nonzero if can be a cut (or returns NULL)
|
714
|
+
inline const int * cutMarker() const
|
715
|
+
{ return cut_;}
|
716
|
+
/// Direction of optimization (1 - minimize, -1 - maximize, 0 - ignore
|
717
|
+
inline double optimizationDirection() const {
|
718
|
+
return optimizationDirection_;
|
719
|
+
}
|
720
|
+
/// Set direction of optimization (1 - minimize, -1 - maximize, 0 - ignore
|
721
|
+
inline void setOptimizationDirection(double value)
|
722
|
+
{ optimizationDirection_=value;}
|
723
|
+
/// Return pointer to more information
|
724
|
+
inline void * moreInfo() const
|
725
|
+
{ return moreInfo_;}
|
726
|
+
/// Set pointer to more information
|
727
|
+
inline void setMoreInfo(void * info)
|
728
|
+
{ moreInfo_ = info;}
|
729
|
+
/** Returns which parts of model are set
|
730
|
+
1 - matrix
|
731
|
+
2 - rhs
|
732
|
+
4 - row names
|
733
|
+
8 - column bounds and/or objective
|
734
|
+
16 - column names
|
735
|
+
32 - integer types
|
736
|
+
*/
|
737
|
+
int whatIsSet() const;
|
738
|
+
//@}
|
739
|
+
|
740
|
+
/**@name for block models - matrix will be CoinPackedMatrix */
|
741
|
+
//@{
|
742
|
+
/*! \brief Load in a problem by copying the arguments. The constraints on
|
743
|
+
the rows are given by lower and upper bounds.
|
744
|
+
|
745
|
+
If a pointer is 0 then the following values are the default:
|
746
|
+
<ul>
|
747
|
+
<li> <code>colub</code>: all columns have upper bound infinity
|
748
|
+
<li> <code>collb</code>: all columns have lower bound 0
|
749
|
+
<li> <code>rowub</code>: all rows have upper bound infinity
|
750
|
+
<li> <code>rowlb</code>: all rows have lower bound -infinity
|
751
|
+
<li> <code>obj</code>: all variables have 0 objective coefficient
|
752
|
+
</ul>
|
753
|
+
|
754
|
+
Note that the default values for rowub and rowlb produce the
|
755
|
+
constraint -infty <= ax <= infty. This is probably not what you want.
|
756
|
+
*/
|
757
|
+
void loadBlock (const CoinPackedMatrix& matrix,
|
758
|
+
const double* collb, const double* colub,
|
759
|
+
const double* obj,
|
760
|
+
const double* rowlb, const double* rowub) ;
|
761
|
+
/*! \brief Load in a problem by copying the arguments.
|
762
|
+
The constraints on the rows are given by sense/rhs/range triplets.
|
763
|
+
|
764
|
+
If a pointer is 0 then the following values are the default:
|
765
|
+
<ul>
|
766
|
+
<li> <code>colub</code>: all columns have upper bound infinity
|
767
|
+
<li> <code>collb</code>: all columns have lower bound 0
|
768
|
+
<li> <code>obj</code>: all variables have 0 objective coefficient
|
769
|
+
<li> <code>rowsen</code>: all rows are >=
|
770
|
+
<li> <code>rowrhs</code>: all right hand sides are 0
|
771
|
+
<li> <code>rowrng</code>: 0 for the ranged rows
|
772
|
+
</ul>
|
773
|
+
|
774
|
+
Note that the default values for rowsen, rowrhs, and rowrng produce the
|
775
|
+
constraint ax >= 0.
|
776
|
+
*/
|
777
|
+
void loadBlock (const CoinPackedMatrix& matrix,
|
778
|
+
const double* collb, const double* colub,
|
779
|
+
const double* obj,
|
780
|
+
const char* rowsen, const double* rowrhs,
|
781
|
+
const double* rowrng) ;
|
782
|
+
|
783
|
+
/*! \brief Load in a problem by copying the arguments. The constraint
|
784
|
+
matrix is is specified with standard column-major
|
785
|
+
column starts / row indices / coefficients vectors.
|
786
|
+
The constraints on the rows are given by lower and upper bounds.
|
787
|
+
|
788
|
+
The matrix vectors must be gap-free. Note that <code>start</code> must
|
789
|
+
have <code>numcols+1</code> entries so that the length of the last column
|
790
|
+
can be calculated as <code>start[numcols]-start[numcols-1]</code>.
|
791
|
+
|
792
|
+
See the previous loadBlock method using rowlb and rowub for default
|
793
|
+
argument values.
|
794
|
+
*/
|
795
|
+
void loadBlock (const int numcols, const int numrows,
|
796
|
+
const CoinBigIndex * start, const int* index,
|
797
|
+
const double* value,
|
798
|
+
const double* collb, const double* colub,
|
799
|
+
const double* obj,
|
800
|
+
const double* rowlb, const double* rowub) ;
|
801
|
+
|
802
|
+
/*! \brief Load in a problem by copying the arguments. The constraint
|
803
|
+
matrix is is specified with standard column-major
|
804
|
+
column starts / row indices / coefficients vectors.
|
805
|
+
The constraints on the rows are given by sense/rhs/range triplets.
|
806
|
+
|
807
|
+
The matrix vectors must be gap-free. Note that <code>start</code> must
|
808
|
+
have <code>numcols+1</code> entries so that the length of the last column
|
809
|
+
can be calculated as <code>start[numcols]-start[numcols-1]</code>.
|
810
|
+
|
811
|
+
See the previous loadBlock method using sense/rhs/range for default
|
812
|
+
argument values.
|
813
|
+
*/
|
814
|
+
void loadBlock (const int numcols, const int numrows,
|
815
|
+
const CoinBigIndex * start, const int* index,
|
816
|
+
const double* value,
|
817
|
+
const double* collb, const double* colub,
|
818
|
+
const double* obj,
|
819
|
+
const char* rowsen, const double* rowrhs,
|
820
|
+
const double* rowrng) ;
|
821
|
+
|
822
|
+
//@}
|
823
|
+
|
824
|
+
/**@name Constructors, destructor */
|
825
|
+
//@{
|
826
|
+
/** Default constructor. */
|
827
|
+
CoinModel();
|
828
|
+
/** Constructor with sizes. */
|
829
|
+
CoinModel(int firstRows, int firstColumns, int firstElements,bool noNames=false);
|
830
|
+
/** Read a problem in MPS or GAMS format from the given filename.
|
831
|
+
*/
|
832
|
+
CoinModel(const char *fileName, int allowStrings=0);
|
833
|
+
/** Read a problem from AMPL nl file
|
834
|
+
NOTE - as I can't work out configure etc the source code is in Cbc_ampl.cpp!
|
835
|
+
*/
|
836
|
+
CoinModel( int nonLinear, const char * fileName,const void * info);
|
837
|
+
/// From arrays
|
838
|
+
CoinModel(int numberRows, int numberColumns,
|
839
|
+
const CoinPackedMatrix * matrix,
|
840
|
+
const double * rowLower, const double * rowUpper,
|
841
|
+
const double * columnLower, const double * columnUpper,
|
842
|
+
const double * objective);
|
843
|
+
/// Clone
|
844
|
+
virtual CoinBaseModel * clone() const;
|
845
|
+
|
846
|
+
/** Destructor */
|
847
|
+
virtual ~CoinModel();
|
848
|
+
//@}
|
849
|
+
|
850
|
+
/**@name Copy method */
|
851
|
+
//@{
|
852
|
+
/** The copy constructor. */
|
853
|
+
CoinModel(const CoinModel&);
|
854
|
+
/// =
|
855
|
+
CoinModel& operator=(const CoinModel&);
|
856
|
+
//@}
|
857
|
+
|
858
|
+
/**@name For debug */
|
859
|
+
//@{
|
860
|
+
/// Checks that links are consistent
|
861
|
+
void validateLinks() const;
|
862
|
+
//@}
|
863
|
+
private:
|
864
|
+
/// Resize
|
865
|
+
void resize(int maximumRows, int maximumColumns, int maximumElements);
|
866
|
+
/// Fill in default row information
|
867
|
+
void fillRows(int which,bool forceCreation,bool fromAddRow=false);
|
868
|
+
/// Fill in default column information
|
869
|
+
void fillColumns(int which,bool forceCreation,bool fromAddColumn=false);
|
870
|
+
/** Fill in default linked list information (1= row, 2 = column)
|
871
|
+
Marked as const as list is mutable */
|
872
|
+
void fillList(int which, CoinModelLinkedList & list,int type) const ;
|
873
|
+
/** Create a linked list and synchronize free
|
874
|
+
type 1 for row 2 for column
|
875
|
+
Marked as const as list is mutable */
|
876
|
+
void createList(int type) const;
|
877
|
+
/// Adds one string, returns index
|
878
|
+
int addString(const char * string);
|
879
|
+
/** Gets a double from a string possibly containing named strings,
|
880
|
+
returns unset if not found
|
881
|
+
*/
|
882
|
+
double getDoubleFromString(CoinYacc & info, const char * string);
|
883
|
+
/// Frees value memory
|
884
|
+
void freeStringMemory(CoinYacc & info);
|
885
|
+
public:
|
886
|
+
/// Fills in all associated - returning number of errors
|
887
|
+
int computeAssociated(double * associated);
|
888
|
+
/** Gets correct form for a quadratic row - user to delete
|
889
|
+
If row is not quadratic then returns which other variables are involved
|
890
|
+
with tiny (1.0e-100) elements and count of total number of variables which could not
|
891
|
+
be put in quadratic form
|
892
|
+
*/
|
893
|
+
CoinPackedMatrix * quadraticRow(int rowNumber,double * linear,
|
894
|
+
int & numberBad) const;
|
895
|
+
/// Replaces a quadratic row
|
896
|
+
void replaceQuadraticRow(int rowNumber,const double * linear, const CoinPackedMatrix * quadraticPart);
|
897
|
+
/** If possible return a model where if all variables marked nonzero are fixed
|
898
|
+
the problem will be linear. At present may only work if quadratic.
|
899
|
+
Returns NULL if not possible
|
900
|
+
*/
|
901
|
+
CoinModel * reorder(const char * mark) const;
|
902
|
+
/** Expands out all possible combinations for a knapsack
|
903
|
+
If buildObj NULL then just computes space needed - returns number elements
|
904
|
+
On entry numberOutput is maximum allowed, on exit it is number needed or
|
905
|
+
-1 (as will be number elements) if maximum exceeded. numberOutput will have at
|
906
|
+
least space to return values which reconstruct input.
|
907
|
+
Rows returned will be original rows but no entries will be returned for
|
908
|
+
any rows all of whose entries are in knapsack. So up to user to allow for this.
|
909
|
+
If reConstruct >=0 then returns number of entrie which make up item "reConstruct"
|
910
|
+
in expanded knapsack. Values in buildRow and buildElement;
|
911
|
+
*/
|
912
|
+
int expandKnapsack(int knapsackRow, int & numberOutput,double * buildObj, CoinBigIndex * buildStart,
|
913
|
+
int * buildRow, double * buildElement,int reConstruct=-1) const;
|
914
|
+
/// Sets cut marker array
|
915
|
+
void setCutMarker(int size,const int * marker);
|
916
|
+
/// Sets priority array
|
917
|
+
void setPriorities(int size,const int * priorities);
|
918
|
+
/// priorities (given for all columns (-1 if not integer)
|
919
|
+
inline const int * priorities() const
|
920
|
+
{ return priority_;}
|
921
|
+
/// For decomposition set original row and column indices
|
922
|
+
void setOriginalIndices(const int * row, const int * column);
|
923
|
+
|
924
|
+
private:
|
925
|
+
/** Read a problem from AMPL nl file
|
926
|
+
so not constructor so gdb will work
|
927
|
+
*/
|
928
|
+
void gdb( int nonLinear, const char * fileName, const void * info);
|
929
|
+
/// returns jColumn (-2 if linear term, -1 if unknown) and coefficient
|
930
|
+
int decodeBit(char * phrase, char * & nextPhrase, double & coefficient, bool ifFirst) const;
|
931
|
+
/// Aborts with message about packedMatrix
|
932
|
+
void badType() const;
|
933
|
+
/**@name Data members */
|
934
|
+
//@{
|
935
|
+
/// Maximum number of rows
|
936
|
+
int maximumRows_;
|
937
|
+
/// Maximum number of columns
|
938
|
+
int maximumColumns_;
|
939
|
+
/// Current number of elements
|
940
|
+
int numberElements_;
|
941
|
+
/// Maximum number of elements
|
942
|
+
int maximumElements_;
|
943
|
+
/// Current number of quadratic elements
|
944
|
+
int numberQuadraticElements_;
|
945
|
+
/// Maximum number of quadratic elements
|
946
|
+
int maximumQuadraticElements_;
|
947
|
+
/// Row lower
|
948
|
+
double * rowLower_;
|
949
|
+
/// Row upper
|
950
|
+
double * rowUpper_;
|
951
|
+
/// Row names
|
952
|
+
CoinModelHash rowName_;
|
953
|
+
/** Row types.
|
954
|
+
Has information - at present
|
955
|
+
bit 0 - rowLower is a string
|
956
|
+
bit 1 - rowUpper is a string
|
957
|
+
NOTE - if converted to CoinPackedMatrix - may be indices of
|
958
|
+
original rows (i.e. when decomposed)
|
959
|
+
*/
|
960
|
+
int * rowType_;
|
961
|
+
/// Objective
|
962
|
+
double * objective_;
|
963
|
+
/// Column Lower
|
964
|
+
double * columnLower_;
|
965
|
+
/// Column Upper
|
966
|
+
double * columnUpper_;
|
967
|
+
/// Column names
|
968
|
+
CoinModelHash columnName_;
|
969
|
+
/// Integer information
|
970
|
+
int * integerType_;
|
971
|
+
/// Strings
|
972
|
+
CoinModelHash string_;
|
973
|
+
/** Column types.
|
974
|
+
Has information - at present
|
975
|
+
bit 0 - columnLower is a string
|
976
|
+
bit 1 - columnUpper is a string
|
977
|
+
bit 2 - objective is a string
|
978
|
+
bit 3 - integer setting is a string
|
979
|
+
NOTE - if converted to CoinPackedMatrix - may be indices of
|
980
|
+
original columns (i.e. when decomposed)
|
981
|
+
*/
|
982
|
+
int * columnType_;
|
983
|
+
/// If simple then start of each row/column
|
984
|
+
int * start_;
|
985
|
+
/// Actual elements
|
986
|
+
CoinModelTriple * elements_;
|
987
|
+
/// Actual elements as CoinPackedMatrix
|
988
|
+
CoinPackedMatrix * packedMatrix_;
|
989
|
+
/// Hash for elements
|
990
|
+
mutable CoinModelHash2 hashElements_;
|
991
|
+
/// Linked list for rows
|
992
|
+
mutable CoinModelLinkedList rowList_;
|
993
|
+
/// Linked list for columns
|
994
|
+
mutable CoinModelLinkedList columnList_;
|
995
|
+
/// Actual quadratic elements (always linked lists)
|
996
|
+
CoinModelTriple * quadraticElements_;
|
997
|
+
/// Hash for quadratic elements
|
998
|
+
mutable CoinModelHash2 hashQuadraticElements_;
|
999
|
+
/// Array for sorting indices
|
1000
|
+
int * sortIndices_;
|
1001
|
+
/// Array for sorting elements
|
1002
|
+
double * sortElements_;
|
1003
|
+
/// Size of sort arrays
|
1004
|
+
int sortSize_;
|
1005
|
+
/// Linked list for quadratic rows
|
1006
|
+
mutable CoinModelLinkedList quadraticRowList_;
|
1007
|
+
/// Linked list for quadratic columns
|
1008
|
+
mutable CoinModelLinkedList quadraticColumnList_;
|
1009
|
+
/// Size of associated values
|
1010
|
+
int sizeAssociated_;
|
1011
|
+
/// Associated values
|
1012
|
+
double * associated_;
|
1013
|
+
/// Number of SOS - all these are done in one go e.g. from ampl
|
1014
|
+
int numberSOS_;
|
1015
|
+
/// SOS starts
|
1016
|
+
int * startSOS_;
|
1017
|
+
/// SOS members
|
1018
|
+
int * memberSOS_;
|
1019
|
+
/// SOS type
|
1020
|
+
int * typeSOS_;
|
1021
|
+
/// SOS priority
|
1022
|
+
int * prioritySOS_;
|
1023
|
+
/// SOS reference
|
1024
|
+
double * referenceSOS_;
|
1025
|
+
/// priorities (given for all columns (-1 if not integer)
|
1026
|
+
int * priority_;
|
1027
|
+
/// Nonzero if row is cut - done in one go e.g. from ampl
|
1028
|
+
int * cut_;
|
1029
|
+
/// Pointer to more information
|
1030
|
+
void * moreInfo_;
|
1031
|
+
/** Type of build -
|
1032
|
+
-1 unset,
|
1033
|
+
0 for row,
|
1034
|
+
1 for column,
|
1035
|
+
2 linked.
|
1036
|
+
3 matrix is CoinPackedMatrix (and at present can't be modified);
|
1037
|
+
*/
|
1038
|
+
mutable int type_;
|
1039
|
+
/// True if no names EVER being used (for users who know what they are doing)
|
1040
|
+
bool noNames_;
|
1041
|
+
/** Links present (could be tested by sizes of objects)
|
1042
|
+
0 - none,
|
1043
|
+
1 - row links,
|
1044
|
+
2 - column links,
|
1045
|
+
3 - both
|
1046
|
+
*/
|
1047
|
+
mutable int links_;
|
1048
|
+
//@}
|
1049
|
+
};
|
1050
|
+
/// Just function of single variable x
|
1051
|
+
double getFunctionValueFromString(const char * string, const char * x, double xValue);
|
1052
|
+
/// faster version
|
1053
|
+
double getDoubleFromString(CoinYacc & info, const char * string, const char * x, double xValue);
|
1054
|
+
#endif
|