ruby-cbc 0.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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,383 @@
|
|
|
1
|
+
/* $Id: CoinDenseVector.hpp 1372 2011-01-03 23:31:00Z lou $ */
|
|
2
|
+
// Copyright (C) 2003, 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 CoinDenseVector_H
|
|
7
|
+
#define CoinDenseVector_H
|
|
8
|
+
|
|
9
|
+
#if defined(_MSC_VER)
|
|
10
|
+
// Turn off compiler warning about long names
|
|
11
|
+
# pragma warning(disable:4786)
|
|
12
|
+
#endif
|
|
13
|
+
|
|
14
|
+
#include <cassert>
|
|
15
|
+
#include <cstdlib>
|
|
16
|
+
#include <cmath>
|
|
17
|
+
#include "CoinHelperFunctions.hpp"
|
|
18
|
+
|
|
19
|
+
//#############################################################################
|
|
20
|
+
/** A function that tests the methods in the CoinDenseVector class. The
|
|
21
|
+
only reason for it not to be a member method is that this way it doesn't
|
|
22
|
+
have to be compiled into the library. And that's a gain, because the
|
|
23
|
+
library should be compiled with optimization on, but this method should be
|
|
24
|
+
compiled with debugging. */
|
|
25
|
+
template <typename T> void
|
|
26
|
+
CoinDenseVectorUnitTest(T dummy);
|
|
27
|
+
|
|
28
|
+
//#############################################################################
|
|
29
|
+
/** Dense Vector
|
|
30
|
+
|
|
31
|
+
Stores a dense (or expanded) vector of floating point values.
|
|
32
|
+
Type of vector elements is controlled by templating.
|
|
33
|
+
(Some working quantities such as accumulated sums
|
|
34
|
+
are explicitly declared of type double). This allows the
|
|
35
|
+
components of the vector integer, single or double precision.
|
|
36
|
+
|
|
37
|
+
Here is a sample usage:
|
|
38
|
+
@verbatim
|
|
39
|
+
const int ne = 4;
|
|
40
|
+
double el[ne] = { 10., 40., 1., 50. }
|
|
41
|
+
|
|
42
|
+
// Create vector and set its value
|
|
43
|
+
CoinDenseVector<double> r(ne,el);
|
|
44
|
+
|
|
45
|
+
// access each element
|
|
46
|
+
assert( r.getElements()[0]==10. );
|
|
47
|
+
assert( r.getElements()[1]==40. );
|
|
48
|
+
assert( r.getElements()[2]== 1. );
|
|
49
|
+
assert( r.getElements()[3]==50. );
|
|
50
|
+
|
|
51
|
+
// Test for equality
|
|
52
|
+
CoinDenseVector<double> r1;
|
|
53
|
+
r1=r;
|
|
54
|
+
|
|
55
|
+
// Add dense vectors.
|
|
56
|
+
// Similarly for subtraction, multiplication,
|
|
57
|
+
// and division.
|
|
58
|
+
CoinDenseVector<double> add = r + r1;
|
|
59
|
+
assert( add[0] == 10.+10. );
|
|
60
|
+
assert( add[1] == 40.+40. );
|
|
61
|
+
assert( add[2] == 1.+ 1. );
|
|
62
|
+
assert( add[3] == 50.+50. );
|
|
63
|
+
|
|
64
|
+
assert( r.sum() == 10.+40.+1.+50. );
|
|
65
|
+
@endverbatim
|
|
66
|
+
*/
|
|
67
|
+
template <typename T> class CoinDenseVector {
|
|
68
|
+
private:
|
|
69
|
+
/**@name Private member data */
|
|
70
|
+
//@{
|
|
71
|
+
/// Size of element vector
|
|
72
|
+
int nElements_;
|
|
73
|
+
///Vector elements
|
|
74
|
+
T * elements_;
|
|
75
|
+
//@}
|
|
76
|
+
|
|
77
|
+
public:
|
|
78
|
+
/**@name Get methods. */
|
|
79
|
+
//@{
|
|
80
|
+
/// Get the size
|
|
81
|
+
inline int getNumElements() const { return nElements_; }
|
|
82
|
+
inline int size() const { return nElements_; }
|
|
83
|
+
/// Get element values
|
|
84
|
+
inline const T * getElements() const { return elements_; }
|
|
85
|
+
/// Get element values
|
|
86
|
+
inline T * getElements() { return elements_; }
|
|
87
|
+
//@}
|
|
88
|
+
|
|
89
|
+
//-------------------------------------------------------------------
|
|
90
|
+
// Set indices and elements
|
|
91
|
+
//-------------------------------------------------------------------
|
|
92
|
+
/**@name Set methods */
|
|
93
|
+
//@{
|
|
94
|
+
/// Reset the vector (i.e. set all elemenets to zero)
|
|
95
|
+
void clear();
|
|
96
|
+
/** Assignment operator */
|
|
97
|
+
CoinDenseVector & operator=(const CoinDenseVector &);
|
|
98
|
+
/** Member of array operator */
|
|
99
|
+
T & operator[](int index) const;
|
|
100
|
+
|
|
101
|
+
/** Set vector size, and elements.
|
|
102
|
+
Size is the length of the elements vector.
|
|
103
|
+
The element vector is copied into this class instance's
|
|
104
|
+
member data. */
|
|
105
|
+
void setVector(int size, const T * elems);
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
/** Elements set to have the same scalar value */
|
|
109
|
+
void setConstant(int size, T elems);
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
/** Set an existing element in the dense vector
|
|
113
|
+
The first argument is the "index" into the elements() array
|
|
114
|
+
*/
|
|
115
|
+
void setElement(int index, T element);
|
|
116
|
+
/** Resize the dense vector to be the first newSize elements.
|
|
117
|
+
If length is decreased, vector is truncated. If increased
|
|
118
|
+
new entries, set to new default element */
|
|
119
|
+
void resize(int newSize, T fill=T());
|
|
120
|
+
|
|
121
|
+
/** Append a dense vector to this dense vector */
|
|
122
|
+
void append(const CoinDenseVector &);
|
|
123
|
+
//@}
|
|
124
|
+
|
|
125
|
+
/**@name norms, sum and scale */
|
|
126
|
+
//@{
|
|
127
|
+
/// 1-norm of vector
|
|
128
|
+
inline T oneNorm() const {
|
|
129
|
+
T norm = 0;
|
|
130
|
+
for (int i=0; i<nElements_; i++)
|
|
131
|
+
norm += CoinAbs(elements_[i]);
|
|
132
|
+
return norm;
|
|
133
|
+
}
|
|
134
|
+
/// 2-norm of vector
|
|
135
|
+
inline double twoNorm() const {
|
|
136
|
+
double norm = 0.;
|
|
137
|
+
for (int i=0; i<nElements_; i++)
|
|
138
|
+
norm += elements_[i] * elements_[i];
|
|
139
|
+
// std namespace removed because it was causing a compile
|
|
140
|
+
// problem with Microsoft Visual C++
|
|
141
|
+
return /*std::*/sqrt(norm);
|
|
142
|
+
}
|
|
143
|
+
/// infinity-norm of vector
|
|
144
|
+
inline T infNorm() const {
|
|
145
|
+
T norm = 0;
|
|
146
|
+
for (int i=0; i<nElements_; i++)
|
|
147
|
+
norm = CoinMax(norm, CoinAbs(elements_[i]));
|
|
148
|
+
return norm;
|
|
149
|
+
}
|
|
150
|
+
/// sum of vector elements
|
|
151
|
+
inline T sum() const {
|
|
152
|
+
T sume = 0;
|
|
153
|
+
for (int i=0; i<nElements_; i++)
|
|
154
|
+
sume += elements_[i];
|
|
155
|
+
return sume;
|
|
156
|
+
}
|
|
157
|
+
/// scale vector elements
|
|
158
|
+
inline void scale(T factor) {
|
|
159
|
+
for (int i=0; i<nElements_; i++)
|
|
160
|
+
elements_[i] *= factor;
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
//@}
|
|
164
|
+
|
|
165
|
+
/**@name Arithmetic operators. */
|
|
166
|
+
//@{
|
|
167
|
+
/// add <code>value</code> to every entry
|
|
168
|
+
void operator+=(T value);
|
|
169
|
+
/// subtract <code>value</code> from every entry
|
|
170
|
+
void operator-=(T value);
|
|
171
|
+
/// multiply every entry by <code>value</code>
|
|
172
|
+
void operator*=(T value);
|
|
173
|
+
/// divide every entry by <code>value</code>
|
|
174
|
+
void operator/=(T value);
|
|
175
|
+
//@}
|
|
176
|
+
|
|
177
|
+
/**@name Constructors and destructors */
|
|
178
|
+
//@{
|
|
179
|
+
/** Default constructor */
|
|
180
|
+
CoinDenseVector();
|
|
181
|
+
/** Alternate Constructors - set elements to vector of Ts */
|
|
182
|
+
CoinDenseVector(int size, const T * elems);
|
|
183
|
+
/** Alternate Constructors - set elements to same scalar value */
|
|
184
|
+
CoinDenseVector(int size, T element=T());
|
|
185
|
+
/** Copy constructors */
|
|
186
|
+
CoinDenseVector(const CoinDenseVector &);
|
|
187
|
+
|
|
188
|
+
/** Destructor */
|
|
189
|
+
~CoinDenseVector ();
|
|
190
|
+
//@}
|
|
191
|
+
|
|
192
|
+
private:
|
|
193
|
+
/**@name Private methods */
|
|
194
|
+
//@{
|
|
195
|
+
/// Copy internal data
|
|
196
|
+
void gutsOfSetVector(int size, const T * elems);
|
|
197
|
+
/// Set all elements to a given value
|
|
198
|
+
void gutsOfSetConstant(int size, T value);
|
|
199
|
+
//@}
|
|
200
|
+
};
|
|
201
|
+
|
|
202
|
+
//#############################################################################
|
|
203
|
+
|
|
204
|
+
/**@name Arithmetic operators on dense vectors.
|
|
205
|
+
|
|
206
|
+
<strong>NOTE</strong>: Because these methods return an object (they can't
|
|
207
|
+
return a reference, though they could return a pointer...) they are
|
|
208
|
+
<em>very</em> inefficient...
|
|
209
|
+
*/
|
|
210
|
+
//@{
|
|
211
|
+
/// Return the sum of two dense vectors
|
|
212
|
+
template <typename T> inline
|
|
213
|
+
CoinDenseVector<T> operator+(const CoinDenseVector<T>& op1,
|
|
214
|
+
const CoinDenseVector<T>& op2){
|
|
215
|
+
assert(op1.size() == op2.size());
|
|
216
|
+
int size = op1.size();
|
|
217
|
+
CoinDenseVector<T> op3(size);
|
|
218
|
+
const T *elements1 = op1.getElements();
|
|
219
|
+
const T *elements2 = op2.getElements();
|
|
220
|
+
T *elements3 = op3.getElements();
|
|
221
|
+
for(int i=0; i<size; i++)
|
|
222
|
+
elements3[i] = elements1[i] + elements2[i];
|
|
223
|
+
return op3;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
/// Return the difference of two dense vectors
|
|
227
|
+
template <typename T> inline
|
|
228
|
+
CoinDenseVector<T> operator-(const CoinDenseVector<T>& op1,
|
|
229
|
+
const CoinDenseVector<T>& op2){
|
|
230
|
+
assert(op1.size() == op2.size());
|
|
231
|
+
int size = op1.size();
|
|
232
|
+
CoinDenseVector<T> op3(size);
|
|
233
|
+
const T *elements1 = op1.getElements();
|
|
234
|
+
const T *elements2 = op2.getElements();
|
|
235
|
+
T *elements3 = op3.getElements();
|
|
236
|
+
for(int i=0; i<size; i++)
|
|
237
|
+
elements3[i] = elements1[i] - elements2[i];
|
|
238
|
+
return op3;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
|
|
242
|
+
/// Return the element-wise product of two dense vectors
|
|
243
|
+
template <typename T> inline
|
|
244
|
+
CoinDenseVector<T> operator*(const CoinDenseVector<T>& op1,
|
|
245
|
+
const CoinDenseVector<T>& op2){
|
|
246
|
+
assert(op1.size() == op2.size());
|
|
247
|
+
int size = op1.size();
|
|
248
|
+
CoinDenseVector<T> op3(size);
|
|
249
|
+
const T *elements1 = op1.getElements();
|
|
250
|
+
const T *elements2 = op2.getElements();
|
|
251
|
+
T *elements3 = op3.getElements();
|
|
252
|
+
for(int i=0; i<size; i++)
|
|
253
|
+
elements3[i] = elements1[i] * elements2[i];
|
|
254
|
+
return op3;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
/// Return the element-wise ratio of two dense vectors
|
|
258
|
+
template <typename T> inline
|
|
259
|
+
CoinDenseVector<T> operator/(const CoinDenseVector<T>& op1,
|
|
260
|
+
const CoinDenseVector<T>& op2){
|
|
261
|
+
assert(op1.size() == op2.size());
|
|
262
|
+
int size = op1.size();
|
|
263
|
+
CoinDenseVector<T> op3(size);
|
|
264
|
+
const T *elements1 = op1.getElements();
|
|
265
|
+
const T *elements2 = op2.getElements();
|
|
266
|
+
T *elements3 = op3.getElements();
|
|
267
|
+
for(int i=0; i<size; i++)
|
|
268
|
+
elements3[i] = elements1[i] / elements2[i];
|
|
269
|
+
return op3;
|
|
270
|
+
}
|
|
271
|
+
//@}
|
|
272
|
+
|
|
273
|
+
/**@name Arithmetic operators on dense vector and a constant.
|
|
274
|
+
These functions create a dense vector as a result. That dense vector will
|
|
275
|
+
have the same indices as <code>op1</code> and the specified operation is
|
|
276
|
+
done entry-wise with the given value. */
|
|
277
|
+
//@{
|
|
278
|
+
/// Return the sum of a dense vector and a constant
|
|
279
|
+
template <typename T> inline
|
|
280
|
+
CoinDenseVector<T> operator+(const CoinDenseVector<T>& op1, T value){
|
|
281
|
+
int size = op1.size();
|
|
282
|
+
CoinDenseVector<T> op3(size);
|
|
283
|
+
const T *elements1 = op1.getElements();
|
|
284
|
+
T *elements3 = op3.getElements();
|
|
285
|
+
double dvalue = value;
|
|
286
|
+
for(int i=0; i<size; i++)
|
|
287
|
+
elements3[i] = elements1[i] + dvalue;
|
|
288
|
+
return op3;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
/// Return the difference of a dense vector and a constant
|
|
292
|
+
template <typename T> inline
|
|
293
|
+
CoinDenseVector<T> operator-(const CoinDenseVector<T>& op1, T value){
|
|
294
|
+
int size = op1.size();
|
|
295
|
+
CoinDenseVector<T> op3(size);
|
|
296
|
+
const T *elements1 = op1.getElements();
|
|
297
|
+
T *elements3 = op3.getElements();
|
|
298
|
+
double dvalue = value;
|
|
299
|
+
for(int i=0; i<size; i++)
|
|
300
|
+
elements3[i] = elements1[i] - dvalue;
|
|
301
|
+
return op3;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
/// Return the element-wise product of a dense vector and a constant
|
|
305
|
+
template <typename T> inline
|
|
306
|
+
CoinDenseVector<T> operator*(const CoinDenseVector<T>& op1, T value){
|
|
307
|
+
int size = op1.size();
|
|
308
|
+
CoinDenseVector<T> op3(size);
|
|
309
|
+
const T *elements1 = op1.getElements();
|
|
310
|
+
T *elements3 = op3.getElements();
|
|
311
|
+
double dvalue = value;
|
|
312
|
+
for(int i=0; i<size; i++)
|
|
313
|
+
elements3[i] = elements1[i] * dvalue;
|
|
314
|
+
return op3;
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
/// Return the element-wise ratio of a dense vector and a constant
|
|
318
|
+
template <typename T> inline
|
|
319
|
+
CoinDenseVector<T> operator/(const CoinDenseVector<T>& op1, T value){
|
|
320
|
+
int size = op1.size();
|
|
321
|
+
CoinDenseVector<T> op3(size);
|
|
322
|
+
const T *elements1 = op1.getElements();
|
|
323
|
+
T *elements3 = op3.getElements();
|
|
324
|
+
double dvalue = value;
|
|
325
|
+
for(int i=0; i<size; i++)
|
|
326
|
+
elements3[i] = elements1[i] / dvalue;
|
|
327
|
+
return op3;
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
/// Return the sum of a constant and a dense vector
|
|
331
|
+
template <typename T> inline
|
|
332
|
+
CoinDenseVector<T> operator+(T value, const CoinDenseVector<T>& op1){
|
|
333
|
+
int size = op1.size();
|
|
334
|
+
CoinDenseVector<T> op3(size);
|
|
335
|
+
const T *elements1 = op1.getElements();
|
|
336
|
+
T *elements3 = op3.getElements();
|
|
337
|
+
double dvalue = value;
|
|
338
|
+
for(int i=0; i<size; i++)
|
|
339
|
+
elements3[i] = elements1[i] + dvalue;
|
|
340
|
+
return op3;
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
/// Return the difference of a constant and a dense vector
|
|
344
|
+
template <typename T> inline
|
|
345
|
+
CoinDenseVector<T> operator-(T value, const CoinDenseVector<T>& op1){
|
|
346
|
+
int size = op1.size();
|
|
347
|
+
CoinDenseVector<T> op3(size);
|
|
348
|
+
const T *elements1 = op1.getElements();
|
|
349
|
+
T *elements3 = op3.getElements();
|
|
350
|
+
double dvalue = value;
|
|
351
|
+
for(int i=0; i<size; i++)
|
|
352
|
+
elements3[i] = dvalue - elements1[i];
|
|
353
|
+
return op3;
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
/// Return the element-wise product of a constant and a dense vector
|
|
357
|
+
template <typename T> inline
|
|
358
|
+
CoinDenseVector<T> operator*(T value, const CoinDenseVector<T>& op1){
|
|
359
|
+
int size = op1.size();
|
|
360
|
+
CoinDenseVector<T> op3(size);
|
|
361
|
+
const T *elements1 = op1.getElements();
|
|
362
|
+
T *elements3 = op3.getElements();
|
|
363
|
+
double dvalue = value;
|
|
364
|
+
for(int i=0; i<size; i++)
|
|
365
|
+
elements3[i] = elements1[i] * dvalue;
|
|
366
|
+
return op3;
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
/// Return the element-wise ratio of a a constant and dense vector
|
|
370
|
+
template <typename T> inline
|
|
371
|
+
CoinDenseVector<T> operator/(T value, const CoinDenseVector<T>& op1){
|
|
372
|
+
int size = op1.size();
|
|
373
|
+
CoinDenseVector<T> op3(size);
|
|
374
|
+
const T *elements1 = op1.getElements();
|
|
375
|
+
T *elements3 = op3.getElements();
|
|
376
|
+
double dvalue = value;
|
|
377
|
+
for(int i=0; i<size; i++)
|
|
378
|
+
elements3[i] = dvalue / elements1[i];
|
|
379
|
+
return op3;
|
|
380
|
+
}
|
|
381
|
+
//@}
|
|
382
|
+
|
|
383
|
+
#endif
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/* $Id: CoinDistance.hpp 1372 2011-01-03 23:31:00Z lou $ */
|
|
2
|
+
// Copyright (C) 2000, 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 CoinDistance_H
|
|
7
|
+
#define CoinDistance_H
|
|
8
|
+
|
|
9
|
+
#include <iterator>
|
|
10
|
+
|
|
11
|
+
//-------------------------------------------------------------------
|
|
12
|
+
//
|
|
13
|
+
// Attempt to provide an std::distance function
|
|
14
|
+
// that will work on multiple platforms
|
|
15
|
+
//
|
|
16
|
+
//-------------------------------------------------------------------
|
|
17
|
+
|
|
18
|
+
/** CoinDistance
|
|
19
|
+
|
|
20
|
+
This is the Coin implementation of the std::function that is
|
|
21
|
+
designed to work on multiple platforms.
|
|
22
|
+
*/
|
|
23
|
+
template <class ForwardIterator, class Distance>
|
|
24
|
+
void coinDistance(ForwardIterator first, ForwardIterator last,
|
|
25
|
+
Distance& n)
|
|
26
|
+
{
|
|
27
|
+
#if defined(__SUNPRO_CC)
|
|
28
|
+
n = 0;
|
|
29
|
+
std::distance(first,last,n);
|
|
30
|
+
#else
|
|
31
|
+
n = std::distance(first,last);
|
|
32
|
+
#endif
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
template <class ForwardIterator>
|
|
36
|
+
size_t coinDistance(ForwardIterator first, ForwardIterator last)
|
|
37
|
+
{
|
|
38
|
+
size_t retVal;
|
|
39
|
+
#if defined(__SUNPRO_CC)
|
|
40
|
+
retVal = 0;
|
|
41
|
+
std::distance(first,last,retVal);
|
|
42
|
+
#else
|
|
43
|
+
retVal = std::distance(first,last);
|
|
44
|
+
#endif
|
|
45
|
+
return retVal;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
#endif
|
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
/* $Id: CoinError.hpp 1372 2011-01-03 23:31:00Z lou $ */
|
|
2
|
+
// Copyright (C) 2000, 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 CoinError_H
|
|
7
|
+
#define CoinError_H
|
|
8
|
+
|
|
9
|
+
#include <string>
|
|
10
|
+
#include <iostream>
|
|
11
|
+
#include <cassert>
|
|
12
|
+
#include <cstring>
|
|
13
|
+
|
|
14
|
+
#include "CoinUtilsConfig.h"
|
|
15
|
+
#include "CoinPragma.hpp"
|
|
16
|
+
|
|
17
|
+
/** A function to block the popup windows that windows creates when the code
|
|
18
|
+
crashes */
|
|
19
|
+
void WindowsErrorPopupBlocker();
|
|
20
|
+
|
|
21
|
+
//-------------------------------------------------------------------
|
|
22
|
+
//
|
|
23
|
+
// Error class used to throw exceptions
|
|
24
|
+
//
|
|
25
|
+
// Errors contain:
|
|
26
|
+
//
|
|
27
|
+
//-------------------------------------------------------------------
|
|
28
|
+
|
|
29
|
+
/** Error Class thrown by an exception
|
|
30
|
+
|
|
31
|
+
This class is used when exceptions are thrown.
|
|
32
|
+
It contains:
|
|
33
|
+
<ul>
|
|
34
|
+
<li>message text
|
|
35
|
+
<li>name of method throwing exception
|
|
36
|
+
<li>name of class throwing exception or hint
|
|
37
|
+
<li>name of file if assert
|
|
38
|
+
<li>line number
|
|
39
|
+
</ul>
|
|
40
|
+
For asserts class=> optional hint
|
|
41
|
+
*/
|
|
42
|
+
class CoinError {
|
|
43
|
+
friend void CoinErrorUnitTest();
|
|
44
|
+
|
|
45
|
+
private:
|
|
46
|
+
CoinError()
|
|
47
|
+
:
|
|
48
|
+
message_(),
|
|
49
|
+
method_(),
|
|
50
|
+
class_(),
|
|
51
|
+
file_(),
|
|
52
|
+
lineNumber_()
|
|
53
|
+
{
|
|
54
|
+
// nothing to do here
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
public:
|
|
58
|
+
|
|
59
|
+
//-------------------------------------------------------------------
|
|
60
|
+
// Get methods
|
|
61
|
+
//-------------------------------------------------------------------
|
|
62
|
+
/**@name Get error attributes */
|
|
63
|
+
//@{
|
|
64
|
+
/// get message text
|
|
65
|
+
inline const std::string & message() const
|
|
66
|
+
{ return message_; }
|
|
67
|
+
/// get name of method instantiating error
|
|
68
|
+
inline const std::string & methodName() const
|
|
69
|
+
{ return method_; }
|
|
70
|
+
/// get name of class instantiating error (or hint for assert)
|
|
71
|
+
inline const std::string & className() const
|
|
72
|
+
{ return class_; }
|
|
73
|
+
/// get name of file for assert
|
|
74
|
+
inline const std::string & fileName() const
|
|
75
|
+
{ return file_; }
|
|
76
|
+
/// get line number of assert (-1 if not assert)
|
|
77
|
+
inline int lineNumber() const
|
|
78
|
+
{ return lineNumber_; }
|
|
79
|
+
/// Just print (for asserts)
|
|
80
|
+
inline void print(bool doPrint = true) const
|
|
81
|
+
{
|
|
82
|
+
if (! doPrint)
|
|
83
|
+
return;
|
|
84
|
+
if (lineNumber_<0) {
|
|
85
|
+
std::cout<<message_<<" in "<<class_<<"::"<<method_<<std::endl;
|
|
86
|
+
} else {
|
|
87
|
+
std::cout<<file_<<":"<<lineNumber_<<" method "<<method_
|
|
88
|
+
<<" : assertion \'"<<message_<<"\' failed."<<std::endl;
|
|
89
|
+
if(class_!="")
|
|
90
|
+
std::cout<<"Possible reason: "<<class_<<std::endl;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
//@}
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
/**@name Constructors and destructors */
|
|
97
|
+
//@{
|
|
98
|
+
/// Alternate Constructor
|
|
99
|
+
CoinError (
|
|
100
|
+
std::string message__,
|
|
101
|
+
std::string methodName__,
|
|
102
|
+
std::string className__,
|
|
103
|
+
std::string fileName_ = std::string(),
|
|
104
|
+
int line = -1)
|
|
105
|
+
:
|
|
106
|
+
message_(message__),
|
|
107
|
+
method_(methodName__),
|
|
108
|
+
class_(className__),
|
|
109
|
+
file_(fileName_),
|
|
110
|
+
lineNumber_(line)
|
|
111
|
+
{
|
|
112
|
+
print(printErrors_);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/// Copy constructor
|
|
116
|
+
CoinError (const CoinError & source)
|
|
117
|
+
:
|
|
118
|
+
message_(source.message_),
|
|
119
|
+
method_(source.method_),
|
|
120
|
+
class_(source.class_),
|
|
121
|
+
file_(source.file_),
|
|
122
|
+
lineNumber_(source.lineNumber_)
|
|
123
|
+
{
|
|
124
|
+
// nothing to do here
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/// Assignment operator
|
|
128
|
+
CoinError & operator=(const CoinError& rhs)
|
|
129
|
+
{
|
|
130
|
+
if (this != &rhs) {
|
|
131
|
+
message_=rhs.message_;
|
|
132
|
+
method_=rhs.method_;
|
|
133
|
+
class_=rhs.class_;
|
|
134
|
+
file_=rhs.file_;
|
|
135
|
+
lineNumber_ = rhs.lineNumber_;
|
|
136
|
+
}
|
|
137
|
+
return *this;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/// Destructor
|
|
141
|
+
virtual ~CoinError ()
|
|
142
|
+
{
|
|
143
|
+
// nothing to do here
|
|
144
|
+
}
|
|
145
|
+
//@}
|
|
146
|
+
|
|
147
|
+
private:
|
|
148
|
+
|
|
149
|
+
/**@name Private member data */
|
|
150
|
+
//@{
|
|
151
|
+
/// message test
|
|
152
|
+
std::string message_;
|
|
153
|
+
/// method name
|
|
154
|
+
std::string method_;
|
|
155
|
+
/// class name or hint
|
|
156
|
+
std::string class_;
|
|
157
|
+
/// file name
|
|
158
|
+
std::string file_;
|
|
159
|
+
/// Line number
|
|
160
|
+
int lineNumber_;
|
|
161
|
+
//@}
|
|
162
|
+
|
|
163
|
+
public:
|
|
164
|
+
/// Whether to print every error
|
|
165
|
+
static bool printErrors_;
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
#ifndef __STRING
|
|
169
|
+
#define __STRING(x) #x
|
|
170
|
+
#endif
|
|
171
|
+
|
|
172
|
+
#ifndef __GNUC_PREREQ
|
|
173
|
+
# define __GNUC_PREREQ(maj, min) (0)
|
|
174
|
+
#endif
|
|
175
|
+
|
|
176
|
+
#ifndef COIN_ASSERT
|
|
177
|
+
# define CoinAssertDebug(expression) assert(expression)
|
|
178
|
+
# define CoinAssertDebugHint(expression,hint) assert(expression)
|
|
179
|
+
# define CoinAssert(expression) assert(expression)
|
|
180
|
+
# define CoinAssertHint(expression,hint) assert(expression)
|
|
181
|
+
#else
|
|
182
|
+
# ifdef NDEBUG
|
|
183
|
+
# define CoinAssertDebug(expression) {}
|
|
184
|
+
# define CoinAssertDebugHint(expression,hint) {}
|
|
185
|
+
# else
|
|
186
|
+
# if defined(__GNUC__) && __GNUC_PREREQ(2, 6)
|
|
187
|
+
# define CoinAssertDebug(expression) { \
|
|
188
|
+
if (!(expression)) { \
|
|
189
|
+
throw CoinError(__STRING(expression), __PRETTY_FUNCTION__, \
|
|
190
|
+
"", __FILE__, __LINE__); \
|
|
191
|
+
} \
|
|
192
|
+
}
|
|
193
|
+
# define CoinAssertDebugHint(expression,hint) { \
|
|
194
|
+
if (!(expression)) { \
|
|
195
|
+
throw CoinError(__STRING(expression), __PRETTY_FUNCTION__, \
|
|
196
|
+
hint, __FILE__,__LINE__); \
|
|
197
|
+
} \
|
|
198
|
+
}
|
|
199
|
+
# else
|
|
200
|
+
# define CoinAssertDebug(expression) { \
|
|
201
|
+
if (!(expression)) { \
|
|
202
|
+
throw CoinError(__STRING(expression), "", \
|
|
203
|
+
"", __FILE__,__LINE__); \
|
|
204
|
+
} \
|
|
205
|
+
}
|
|
206
|
+
# define CoinAssertDebugHint(expression,hint) { \
|
|
207
|
+
if (!(expression)) { \
|
|
208
|
+
throw CoinError(__STRING(expression), "", \
|
|
209
|
+
hint, __FILE__,__LINE__); \
|
|
210
|
+
} \
|
|
211
|
+
}
|
|
212
|
+
# endif
|
|
213
|
+
# endif
|
|
214
|
+
# if defined(__GNUC__) && __GNUC_PREREQ(2, 6)
|
|
215
|
+
# define CoinAssert(expression) { \
|
|
216
|
+
if (!(expression)) { \
|
|
217
|
+
throw CoinError(__STRING(expression), __PRETTY_FUNCTION__, \
|
|
218
|
+
"", __FILE__, __LINE__); \
|
|
219
|
+
} \
|
|
220
|
+
}
|
|
221
|
+
# define CoinAssertHint(expression,hint) { \
|
|
222
|
+
if (!(expression)) { \
|
|
223
|
+
throw CoinError(__STRING(expression), __PRETTY_FUNCTION__, \
|
|
224
|
+
hint, __FILE__,__LINE__); \
|
|
225
|
+
} \
|
|
226
|
+
}
|
|
227
|
+
# else
|
|
228
|
+
# define CoinAssert(expression) { \
|
|
229
|
+
if (!(expression)) { \
|
|
230
|
+
throw CoinError(__STRING(expression), "", \
|
|
231
|
+
"", __FILE__,__LINE__); \
|
|
232
|
+
} \
|
|
233
|
+
}
|
|
234
|
+
# define CoinAssertHint(expression,hint) { \
|
|
235
|
+
if (!(expression)) { \
|
|
236
|
+
throw CoinError(__STRING(expression), "", \
|
|
237
|
+
hint, __FILE__,__LINE__); \
|
|
238
|
+
} \
|
|
239
|
+
}
|
|
240
|
+
# endif
|
|
241
|
+
#endif
|
|
242
|
+
|
|
243
|
+
|
|
244
|
+
//#############################################################################
|
|
245
|
+
/** A function that tests the methods in the CoinError class. The
|
|
246
|
+
only reason for it not to be a member method is that this way it doesn't
|
|
247
|
+
have to be compiled into the library. And that's a gain, because the
|
|
248
|
+
library should be compiled with optimization on, but this method should be
|
|
249
|
+
compiled with debugging. */
|
|
250
|
+
void
|
|
251
|
+
CoinErrorUnitTest();
|
|
252
|
+
|
|
253
|
+
#ifdef __LINE__
|
|
254
|
+
#define CoinErrorFL(x, y, z) CoinError((x), (y), (z), __FILE__, __LINE__)
|
|
255
|
+
#endif
|
|
256
|
+
|
|
257
|
+
#endif
|