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,247 @@
|
|
1
|
+
/* $Id: CoinStructuredModel.hpp 1691 2014-03-19 12:43:56Z forrest $ */
|
2
|
+
// Copyright (C) 2008, 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 CoinStructuredModel_H
|
7
|
+
#define CoinStructuredModel_H
|
8
|
+
|
9
|
+
#include "CoinModel.hpp"
|
10
|
+
#include <vector>
|
11
|
+
|
12
|
+
/**
|
13
|
+
This is a model which is made up of Coin(Structured)Model blocks.
|
14
|
+
*/
|
15
|
+
typedef struct CoinModelInfo2 {
|
16
|
+
int rowBlock; // Which row block
|
17
|
+
int columnBlock; // Which column block
|
18
|
+
char matrix; // nonzero if matrix exists
|
19
|
+
char rhs; // nonzero if non default rhs exists
|
20
|
+
char rowName; // nonzero if row names exists
|
21
|
+
char integer; // nonzero if integer information exists
|
22
|
+
char bounds; // nonzero if non default bounds/objective exists
|
23
|
+
char columnName; // nonzero if column names exists
|
24
|
+
CoinModelInfo2() :
|
25
|
+
rowBlock(0),
|
26
|
+
columnBlock(0),
|
27
|
+
matrix(0),
|
28
|
+
rhs(0),
|
29
|
+
rowName(0),
|
30
|
+
integer(0),
|
31
|
+
bounds(0),
|
32
|
+
columnName(0)
|
33
|
+
{}
|
34
|
+
} CoinModelBlockInfo;
|
35
|
+
|
36
|
+
class CoinStructuredModel : public CoinBaseModel {
|
37
|
+
|
38
|
+
public:
|
39
|
+
/**@name Useful methods for building model */
|
40
|
+
//@{
|
41
|
+
/** add a block from a CoinModel using names given as parameters
|
42
|
+
returns number of errors (e.g. both have objectives but not same)
|
43
|
+
*/
|
44
|
+
int addBlock(const std::string & rowBlock,
|
45
|
+
const std::string & columnBlock,
|
46
|
+
const CoinBaseModel & block);
|
47
|
+
/** add a block from a CoinModel with names in model
|
48
|
+
returns number of errors (e.g. both have objectives but not same)
|
49
|
+
*/
|
50
|
+
int addBlock(const CoinBaseModel & block);
|
51
|
+
/** add a block from a CoinModel using names given as parameters
|
52
|
+
returns number of errors (e.g. both have objectives but not same)
|
53
|
+
This passes in block - structured model takes ownership
|
54
|
+
*/
|
55
|
+
int addBlock(const std::string & rowBlock,
|
56
|
+
const std::string & columnBlock,
|
57
|
+
CoinBaseModel * block);
|
58
|
+
/** add a block using names
|
59
|
+
*/
|
60
|
+
int addBlock(const std::string & rowBlock,
|
61
|
+
const std::string & columnBlock,
|
62
|
+
const CoinPackedMatrix & matrix,
|
63
|
+
const double * rowLower, const double * rowUpper,
|
64
|
+
const double * columnLower, const double * columnUpper,
|
65
|
+
const double * objective);
|
66
|
+
|
67
|
+
/** Write the problem in MPS format to a file with the given filename.
|
68
|
+
|
69
|
+
\param compression can be set to three values to indicate what kind
|
70
|
+
of file should be written
|
71
|
+
<ul>
|
72
|
+
<li> 0: plain text (default)
|
73
|
+
<li> 1: gzip compressed (.gz is appended to \c filename)
|
74
|
+
<li> 2: bzip2 compressed (.bz2 is appended to \c filename) (TODO)
|
75
|
+
</ul>
|
76
|
+
If the library was not compiled with the requested compression then
|
77
|
+
writeMps falls back to writing a plain text file.
|
78
|
+
|
79
|
+
\param formatType specifies the precision to used for values in the
|
80
|
+
MPS file
|
81
|
+
<ul>
|
82
|
+
<li> 0: normal precision (default)
|
83
|
+
<li> 1: extra accuracy
|
84
|
+
<li> 2: IEEE hex
|
85
|
+
</ul>
|
86
|
+
|
87
|
+
\param numberAcross specifies whether 1 or 2 (default) values should be
|
88
|
+
specified on every data line in the MPS file.
|
89
|
+
|
90
|
+
not const as may change model e.g. fill in default bounds
|
91
|
+
*/
|
92
|
+
int writeMps(const char *filename, int compression = 0,
|
93
|
+
int formatType = 0, int numberAcross = 2, bool keepStrings=false) ;
|
94
|
+
/// Read SMPS model
|
95
|
+
int readSmps(const char *filename,
|
96
|
+
bool keepNames = false,
|
97
|
+
bool ignoreErrors = false);
|
98
|
+
|
99
|
+
/** Decompose a CoinModel
|
100
|
+
1 - try D-W
|
101
|
+
2 - try Benders
|
102
|
+
3 - try Staircase
|
103
|
+
Returns number of blocks or zero if no structure
|
104
|
+
*/
|
105
|
+
int decompose(const CoinModel &model,int type,
|
106
|
+
int maxBlocks=50, const char ** starts=NULL);
|
107
|
+
/** Decompose a model specified as arrays + CoinPackedMatrix
|
108
|
+
1 - try D-W
|
109
|
+
2 - try Benders
|
110
|
+
3 - try Staircase
|
111
|
+
Returns number of blocks or zero if no structure
|
112
|
+
*/
|
113
|
+
int decompose(const CoinPackedMatrix & matrix,
|
114
|
+
const double * rowLower, const double * rowUpper,
|
115
|
+
const double * columnLower, const double * columnUpper,
|
116
|
+
const double * objective, int type,int maxBlocks=50,
|
117
|
+
int * starts=NULL,
|
118
|
+
double objectiveOffset=0.0);
|
119
|
+
|
120
|
+
//@}
|
121
|
+
|
122
|
+
|
123
|
+
/**@name For getting information */
|
124
|
+
//@{
|
125
|
+
/// Return number of row blocks
|
126
|
+
inline int numberRowBlocks() const
|
127
|
+
{ return numberRowBlocks_;}
|
128
|
+
/// Return number of column blocks
|
129
|
+
inline int numberColumnBlocks() const
|
130
|
+
{ return numberColumnBlocks_;}
|
131
|
+
/// Return number of elementBlocks
|
132
|
+
inline CoinBigIndex numberElementBlocks() const
|
133
|
+
{ return numberElementBlocks_;}
|
134
|
+
/// Return number of elements
|
135
|
+
CoinBigIndex numberElements() const;
|
136
|
+
/// Return the i'th row block name
|
137
|
+
inline const std::string & getRowBlock(int i) const
|
138
|
+
{ return rowBlockNames_[i];}
|
139
|
+
/// Set i'th row block name
|
140
|
+
inline void setRowBlock(int i,const std::string &name)
|
141
|
+
{ rowBlockNames_[i] = name;}
|
142
|
+
/// Add or check a row block name and number of rows
|
143
|
+
int addRowBlock(int numberRows,const std::string &name) ;
|
144
|
+
/// Return a row block index given a row block name
|
145
|
+
int rowBlock(const std::string &name) const;
|
146
|
+
/// Return i'th the column block name
|
147
|
+
inline const std::string & getColumnBlock(int i) const
|
148
|
+
{ return columnBlockNames_[i];}
|
149
|
+
/// Set i'th column block name
|
150
|
+
inline void setColumnBlock(int i,const std::string &name)
|
151
|
+
{ columnBlockNames_[i] = name;}
|
152
|
+
/// Add or check a column block name and number of columns
|
153
|
+
int addColumnBlock(int numberColumns,const std::string &name) ;
|
154
|
+
/// Return a column block index given a column block name
|
155
|
+
int columnBlock(const std::string &name) const;
|
156
|
+
/// Return i'th block type
|
157
|
+
inline const CoinModelBlockInfo & blockType(int i) const
|
158
|
+
{ return blockType_[i];}
|
159
|
+
/// Return i'th block
|
160
|
+
inline CoinBaseModel * block(int i) const
|
161
|
+
{ return blocks_[i];}
|
162
|
+
/// Return block corresponding to row and column
|
163
|
+
const CoinBaseModel * block(int row,int column) const;
|
164
|
+
/// Return i'th block as CoinModel (or NULL)
|
165
|
+
CoinModel * coinBlock(int i) const;
|
166
|
+
/// Return block corresponding to row and column as CoinModel
|
167
|
+
const CoinBaseModel * coinBlock(int row,int column) const;
|
168
|
+
/// Return block number corresponding to row and column
|
169
|
+
int blockIndex(int row,int column) const;
|
170
|
+
/** Return model as a CoinModel block
|
171
|
+
and fill in info structure and update counts
|
172
|
+
*/
|
173
|
+
CoinModel * coinModelBlock(CoinModelBlockInfo & info) ;
|
174
|
+
/// Sets given block into coinModelBlocks_
|
175
|
+
void setCoinModel(CoinModel * block, int iBlock);
|
176
|
+
/// Refresh info in blockType_
|
177
|
+
void refresh(int iBlock);
|
178
|
+
/** Fill pointers corresponding to row and column */
|
179
|
+
|
180
|
+
CoinModelBlockInfo block(int row,int column,
|
181
|
+
const double * & rowLower, const double * & rowUpper,
|
182
|
+
const double * & columnLower, const double * & columnUpper,
|
183
|
+
const double * & objective) const;
|
184
|
+
/// Direction of optimization (1 - minimize, -1 - maximize, 0 - ignore
|
185
|
+
inline double optimizationDirection() const {
|
186
|
+
return optimizationDirection_;
|
187
|
+
}
|
188
|
+
/// Set direction of optimization (1 - minimize, -1 - maximize, 0 - ignore
|
189
|
+
inline void setOptimizationDirection(double value)
|
190
|
+
{ optimizationDirection_=value;}
|
191
|
+
//@}
|
192
|
+
|
193
|
+
/**@name Constructors, destructor */
|
194
|
+
//@{
|
195
|
+
/** Default constructor. */
|
196
|
+
CoinStructuredModel();
|
197
|
+
/** Read a problem in MPS format from the given filename.
|
198
|
+
May try and decompose
|
199
|
+
*/
|
200
|
+
CoinStructuredModel(const char *fileName,int decompose=0,
|
201
|
+
int maxBlocks=50);
|
202
|
+
/** Destructor */
|
203
|
+
virtual ~CoinStructuredModel();
|
204
|
+
//@}
|
205
|
+
|
206
|
+
/**@name Copy method */
|
207
|
+
//@{
|
208
|
+
/** The copy constructor. */
|
209
|
+
CoinStructuredModel(const CoinStructuredModel&);
|
210
|
+
/// =
|
211
|
+
CoinStructuredModel& operator=(const CoinStructuredModel&);
|
212
|
+
/// Clone
|
213
|
+
virtual CoinBaseModel * clone() const;
|
214
|
+
//@}
|
215
|
+
|
216
|
+
private:
|
217
|
+
|
218
|
+
/** Fill in info structure and update counts
|
219
|
+
Returns number of inconsistencies on border
|
220
|
+
*/
|
221
|
+
int fillInfo(CoinModelBlockInfo & info,const CoinModel * block);
|
222
|
+
/** Fill in info structure and update counts
|
223
|
+
*/
|
224
|
+
void fillInfo(CoinModelBlockInfo & info,const CoinStructuredModel * block);
|
225
|
+
/**@name Data members */
|
226
|
+
//@{
|
227
|
+
/// Current number of row blocks
|
228
|
+
int numberRowBlocks_;
|
229
|
+
/// Current number of column blocks
|
230
|
+
int numberColumnBlocks_;
|
231
|
+
/// Current number of element blocks
|
232
|
+
int numberElementBlocks_;
|
233
|
+
/// Maximum number of element blocks
|
234
|
+
int maximumElementBlocks_;
|
235
|
+
/// Rowblock name
|
236
|
+
std::vector<std::string> rowBlockNames_;
|
237
|
+
/// Columnblock name
|
238
|
+
std::vector<std::string> columnBlockNames_;
|
239
|
+
/// Blocks
|
240
|
+
CoinBaseModel ** blocks_;
|
241
|
+
/// CoinModel copies of blocks or NULL if original CoinModel
|
242
|
+
CoinModel ** coinModelBlocks_;
|
243
|
+
/// Which parts of model are set in block
|
244
|
+
CoinModelBlockInfo * blockType_;
|
245
|
+
//@}
|
246
|
+
};
|
247
|
+
#endif
|
@@ -0,0 +1,310 @@
|
|
1
|
+
/* $Id: CoinTime.hpp 1372 2011-01-03 23:31:00Z lou $ */
|
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 _CoinTime_hpp
|
7
|
+
#define _CoinTime_hpp
|
8
|
+
|
9
|
+
// Uncomment the next three lines for thorough memory initialisation.
|
10
|
+
// #ifndef ZEROFAULT
|
11
|
+
// # define ZEROFAULT
|
12
|
+
// #endif
|
13
|
+
|
14
|
+
//#############################################################################
|
15
|
+
|
16
|
+
#include <ctime>
|
17
|
+
#if defined(_MSC_VER)
|
18
|
+
// Turn off compiler warning about long names
|
19
|
+
# pragma warning(disable:4786)
|
20
|
+
#else
|
21
|
+
// MacOS-X and FreeBSD needs sys/time.h
|
22
|
+
#if defined(__MACH__) || defined (__FreeBSD__)
|
23
|
+
#include <sys/time.h>
|
24
|
+
#endif
|
25
|
+
#if !defined(__MSVCRT__)
|
26
|
+
#include <sys/resource.h>
|
27
|
+
#endif
|
28
|
+
#endif
|
29
|
+
|
30
|
+
//#############################################################################
|
31
|
+
|
32
|
+
#if defined(_MSC_VER)
|
33
|
+
|
34
|
+
#if 0 // change this to 1 if want to use the win32 API
|
35
|
+
#include <windows.h>
|
36
|
+
#ifdef small
|
37
|
+
/* for some unfathomable reason (to me) rpcndr.h (pulled in by windows.h) does a
|
38
|
+
'#define small char' */
|
39
|
+
#undef small
|
40
|
+
#endif
|
41
|
+
#define TWO_TO_THE_THIRTYTWO 4294967296.0
|
42
|
+
#define DELTA_EPOCH_IN_SECS 11644473600.0
|
43
|
+
inline double CoinGetTimeOfDay()
|
44
|
+
{
|
45
|
+
FILETIME ft;
|
46
|
+
|
47
|
+
GetSystemTimeAsFileTime(&ft);
|
48
|
+
double t = ft.dwHighDateTime * TWO_TO_THE_THIRTYTWO + ft.dwLowDateTime;
|
49
|
+
t = t/10000000.0 - DELTA_EPOCH_IN_SECS;
|
50
|
+
return t;
|
51
|
+
}
|
52
|
+
#else
|
53
|
+
#include <sys/types.h>
|
54
|
+
#include <sys/timeb.h>
|
55
|
+
inline double CoinGetTimeOfDay()
|
56
|
+
{
|
57
|
+
struct _timeb timebuffer;
|
58
|
+
#pragma warning(disable:4996)
|
59
|
+
_ftime( &timebuffer ); // C4996
|
60
|
+
#pragma warning(default:4996)
|
61
|
+
return timebuffer.time + timebuffer.millitm/1000.0;
|
62
|
+
}
|
63
|
+
#endif
|
64
|
+
|
65
|
+
#else
|
66
|
+
|
67
|
+
#include <sys/time.h>
|
68
|
+
|
69
|
+
inline double CoinGetTimeOfDay()
|
70
|
+
{
|
71
|
+
struct timeval tv;
|
72
|
+
gettimeofday(&tv, NULL);
|
73
|
+
return static_cast<double>(tv.tv_sec) + static_cast<int>(tv.tv_usec)/1000000.0;
|
74
|
+
}
|
75
|
+
|
76
|
+
#endif // _MSC_VER
|
77
|
+
|
78
|
+
/**
|
79
|
+
Query the elapsed wallclock time since the first call to this function. If
|
80
|
+
a positive argument is passed to the function then the time of the first
|
81
|
+
call is set to that value (this kind of argument is allowed only at the
|
82
|
+
first call!). If a negative argument is passed to the function then it
|
83
|
+
returns the time when it was set.
|
84
|
+
*/
|
85
|
+
|
86
|
+
inline double CoinWallclockTime(double callType = 0)
|
87
|
+
{
|
88
|
+
double callTime = CoinGetTimeOfDay();
|
89
|
+
static const double firstCall = callType > 0 ? callType : callTime;
|
90
|
+
return callType < 0 ? firstCall : callTime - firstCall;
|
91
|
+
}
|
92
|
+
|
93
|
+
//#############################################################################
|
94
|
+
|
95
|
+
//#define HAVE_SDK // if SDK under Win32 is installed, for CPU instead of elapsed time under Win
|
96
|
+
#ifdef HAVE_SDK
|
97
|
+
#include <windows.h>
|
98
|
+
#ifdef small
|
99
|
+
/* for some unfathomable reason (to me) rpcndr.h (pulled in by windows.h) does a
|
100
|
+
'#define small char' */
|
101
|
+
#undef small
|
102
|
+
#endif
|
103
|
+
#define TWO_TO_THE_THIRTYTWO 4294967296.0
|
104
|
+
#endif
|
105
|
+
|
106
|
+
static inline double CoinCpuTime()
|
107
|
+
{
|
108
|
+
double cpu_temp;
|
109
|
+
#if defined(_MSC_VER) || defined(__MSVCRT__)
|
110
|
+
#ifdef HAVE_SDK
|
111
|
+
FILETIME creation;
|
112
|
+
FILETIME exit;
|
113
|
+
FILETIME kernel;
|
114
|
+
FILETIME user;
|
115
|
+
GetProcessTimes(GetCurrentProcess(), &creation, &exit, &kernel, &user);
|
116
|
+
double t = user.dwHighDateTime * TWO_TO_THE_THIRTYTWO + user.dwLowDateTime;
|
117
|
+
return t/10000000.0;
|
118
|
+
#else
|
119
|
+
unsigned int ticksnow; /* clock_t is same as int */
|
120
|
+
ticksnow = (unsigned int)clock();
|
121
|
+
cpu_temp = (double)((double)ticksnow/CLOCKS_PER_SEC);
|
122
|
+
#endif
|
123
|
+
|
124
|
+
#else
|
125
|
+
struct rusage usage;
|
126
|
+
# ifdef ZEROFAULT
|
127
|
+
usage.ru_utime.tv_sec = 0 ;
|
128
|
+
usage.ru_utime.tv_usec = 0 ;
|
129
|
+
# endif
|
130
|
+
getrusage(RUSAGE_SELF,&usage);
|
131
|
+
cpu_temp = static_cast<double>(usage.ru_utime.tv_sec);
|
132
|
+
cpu_temp += 1.0e-6*(static_cast<double> (usage.ru_utime.tv_usec));
|
133
|
+
#endif
|
134
|
+
return cpu_temp;
|
135
|
+
}
|
136
|
+
|
137
|
+
//#############################################################################
|
138
|
+
|
139
|
+
|
140
|
+
|
141
|
+
static inline double CoinSysTime()
|
142
|
+
{
|
143
|
+
double sys_temp;
|
144
|
+
#if defined(_MSC_VER) || defined(__MSVCRT__)
|
145
|
+
sys_temp = 0.0;
|
146
|
+
#else
|
147
|
+
struct rusage usage;
|
148
|
+
# ifdef ZEROFAULT
|
149
|
+
usage.ru_utime.tv_sec = 0 ;
|
150
|
+
usage.ru_utime.tv_usec = 0 ;
|
151
|
+
# endif
|
152
|
+
getrusage(RUSAGE_SELF,&usage);
|
153
|
+
sys_temp = static_cast<double>(usage.ru_stime.tv_sec);
|
154
|
+
sys_temp += 1.0e-6*(static_cast<double> (usage.ru_stime.tv_usec));
|
155
|
+
#endif
|
156
|
+
return sys_temp;
|
157
|
+
}
|
158
|
+
|
159
|
+
//#############################################################################
|
160
|
+
// On most systems SELF seems to include children threads, This is for when it doesn't
|
161
|
+
static inline double CoinCpuTimeJustChildren()
|
162
|
+
{
|
163
|
+
double cpu_temp;
|
164
|
+
#if defined(_MSC_VER) || defined(__MSVCRT__)
|
165
|
+
cpu_temp = 0.0;
|
166
|
+
#else
|
167
|
+
struct rusage usage;
|
168
|
+
# ifdef ZEROFAULT
|
169
|
+
usage.ru_utime.tv_sec = 0 ;
|
170
|
+
usage.ru_utime.tv_usec = 0 ;
|
171
|
+
# endif
|
172
|
+
getrusage(RUSAGE_CHILDREN,&usage);
|
173
|
+
cpu_temp = static_cast<double>(usage.ru_utime.tv_sec);
|
174
|
+
cpu_temp += 1.0e-6*(static_cast<double> (usage.ru_utime.tv_usec));
|
175
|
+
#endif
|
176
|
+
return cpu_temp;
|
177
|
+
}
|
178
|
+
//#############################################################################
|
179
|
+
|
180
|
+
#include <fstream>
|
181
|
+
|
182
|
+
/**
|
183
|
+
This class implements a timer that also implements a tracing functionality.
|
184
|
+
|
185
|
+
The timer stores the start time of the timer, for how much time it was set to
|
186
|
+
and when does it expire (start + limit = end). Queries can be made that tell
|
187
|
+
whether the timer is expired, is past an absolute time, is past a percentage
|
188
|
+
of the length of the timer. All times are given in seconds, but as double
|
189
|
+
numbers, so there can be fractional values.
|
190
|
+
|
191
|
+
The timer can also be initialized with a stream and a specification whether
|
192
|
+
to write to or read from the stream. In the former case the result of every
|
193
|
+
query is written into the stream, in the latter case timing is not tested at
|
194
|
+
all, rather the supposed result is read out from the stream. This makes it
|
195
|
+
possible to exactly retrace time sensitive program execution.
|
196
|
+
*/
|
197
|
+
class CoinTimer
|
198
|
+
{
|
199
|
+
private:
|
200
|
+
/// When the timer was initialized/reset/restarted
|
201
|
+
double start;
|
202
|
+
///
|
203
|
+
double limit;
|
204
|
+
double end;
|
205
|
+
#ifdef COIN_COMPILE_WITH_TRACING
|
206
|
+
std::fstream* stream;
|
207
|
+
bool write_stream;
|
208
|
+
#endif
|
209
|
+
|
210
|
+
private:
|
211
|
+
#ifdef COIN_COMPILE_WITH_TRACING
|
212
|
+
inline bool evaluate(bool b_tmp) const {
|
213
|
+
int i_tmp = b_tmp;
|
214
|
+
if (stream) {
|
215
|
+
if (write_stream)
|
216
|
+
(*stream) << i_tmp << "\n";
|
217
|
+
else
|
218
|
+
(*stream) >> i_tmp;
|
219
|
+
}
|
220
|
+
return i_tmp;
|
221
|
+
}
|
222
|
+
inline double evaluate(double d_tmp) const {
|
223
|
+
if (stream) {
|
224
|
+
if (write_stream)
|
225
|
+
(*stream) << d_tmp << "\n";
|
226
|
+
else
|
227
|
+
(*stream) >> d_tmp;
|
228
|
+
}
|
229
|
+
return d_tmp;
|
230
|
+
}
|
231
|
+
#else
|
232
|
+
inline bool evaluate(const bool b_tmp) const {
|
233
|
+
return b_tmp;
|
234
|
+
}
|
235
|
+
inline double evaluate(const double d_tmp) const {
|
236
|
+
return d_tmp;
|
237
|
+
}
|
238
|
+
#endif
|
239
|
+
|
240
|
+
public:
|
241
|
+
/// Default constructor creates a timer with no time limit and no tracing
|
242
|
+
CoinTimer() :
|
243
|
+
start(0), limit(1e100), end(1e100)
|
244
|
+
#ifdef COIN_COMPILE_WITH_TRACING
|
245
|
+
, stream(0), write_stream(true)
|
246
|
+
#endif
|
247
|
+
{}
|
248
|
+
|
249
|
+
/// Create a timer with the given time limit and with no tracing
|
250
|
+
CoinTimer(double lim) :
|
251
|
+
start(CoinCpuTime()), limit(lim), end(start+lim)
|
252
|
+
#ifdef COIN_COMPILE_WITH_TRACING
|
253
|
+
, stream(0), write_stream(true)
|
254
|
+
#endif
|
255
|
+
{}
|
256
|
+
|
257
|
+
#ifdef COIN_COMPILE_WITH_TRACING
|
258
|
+
/** Create a timer with no time limit and with writing/reading the trace
|
259
|
+
to/from the given stream, depending on the argument \c write. */
|
260
|
+
CoinTimer(std::fstream* s, bool write) :
|
261
|
+
start(0), limit(1e100), end(1e100),
|
262
|
+
stream(s), write_stream(write) {}
|
263
|
+
|
264
|
+
/** Create a timer with the given time limit and with writing/reading the
|
265
|
+
trace to/from the given stream, depending on the argument \c write. */
|
266
|
+
CoinTimer(double lim, std::fstream* s, bool w) :
|
267
|
+
start(CoinCpuTime()), limit(lim), end(start+lim),
|
268
|
+
stream(s), write_stream(w) {}
|
269
|
+
#endif
|
270
|
+
|
271
|
+
/// Restart the timer (keeping the same time limit)
|
272
|
+
inline void restart() { start=CoinCpuTime(); end=start+limit; }
|
273
|
+
/// An alternate name for \c restart()
|
274
|
+
inline void reset() { restart(); }
|
275
|
+
/// Reset (and restart) the timer and change its time limit
|
276
|
+
inline void reset(double lim) { limit=lim; restart(); }
|
277
|
+
|
278
|
+
/** Return whether the given percentage of the time limit has elapsed since
|
279
|
+
the timer was started */
|
280
|
+
inline bool isPastPercent(double pct) const {
|
281
|
+
return evaluate(start + limit * pct < CoinCpuTime());
|
282
|
+
}
|
283
|
+
/** Return whether the given amount of time has elapsed since the timer was
|
284
|
+
started */
|
285
|
+
inline bool isPast(double lim) const {
|
286
|
+
return evaluate(start + lim < CoinCpuTime());
|
287
|
+
}
|
288
|
+
/** Return whether the originally specified time limit has passed since the
|
289
|
+
timer was started */
|
290
|
+
inline bool isExpired() const {
|
291
|
+
return evaluate(end < CoinCpuTime());
|
292
|
+
}
|
293
|
+
|
294
|
+
/** Return how much time is left on the timer */
|
295
|
+
inline double timeLeft() const {
|
296
|
+
return evaluate(end - CoinCpuTime());
|
297
|
+
}
|
298
|
+
|
299
|
+
/** Return how much time has elapsed */
|
300
|
+
inline double timeElapsed() const {
|
301
|
+
return evaluate(CoinCpuTime() - start);
|
302
|
+
}
|
303
|
+
|
304
|
+
inline void setLimit(double l) {
|
305
|
+
limit = l;
|
306
|
+
return;
|
307
|
+
}
|
308
|
+
};
|
309
|
+
|
310
|
+
#endif
|
@@ -0,0 +1,64 @@
|
|
1
|
+
/* $Id: CoinTypes.hpp 1762 2014-12-29 20:37:12Z tkr $ */
|
2
|
+
// Copyright (C) 2004, 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 _CoinTypes_hpp
|
7
|
+
#define _CoinTypes_hpp
|
8
|
+
|
9
|
+
#include "CoinUtilsConfig.h"
|
10
|
+
/* On some systems, we require stdint.h to have the 64bit integer type defined. */
|
11
|
+
#ifdef COINUTILS_HAS_STDINT_H
|
12
|
+
#include <stdint.h>
|
13
|
+
#endif
|
14
|
+
#ifdef COINUTILS_HAS_CSTDINT
|
15
|
+
#include <cstdint>
|
16
|
+
#endif
|
17
|
+
|
18
|
+
#define CoinInt64 COIN_INT64_T
|
19
|
+
#define CoinUInt64 COIN_UINT64_T
|
20
|
+
#define CoinIntPtr COIN_INTPTR_T
|
21
|
+
|
22
|
+
//=============================================================================
|
23
|
+
#ifndef COIN_BIG_INDEX
|
24
|
+
#define COIN_BIG_INDEX 0
|
25
|
+
#endif
|
26
|
+
|
27
|
+
#if COIN_BIG_INDEX==0
|
28
|
+
typedef int CoinBigIndex;
|
29
|
+
#elif COIN_BIG_INDEX==1
|
30
|
+
typedef long CoinBigIndex;
|
31
|
+
#else
|
32
|
+
typedef long long CoinBigIndex;
|
33
|
+
#endif
|
34
|
+
|
35
|
+
//=============================================================================
|
36
|
+
#ifndef COIN_BIG_DOUBLE
|
37
|
+
#define COIN_BIG_DOUBLE 0
|
38
|
+
#endif
|
39
|
+
|
40
|
+
// See if we want the ability to have long double work arrays
|
41
|
+
#if COIN_BIG_DOUBLE==2
|
42
|
+
#undef COIN_BIG_DOUBLE
|
43
|
+
#define COIN_BIG_DOUBLE 0
|
44
|
+
#define COIN_LONG_WORK 1
|
45
|
+
typedef long double CoinWorkDouble;
|
46
|
+
#elif COIN_BIG_DOUBLE==3
|
47
|
+
#undef COIN_BIG_DOUBLE
|
48
|
+
#define COIN_BIG_DOUBLE 1
|
49
|
+
#define COIN_LONG_WORK 1
|
50
|
+
typedef long double CoinWorkDouble;
|
51
|
+
#else
|
52
|
+
#define COIN_LONG_WORK 0
|
53
|
+
typedef double CoinWorkDouble;
|
54
|
+
#endif
|
55
|
+
|
56
|
+
#if COIN_BIG_DOUBLE==0
|
57
|
+
typedef double CoinFactorizationDouble;
|
58
|
+
#elif COIN_BIG_DOUBLE==1
|
59
|
+
typedef long double CoinFactorizationDouble;
|
60
|
+
#else
|
61
|
+
typedef double CoinFactorizationDouble;
|
62
|
+
#endif
|
63
|
+
|
64
|
+
#endif
|
@@ -0,0 +1,19 @@
|
|
1
|
+
/* $Id: CoinUtility.hpp 1372 2011-01-03 23:31:00Z lou $ */
|
2
|
+
// Copyright (C) 2004, 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 CoinUtility_h_
|
7
|
+
#define CoinUtility_h_
|
8
|
+
|
9
|
+
#include "CoinSort.hpp"
|
10
|
+
|
11
|
+
template <typename S, typename T>
|
12
|
+
CoinPair<S,T> CoinMakePair(const S& s, const T& t)
|
13
|
+
{ return CoinPair<S,T>(s, t); }
|
14
|
+
|
15
|
+
template <typename S, typename T, typename U>
|
16
|
+
CoinTriple<S,T,U> CoinMakeTriple(const S& s, const T& t, const U& u)
|
17
|
+
{ return CoinTriple<S,T,U>(s, t, u); }
|
18
|
+
|
19
|
+
#endif
|
@@ -0,0 +1,34 @@
|
|
1
|
+
/* src/config_coinutils.h. Generated by configure. */
|
2
|
+
/* inc/config_coinutils.h.in. */
|
3
|
+
|
4
|
+
#ifndef __CONFIG_COINUTILS_H__
|
5
|
+
#define __CONFIG_COINUTILS_H__
|
6
|
+
|
7
|
+
/* Define to 1 if stdint.h is available for CoinUtils */
|
8
|
+
#define COINUTILS_HAS_STDINT_H 1
|
9
|
+
|
10
|
+
/* Define to 1 if stdint.h is available for CoinUtils */
|
11
|
+
/* #undef COINUTILS_HAS_CSTDINT */
|
12
|
+
|
13
|
+
/* Version number of project */
|
14
|
+
#define COINUTILS_VERSION "2.10.11"
|
15
|
+
|
16
|
+
/* Major Version number of project */
|
17
|
+
#define COINUTILS_VERSION_MAJOR 2
|
18
|
+
|
19
|
+
/* Minor Version number of project */
|
20
|
+
#define COINUTILS_VERSION_MINOR 10
|
21
|
+
|
22
|
+
/* Release Version number of project */
|
23
|
+
#define COINUTILS_VERSION_RELEASE 11
|
24
|
+
|
25
|
+
/* Define to 64bit integer type */
|
26
|
+
#define COIN_INT64_T int64_t
|
27
|
+
|
28
|
+
/* Define to integer type capturing pointer */
|
29
|
+
#define COIN_INTPTR_T intptr_t
|
30
|
+
|
31
|
+
/* Define to 64bit unsigned integer type */
|
32
|
+
#define COIN_UINT64_T int64_t
|
33
|
+
|
34
|
+
#endif
|