ruby-cbc 0.1.9 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +5 -5
- data/Rakefile +0 -2
- data/lib/ruby-cbc.rb +1 -1
- data/lib/ruby-cbc/problem.rb +6 -8
- data/lib/ruby-cbc/version.rb +1 -1
- data/ruby-cbc.gemspec +3 -2
- metadata +17 -287
- data/ext/ruby-cbc/cbc.i +0 -15
- data/ext/ruby-cbc/cbc_wrap.c +0 -4618
- data/ext/ruby-cbc/extconf.rb +0 -60
- 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 +0 -24
- data/ext/ruby-cbc/install/include/coin/CbcBranchAllDifferent.hpp +0 -62
- data/ext/ruby-cbc/install/include/coin/CbcBranchBase.hpp +0 -78
- data/ext/ruby-cbc/install/include/coin/CbcBranchCut.hpp +0 -183
- data/ext/ruby-cbc/install/include/coin/CbcBranchDecision.hpp +0 -129
- data/ext/ruby-cbc/install/include/coin/CbcBranchDefaultDecision.hpp +0 -100
- data/ext/ruby-cbc/install/include/coin/CbcBranchDynamic.hpp +0 -206
- data/ext/ruby-cbc/install/include/coin/CbcBranchLotsize.hpp +0 -242
- data/ext/ruby-cbc/install/include/coin/CbcBranchToFixLots.hpp +0 -94
- data/ext/ruby-cbc/install/include/coin/CbcBranchingObject.hpp +0 -236
- data/ext/ruby-cbc/install/include/coin/CbcClique.hpp +0 -303
- data/ext/ruby-cbc/install/include/coin/CbcCompare.hpp +0 -39
- data/ext/ruby-cbc/install/include/coin/CbcCompareActual.hpp +0 -14
- data/ext/ruby-cbc/install/include/coin/CbcCompareBase.hpp +0 -142
- data/ext/ruby-cbc/install/include/coin/CbcCompareDefault.hpp +0 -120
- data/ext/ruby-cbc/install/include/coin/CbcCompareDepth.hpp +0 -47
- data/ext/ruby-cbc/install/include/coin/CbcCompareEstimate.hpp +0 -48
- data/ext/ruby-cbc/install/include/coin/CbcCompareObjective.hpp +0 -49
- data/ext/ruby-cbc/install/include/coin/CbcConfig.h +0 -14
- data/ext/ruby-cbc/install/include/coin/CbcConsequence.hpp +0 -49
- data/ext/ruby-cbc/install/include/coin/CbcCountRowCut.hpp +0 -168
- data/ext/ruby-cbc/install/include/coin/CbcCutGenerator.hpp +0 -482
- data/ext/ruby-cbc/install/include/coin/CbcCutModifier.hpp +0 -57
- data/ext/ruby-cbc/install/include/coin/CbcCutSubsetModifier.hpp +0 -66
- data/ext/ruby-cbc/install/include/coin/CbcDummyBranchingObject.hpp +0 -83
- data/ext/ruby-cbc/install/include/coin/CbcEventHandler.hpp +0 -245
- data/ext/ruby-cbc/install/include/coin/CbcFathom.hpp +0 -137
- data/ext/ruby-cbc/install/include/coin/CbcFathomDynamicProgramming.hpp +0 -169
- data/ext/ruby-cbc/install/include/coin/CbcFeasibilityBase.hpp +0 -56
- data/ext/ruby-cbc/install/include/coin/CbcFixVariable.hpp +0 -67
- data/ext/ruby-cbc/install/include/coin/CbcFollowOn.hpp +0 -207
- data/ext/ruby-cbc/install/include/coin/CbcFullNodeInfo.hpp +0 -161
- data/ext/ruby-cbc/install/include/coin/CbcGeneral.hpp +0 -60
- data/ext/ruby-cbc/install/include/coin/CbcGeneralDepth.hpp +0 -279
- data/ext/ruby-cbc/install/include/coin/CbcHeuristic.hpp +0 -682
- data/ext/ruby-cbc/install/include/coin/CbcHeuristicDINS.hpp +0 -96
- data/ext/ruby-cbc/install/include/coin/CbcHeuristicDW.hpp +0 -309
- data/ext/ruby-cbc/install/include/coin/CbcHeuristicDive.hpp +0 -192
- data/ext/ruby-cbc/install/include/coin/CbcHeuristicDiveCoefficient.hpp +0 -52
- data/ext/ruby-cbc/install/include/coin/CbcHeuristicDiveFractional.hpp +0 -52
- data/ext/ruby-cbc/install/include/coin/CbcHeuristicDiveGuided.hpp +0 -55
- data/ext/ruby-cbc/install/include/coin/CbcHeuristicDiveLineSearch.hpp +0 -52
- data/ext/ruby-cbc/install/include/coin/CbcHeuristicDivePseudoCost.hpp +0 -60
- data/ext/ruby-cbc/install/include/coin/CbcHeuristicDiveVectorLength.hpp +0 -52
- data/ext/ruby-cbc/install/include/coin/CbcHeuristicFPump.hpp +0 -340
- data/ext/ruby-cbc/install/include/coin/CbcHeuristicGreedy.hpp +0 -280
- data/ext/ruby-cbc/install/include/coin/CbcHeuristicLocal.hpp +0 -271
- data/ext/ruby-cbc/install/include/coin/CbcHeuristicPivotAndFix.hpp +0 -58
- data/ext/ruby-cbc/install/include/coin/CbcHeuristicRENS.hpp +0 -77
- data/ext/ruby-cbc/install/include/coin/CbcHeuristicRINS.hpp +0 -102
- data/ext/ruby-cbc/install/include/coin/CbcHeuristicRandRound.hpp +0 -58
- data/ext/ruby-cbc/install/include/coin/CbcHeuristicVND.hpp +0 -94
- data/ext/ruby-cbc/install/include/coin/CbcLinked.hpp +0 -1406
- data/ext/ruby-cbc/install/include/coin/CbcMessage.hpp +0 -94
- data/ext/ruby-cbc/install/include/coin/CbcMipStartIO.hpp +0 -26
- data/ext/ruby-cbc/install/include/coin/CbcModel.hpp +0 -2952
- data/ext/ruby-cbc/install/include/coin/CbcNWay.hpp +0 -166
- data/ext/ruby-cbc/install/include/coin/CbcNode.hpp +0 -351
- data/ext/ruby-cbc/install/include/coin/CbcNodeInfo.hpp +0 -349
- data/ext/ruby-cbc/install/include/coin/CbcObject.hpp +0 -272
- data/ext/ruby-cbc/install/include/coin/CbcObjectUpdateData.hpp +0 -64
- data/ext/ruby-cbc/install/include/coin/CbcOrClpParam.cpp +0 -4134
- data/ext/ruby-cbc/install/include/coin/CbcOrClpParam.hpp +0 -532
- data/ext/ruby-cbc/install/include/coin/CbcParam.hpp +0 -324
- data/ext/ruby-cbc/install/include/coin/CbcPartialNodeInfo.hpp +0 -110
- data/ext/ruby-cbc/install/include/coin/CbcSOS.hpp +0 -279
- data/ext/ruby-cbc/install/include/coin/CbcSimpleInteger.hpp +0 -286
- data/ext/ruby-cbc/install/include/coin/CbcSimpleIntegerDynamicPseudoCost.hpp +0 -564
- data/ext/ruby-cbc/install/include/coin/CbcSimpleIntegerPseudoCost.hpp +0 -114
- data/ext/ruby-cbc/install/include/coin/CbcSolver.hpp +0 -447
- data/ext/ruby-cbc/install/include/coin/CbcStrategy.hpp +0 -258
- data/ext/ruby-cbc/install/include/coin/CbcSubProblem.hpp +0 -83
- data/ext/ruby-cbc/install/include/coin/CbcTree.hpp +0 -490
- data/ext/ruby-cbc/install/include/coin/CbcTreeLocal.hpp +0 -372
- data/ext/ruby-cbc/install/include/coin/Cbc_C_Interface.h +0 -381
- data/ext/ruby-cbc/install/include/coin/Cgl012cut.hpp +0 -464
- data/ext/ruby-cbc/install/include/coin/CglAllDifferent.hpp +0 -115
- data/ext/ruby-cbc/install/include/coin/CglClique.hpp +0 -308
- data/ext/ruby-cbc/install/include/coin/CglConfig.h +0 -19
- data/ext/ruby-cbc/install/include/coin/CglCutGenerator.hpp +0 -121
- data/ext/ruby-cbc/install/include/coin/CglDuplicateRow.hpp +0 -189
- data/ext/ruby-cbc/install/include/coin/CglFlowCover.hpp +0 -371
- data/ext/ruby-cbc/install/include/coin/CglGMI.hpp +0 -364
- data/ext/ruby-cbc/install/include/coin/CglGMIParam.hpp +0 -313
- data/ext/ruby-cbc/install/include/coin/CglGomory.hpp +0 -204
- data/ext/ruby-cbc/install/include/coin/CglKnapsackCover.hpp +0 -310
- data/ext/ruby-cbc/install/include/coin/CglLandP.hpp +0 -306
- data/ext/ruby-cbc/install/include/coin/CglLandPValidator.hpp +0 -130
- data/ext/ruby-cbc/install/include/coin/CglLiftAndProject.hpp +0 -104
- data/ext/ruby-cbc/install/include/coin/CglMessage.hpp +0 -50
- data/ext/ruby-cbc/install/include/coin/CglMixedIntegerRounding.hpp +0 -429
- data/ext/ruby-cbc/install/include/coin/CglMixedIntegerRounding2.hpp +0 -427
- data/ext/ruby-cbc/install/include/coin/CglOddHole.hpp +0 -160
- data/ext/ruby-cbc/install/include/coin/CglParam.hpp +0 -93
- data/ext/ruby-cbc/install/include/coin/CglPreProcess.hpp +0 -492
- data/ext/ruby-cbc/install/include/coin/CglProbing.hpp +0 -543
- data/ext/ruby-cbc/install/include/coin/CglRedSplit.hpp +0 -448
- data/ext/ruby-cbc/install/include/coin/CglRedSplit2.hpp +0 -494
- data/ext/ruby-cbc/install/include/coin/CglRedSplit2Param.hpp +0 -495
- data/ext/ruby-cbc/install/include/coin/CglRedSplitParam.hpp +0 -272
- data/ext/ruby-cbc/install/include/coin/CglResidualCapacity.hpp +0 -240
- data/ext/ruby-cbc/install/include/coin/CglSimpleRounding.hpp +0 -174
- data/ext/ruby-cbc/install/include/coin/CglStored.hpp +0 -125
- data/ext/ruby-cbc/install/include/coin/CglTreeInfo.hpp +0 -180
- data/ext/ruby-cbc/install/include/coin/CglTwomir.hpp +0 -565
- data/ext/ruby-cbc/install/include/coin/CglZeroHalf.hpp +0 -133
- data/ext/ruby-cbc/install/include/coin/ClpAmplObjective.hpp +0 -113
- data/ext/ruby-cbc/install/include/coin/ClpCholeskyBase.hpp +0 -294
- data/ext/ruby-cbc/install/include/coin/ClpCholeskyDense.hpp +0 -162
- data/ext/ruby-cbc/install/include/coin/ClpConfig.h +0 -17
- data/ext/ruby-cbc/install/include/coin/ClpConstraint.hpp +0 -125
- data/ext/ruby-cbc/install/include/coin/ClpConstraintAmpl.hpp +0 -108
- data/ext/ruby-cbc/install/include/coin/ClpConstraintLinear.hpp +0 -110
- data/ext/ruby-cbc/install/include/coin/ClpConstraintQuadratic.hpp +0 -119
- data/ext/ruby-cbc/install/include/coin/ClpDualRowDantzig.hpp +0 -71
- data/ext/ruby-cbc/install/include/coin/ClpDualRowPivot.hpp +0 -129
- data/ext/ruby-cbc/install/include/coin/ClpDualRowSteepest.hpp +0 -153
- data/ext/ruby-cbc/install/include/coin/ClpDummyMatrix.hpp +0 -183
- data/ext/ruby-cbc/install/include/coin/ClpDynamicExampleMatrix.hpp +0 -186
- data/ext/ruby-cbc/install/include/coin/ClpDynamicMatrix.hpp +0 -381
- data/ext/ruby-cbc/install/include/coin/ClpEventHandler.hpp +0 -187
- data/ext/ruby-cbc/install/include/coin/ClpFactorization.hpp +0 -432
- data/ext/ruby-cbc/install/include/coin/ClpGubDynamicMatrix.hpp +0 -247
- data/ext/ruby-cbc/install/include/coin/ClpGubMatrix.hpp +0 -358
- data/ext/ruby-cbc/install/include/coin/ClpInterior.hpp +0 -570
- data/ext/ruby-cbc/install/include/coin/ClpLinearObjective.hpp +0 -103
- data/ext/ruby-cbc/install/include/coin/ClpMatrixBase.hpp +0 -524
- data/ext/ruby-cbc/install/include/coin/ClpMessage.hpp +0 -131
- data/ext/ruby-cbc/install/include/coin/ClpModel.hpp +0 -1307
- data/ext/ruby-cbc/install/include/coin/ClpNetworkMatrix.hpp +0 -229
- data/ext/ruby-cbc/install/include/coin/ClpNode.hpp +0 -349
- data/ext/ruby-cbc/install/include/coin/ClpNonLinearCost.hpp +0 -401
- data/ext/ruby-cbc/install/include/coin/ClpObjective.hpp +0 -134
- data/ext/ruby-cbc/install/include/coin/ClpPackedMatrix.hpp +0 -638
- data/ext/ruby-cbc/install/include/coin/ClpParameters.hpp +0 -126
- data/ext/ruby-cbc/install/include/coin/ClpPdcoBase.hpp +0 -103
- data/ext/ruby-cbc/install/include/coin/ClpPlusMinusOneMatrix.hpp +0 -290
- data/ext/ruby-cbc/install/include/coin/ClpPresolve.hpp +0 -299
- data/ext/ruby-cbc/install/include/coin/ClpPrimalColumnDantzig.hpp +0 -72
- data/ext/ruby-cbc/install/include/coin/ClpPrimalColumnPivot.hpp +0 -155
- data/ext/ruby-cbc/install/include/coin/ClpPrimalColumnSteepest.hpp +0 -247
- data/ext/ruby-cbc/install/include/coin/ClpQuadraticObjective.hpp +0 -155
- data/ext/ruby-cbc/install/include/coin/ClpSimplex.hpp +0 -1797
- data/ext/ruby-cbc/install/include/coin/ClpSimplexDual.hpp +0 -300
- data/ext/ruby-cbc/install/include/coin/ClpSimplexNonlinear.hpp +0 -117
- data/ext/ruby-cbc/install/include/coin/ClpSimplexOther.hpp +0 -277
- data/ext/ruby-cbc/install/include/coin/ClpSimplexPrimal.hpp +0 -244
- data/ext/ruby-cbc/install/include/coin/ClpSolve.hpp +0 -446
- data/ext/ruby-cbc/install/include/coin/Clp_C_Interface.h +0 -525
- data/ext/ruby-cbc/install/include/coin/CoinAlloc.hpp +0 -176
- data/ext/ruby-cbc/install/include/coin/CoinBuild.hpp +0 -149
- data/ext/ruby-cbc/install/include/coin/CoinDenseFactorization.hpp +0 -419
- data/ext/ruby-cbc/install/include/coin/CoinDenseVector.hpp +0 -383
- data/ext/ruby-cbc/install/include/coin/CoinDistance.hpp +0 -48
- data/ext/ruby-cbc/install/include/coin/CoinError.hpp +0 -257
- data/ext/ruby-cbc/install/include/coin/CoinFactorization.hpp +0 -2044
- data/ext/ruby-cbc/install/include/coin/CoinFileIO.hpp +0 -166
- data/ext/ruby-cbc/install/include/coin/CoinFinite.hpp +0 -34
- data/ext/ruby-cbc/install/include/coin/CoinFloatEqual.hpp +0 -177
- data/ext/ruby-cbc/install/include/coin/CoinHelperFunctions.hpp +0 -1111
- data/ext/ruby-cbc/install/include/coin/CoinIndexedVector.hpp +0 -1164
- data/ext/ruby-cbc/install/include/coin/CoinLpIO.hpp +0 -805
- data/ext/ruby-cbc/install/include/coin/CoinMessage.hpp +0 -96
- data/ext/ruby-cbc/install/include/coin/CoinMessageHandler.hpp +0 -666
- data/ext/ruby-cbc/install/include/coin/CoinModel.hpp +0 -1054
- data/ext/ruby-cbc/install/include/coin/CoinModelUseful.hpp +0 -441
- data/ext/ruby-cbc/install/include/coin/CoinMpsIO.hpp +0 -1056
- data/ext/ruby-cbc/install/include/coin/CoinOslFactorization.hpp +0 -280
- data/ext/ruby-cbc/install/include/coin/CoinPackedMatrix.hpp +0 -947
- data/ext/ruby-cbc/install/include/coin/CoinPackedVector.hpp +0 -657
- data/ext/ruby-cbc/install/include/coin/CoinPackedVectorBase.hpp +0 -269
- data/ext/ruby-cbc/install/include/coin/CoinParam.hpp +0 -644
- data/ext/ruby-cbc/install/include/coin/CoinPragma.hpp +0 -26
- data/ext/ruby-cbc/install/include/coin/CoinPresolveDoubleton.hpp +0 -73
- data/ext/ruby-cbc/install/include/coin/CoinPresolveDual.hpp +0 -85
- data/ext/ruby-cbc/install/include/coin/CoinPresolveDupcol.hpp +0 -226
- data/ext/ruby-cbc/install/include/coin/CoinPresolveEmpty.hpp +0 -116
- data/ext/ruby-cbc/install/include/coin/CoinPresolveFixed.hpp +0 -181
- data/ext/ruby-cbc/install/include/coin/CoinPresolveForcing.hpp +0 -61
- data/ext/ruby-cbc/install/include/coin/CoinPresolveImpliedFree.hpp +0 -60
- data/ext/ruby-cbc/install/include/coin/CoinPresolveIsolated.hpp +0 -51
- data/ext/ruby-cbc/install/include/coin/CoinPresolveMatrix.hpp +0 -1842
- data/ext/ruby-cbc/install/include/coin/CoinPresolveMonitor.hpp +0 -105
- data/ext/ruby-cbc/install/include/coin/CoinPresolvePsdebug.hpp +0 -166
- data/ext/ruby-cbc/install/include/coin/CoinPresolveSingleton.hpp +0 -112
- data/ext/ruby-cbc/install/include/coin/CoinPresolveSubst.hpp +0 -101
- data/ext/ruby-cbc/install/include/coin/CoinPresolveTighten.hpp +0 -55
- data/ext/ruby-cbc/install/include/coin/CoinPresolveTripleton.hpp +0 -66
- data/ext/ruby-cbc/install/include/coin/CoinPresolveUseless.hpp +0 -63
- data/ext/ruby-cbc/install/include/coin/CoinPresolveZeros.hpp +0 -60
- data/ext/ruby-cbc/install/include/coin/CoinRational.hpp +0 -44
- data/ext/ruby-cbc/install/include/coin/CoinSearchTree.hpp +0 -465
- data/ext/ruby-cbc/install/include/coin/CoinShallowPackedVector.hpp +0 -148
- data/ext/ruby-cbc/install/include/coin/CoinSignal.hpp +0 -117
- data/ext/ruby-cbc/install/include/coin/CoinSimpFactorization.hpp +0 -431
- data/ext/ruby-cbc/install/include/coin/CoinSmartPtr.hpp +0 -528
- data/ext/ruby-cbc/install/include/coin/CoinSnapshot.hpp +0 -476
- data/ext/ruby-cbc/install/include/coin/CoinSort.hpp +0 -678
- data/ext/ruby-cbc/install/include/coin/CoinStructuredModel.hpp +0 -247
- data/ext/ruby-cbc/install/include/coin/CoinTime.hpp +0 -310
- data/ext/ruby-cbc/install/include/coin/CoinTypes.hpp +0 -64
- data/ext/ruby-cbc/install/include/coin/CoinUtility.hpp +0 -19
- data/ext/ruby-cbc/install/include/coin/CoinUtilsConfig.h +0 -34
- data/ext/ruby-cbc/install/include/coin/CoinWarmStart.hpp +0 -58
- data/ext/ruby-cbc/install/include/coin/CoinWarmStartBasis.hpp +0 -456
- data/ext/ruby-cbc/install/include/coin/CoinWarmStartDual.hpp +0 -166
- data/ext/ruby-cbc/install/include/coin/CoinWarmStartPrimalDual.hpp +0 -211
- data/ext/ruby-cbc/install/include/coin/CoinWarmStartVector.hpp +0 -488
- data/ext/ruby-cbc/install/include/coin/Coin_C_defines.h +0 -115
- data/ext/ruby-cbc/install/include/coin/Idiot.hpp +0 -298
- data/ext/ruby-cbc/install/include/coin/OsiAuxInfo.hpp +0 -206
- data/ext/ruby-cbc/install/include/coin/OsiBranchingObject.hpp +0 -1005
- data/ext/ruby-cbc/install/include/coin/OsiCbcSolverInterface.hpp +0 -764
- data/ext/ruby-cbc/install/include/coin/OsiChooseVariable.hpp +0 -534
- data/ext/ruby-cbc/install/include/coin/OsiClpSolverInterface.hpp +0 -1509
- data/ext/ruby-cbc/install/include/coin/OsiColCut.hpp +0 -324
- data/ext/ruby-cbc/install/include/coin/OsiCollections.hpp +0 -35
- data/ext/ruby-cbc/install/include/coin/OsiConfig.h +0 -19
- data/ext/ruby-cbc/install/include/coin/OsiCut.hpp +0 -245
- data/ext/ruby-cbc/install/include/coin/OsiCuts.hpp +0 -474
- data/ext/ruby-cbc/install/include/coin/OsiPresolve.hpp +0 -252
- data/ext/ruby-cbc/install/include/coin/OsiRowCut.hpp +0 -331
- data/ext/ruby-cbc/install/include/coin/OsiRowCutDebugger.hpp +0 -187
- data/ext/ruby-cbc/install/include/coin/OsiSolverBranch.hpp +0 -152
- data/ext/ruby-cbc/install/include/coin/OsiSolverInterface.hpp +0 -2143
- data/ext/ruby-cbc/install/include/coin/OsiSolverParameters.hpp +0 -142
- data/ext/ruby-cbc/install/include/coin/OsiUnitTests.hpp +0 -374
- data/ext/ruby-cbc/install/lib/libCbc.la +0 -35
- 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 +0 -35
- 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 +0 -35
- 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 +0 -35
- 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 +0 -35
- 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 +0 -35
- 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 +0 -35
- 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 +0 -35
- 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 +0 -35
- 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 +0 -35
- 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 +0 -12
- data/ext/ruby-cbc/install/lib/pkgconfig/cgl.pc +0 -12
- data/ext/ruby-cbc/install/lib/pkgconfig/clp.pc +0 -12
- data/ext/ruby-cbc/install/lib/pkgconfig/coindatamiplib3.pc +0 -9
- data/ext/ruby-cbc/install/lib/pkgconfig/coindatasample.pc +0 -9
- data/ext/ruby-cbc/install/lib/pkgconfig/coinutils.pc +0 -12
- data/ext/ruby-cbc/install/lib/pkgconfig/osi-cbc.pc +0 -12
- data/ext/ruby-cbc/install/lib/pkgconfig/osi-clp.pc +0 -12
- data/ext/ruby-cbc/install/lib/pkgconfig/osi-unittests.pc +0 -12
- data/ext/ruby-cbc/install/lib/pkgconfig/osi.pc +0 -12
@@ -1,2044 +0,0 @@
|
|
1
|
-
/* $Id: CoinFactorization.hpp 1767 2015-01-05 12:36:13Z forrest $ */
|
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
|
-
/*
|
7
|
-
Authors
|
8
|
-
|
9
|
-
John Forrest
|
10
|
-
|
11
|
-
*/
|
12
|
-
#ifndef CoinFactorization_H
|
13
|
-
#define CoinFactorization_H
|
14
|
-
//#define COIN_ONE_ETA_COPY 100
|
15
|
-
|
16
|
-
#include <iostream>
|
17
|
-
#include <string>
|
18
|
-
#include <cassert>
|
19
|
-
#include <cstdio>
|
20
|
-
#include <cmath>
|
21
|
-
#include "CoinTypes.hpp"
|
22
|
-
#include "CoinIndexedVector.hpp"
|
23
|
-
|
24
|
-
class CoinPackedMatrix;
|
25
|
-
/** This deals with Factorization and Updates
|
26
|
-
|
27
|
-
This class started with a parallel simplex code I was writing in the
|
28
|
-
mid 90's. The need for parallelism led to many complications and
|
29
|
-
I have simplified as much as I could to get back to this.
|
30
|
-
|
31
|
-
I was aiming at problems where I might get speed-up so I was looking at dense
|
32
|
-
problems or ones with structure. This led to permuting input and output
|
33
|
-
vectors and to increasing the number of rows each rank-one update. This is
|
34
|
-
still in as a minor overhead.
|
35
|
-
|
36
|
-
I have also put in handling for hyper-sparsity. I have taken out
|
37
|
-
all outer loop unrolling, dense matrix handling and most of the
|
38
|
-
book-keeping for slacks. Also I always use FTRAN approach to updating
|
39
|
-
even if factorization fairly dense. All these could improve performance.
|
40
|
-
|
41
|
-
I blame some of the coding peculiarities on the history of the code
|
42
|
-
but mostly it is just because I can't do elegant code (or useful
|
43
|
-
comments).
|
44
|
-
|
45
|
-
I am assuming that 32 bits is enough for number of rows or columns, but CoinBigIndex
|
46
|
-
may be redefined to get 64 bits.
|
47
|
-
*/
|
48
|
-
|
49
|
-
|
50
|
-
class CoinFactorization {
|
51
|
-
friend void CoinFactorizationUnitTest( const std::string & mpsDir );
|
52
|
-
|
53
|
-
public:
|
54
|
-
|
55
|
-
/**@name Constructors and destructor and copy */
|
56
|
-
//@{
|
57
|
-
/// Default constructor
|
58
|
-
CoinFactorization ( );
|
59
|
-
/// Copy constructor
|
60
|
-
CoinFactorization ( const CoinFactorization &other);
|
61
|
-
|
62
|
-
/// Destructor
|
63
|
-
~CoinFactorization ( );
|
64
|
-
/// Delete all stuff (leaves as after CoinFactorization())
|
65
|
-
void almostDestructor();
|
66
|
-
/// Debug show object (shows one representation)
|
67
|
-
void show_self ( ) const;
|
68
|
-
/// Debug - save on file - 0 if no error
|
69
|
-
int saveFactorization (const char * file ) const;
|
70
|
-
/** Debug - restore from file - 0 if no error on file.
|
71
|
-
If factor true then factorizes as if called from ClpFactorization
|
72
|
-
*/
|
73
|
-
int restoreFactorization (const char * file , bool factor=false) ;
|
74
|
-
/// Debug - sort so can compare
|
75
|
-
void sort ( ) const;
|
76
|
-
/// = copy
|
77
|
-
CoinFactorization & operator = ( const CoinFactorization & other );
|
78
|
-
//@}
|
79
|
-
|
80
|
-
/**@name Do factorization */
|
81
|
-
//@{
|
82
|
-
/** When part of LP - given by basic variables.
|
83
|
-
Actually does factorization.
|
84
|
-
Arrays passed in have non negative value to say basic.
|
85
|
-
If status is okay, basic variables have pivot row - this is only needed
|
86
|
-
If status is singular, then basic variables have pivot row
|
87
|
-
and ones thrown out have -1
|
88
|
-
returns 0 -okay, -1 singular, -2 too many in basis, -99 memory */
|
89
|
-
int factorize ( const CoinPackedMatrix & matrix,
|
90
|
-
int rowIsBasic[], int columnIsBasic[] ,
|
91
|
-
double areaFactor = 0.0 );
|
92
|
-
/** When given as triplets.
|
93
|
-
Actually does factorization. maximumL is guessed maximum size of L part of
|
94
|
-
final factorization, maximumU of U part. These are multiplied by
|
95
|
-
areaFactor which can be computed by user or internally.
|
96
|
-
Arrays are copied in. I could add flag to delete arrays to save a
|
97
|
-
bit of memory.
|
98
|
-
If status okay, permutation has pivot rows - this is only needed
|
99
|
-
If status is singular, then basic variables have pivot row
|
100
|
-
and ones thrown out have -1
|
101
|
-
returns 0 -okay, -1 singular, -99 memory */
|
102
|
-
int factorize ( int numberRows,
|
103
|
-
int numberColumns,
|
104
|
-
CoinBigIndex numberElements,
|
105
|
-
CoinBigIndex maximumL,
|
106
|
-
CoinBigIndex maximumU,
|
107
|
-
const int indicesRow[],
|
108
|
-
const int indicesColumn[], const double elements[] ,
|
109
|
-
int permutation[],
|
110
|
-
double areaFactor = 0.0);
|
111
|
-
/** Two part version for maximum flexibility
|
112
|
-
This part creates arrays for user to fill.
|
113
|
-
estimateNumberElements is safe estimate of number
|
114
|
-
returns 0 -okay, -99 memory */
|
115
|
-
int factorizePart1 ( int numberRows,
|
116
|
-
int numberColumns,
|
117
|
-
CoinBigIndex estimateNumberElements,
|
118
|
-
int * indicesRow[],
|
119
|
-
int * indicesColumn[],
|
120
|
-
CoinFactorizationDouble * elements[],
|
121
|
-
double areaFactor = 0.0);
|
122
|
-
/** This is part two of factorization
|
123
|
-
Arrays belong to factorization and were returned by part 1
|
124
|
-
If status okay, permutation has pivot rows - this is only needed
|
125
|
-
If status is singular, then basic variables have pivot row
|
126
|
-
and ones thrown out have -1
|
127
|
-
returns 0 -okay, -1 singular, -99 memory */
|
128
|
-
int factorizePart2 (int permutation[],int exactNumberElements);
|
129
|
-
/// Condition number - product of pivots after factorization
|
130
|
-
double conditionNumber() const;
|
131
|
-
|
132
|
-
//@}
|
133
|
-
|
134
|
-
/**@name general stuff such as permutation or status */
|
135
|
-
//@{
|
136
|
-
/// Returns status
|
137
|
-
inline int status ( ) const {
|
138
|
-
return status_;
|
139
|
-
}
|
140
|
-
/// Sets status
|
141
|
-
inline void setStatus ( int value)
|
142
|
-
{ status_=value; }
|
143
|
-
/// Returns number of pivots since factorization
|
144
|
-
inline int pivots ( ) const {
|
145
|
-
return numberPivots_;
|
146
|
-
}
|
147
|
-
/// Sets number of pivots since factorization
|
148
|
-
inline void setPivots ( int value )
|
149
|
-
{ numberPivots_=value; }
|
150
|
-
/// Returns address of permute region
|
151
|
-
inline int *permute ( ) const {
|
152
|
-
return permute_.array();
|
153
|
-
}
|
154
|
-
/// Returns address of pivotColumn region (also used for permuting)
|
155
|
-
inline int *pivotColumn ( ) const {
|
156
|
-
return pivotColumn_.array();
|
157
|
-
}
|
158
|
-
/// Returns address of pivot region
|
159
|
-
inline CoinFactorizationDouble *pivotRegion ( ) const {
|
160
|
-
return pivotRegion_.array();
|
161
|
-
}
|
162
|
-
/// Returns address of permuteBack region
|
163
|
-
inline int *permuteBack ( ) const {
|
164
|
-
return permuteBack_.array();
|
165
|
-
}
|
166
|
-
/// Returns address of lastRow region
|
167
|
-
inline int *lastRow ( ) const {
|
168
|
-
return lastRow_.array();
|
169
|
-
}
|
170
|
-
/** Returns address of pivotColumnBack region (also used for permuting)
|
171
|
-
Now uses firstCount to save memory allocation */
|
172
|
-
inline int *pivotColumnBack ( ) const {
|
173
|
-
//return firstCount_.array();
|
174
|
-
return pivotColumnBack_.array();
|
175
|
-
}
|
176
|
-
/// Start of each row in L
|
177
|
-
inline CoinBigIndex * startRowL() const
|
178
|
-
{ return startRowL_.array();}
|
179
|
-
|
180
|
-
/// Start of each column in L
|
181
|
-
inline CoinBigIndex * startColumnL() const
|
182
|
-
{ return startColumnL_.array();}
|
183
|
-
|
184
|
-
/// Index of column in row for L
|
185
|
-
inline int * indexColumnL() const
|
186
|
-
{ return indexColumnL_.array();}
|
187
|
-
|
188
|
-
/// Row indices of L
|
189
|
-
inline int * indexRowL() const
|
190
|
-
{ return indexRowL_.array();}
|
191
|
-
|
192
|
-
/// Elements in L (row copy)
|
193
|
-
inline CoinFactorizationDouble * elementByRowL() const
|
194
|
-
{ return elementByRowL_.array();}
|
195
|
-
|
196
|
-
/// Number of Rows after iterating
|
197
|
-
inline int numberRowsExtra ( ) const {
|
198
|
-
return numberRowsExtra_;
|
199
|
-
}
|
200
|
-
/// Set number of Rows after factorization
|
201
|
-
inline void setNumberRows(int value)
|
202
|
-
{ numberRows_ = value; }
|
203
|
-
/// Number of Rows after factorization
|
204
|
-
inline int numberRows ( ) const {
|
205
|
-
return numberRows_;
|
206
|
-
}
|
207
|
-
/// Number in L
|
208
|
-
inline CoinBigIndex numberL() const
|
209
|
-
{ return numberL_;}
|
210
|
-
|
211
|
-
/// Base of L
|
212
|
-
inline CoinBigIndex baseL() const
|
213
|
-
{ return baseL_;}
|
214
|
-
/// Maximum of Rows after iterating
|
215
|
-
inline int maximumRowsExtra ( ) const {
|
216
|
-
return maximumRowsExtra_;
|
217
|
-
}
|
218
|
-
/// Total number of columns in factorization
|
219
|
-
inline int numberColumns ( ) const {
|
220
|
-
return numberColumns_;
|
221
|
-
}
|
222
|
-
/// Total number of elements in factorization
|
223
|
-
inline int numberElements ( ) const {
|
224
|
-
return totalElements_;
|
225
|
-
}
|
226
|
-
/// Length of FT vector
|
227
|
-
inline int numberForrestTomlin ( ) const {
|
228
|
-
return numberInColumn_.array()[numberColumnsExtra_];
|
229
|
-
}
|
230
|
-
/// Number of good columns in factorization
|
231
|
-
inline int numberGoodColumns ( ) const {
|
232
|
-
return numberGoodU_;
|
233
|
-
}
|
234
|
-
/// Whether larger areas needed
|
235
|
-
inline double areaFactor ( ) const {
|
236
|
-
return areaFactor_;
|
237
|
-
}
|
238
|
-
inline void areaFactor ( double value ) {
|
239
|
-
areaFactor_=value;
|
240
|
-
}
|
241
|
-
/// Returns areaFactor but adjusted for dense
|
242
|
-
double adjustedAreaFactor() const;
|
243
|
-
/// Allows change of pivot accuracy check 1.0 == none >1.0 relaxed
|
244
|
-
inline void relaxAccuracyCheck(double value)
|
245
|
-
{ relaxCheck_ = value;}
|
246
|
-
inline double getAccuracyCheck() const
|
247
|
-
{ return relaxCheck_;}
|
248
|
-
/// Level of detail of messages
|
249
|
-
inline int messageLevel ( ) const {
|
250
|
-
return messageLevel_ ;
|
251
|
-
}
|
252
|
-
void messageLevel ( int value );
|
253
|
-
/// Maximum number of pivots between factorizations
|
254
|
-
inline int maximumPivots ( ) const {
|
255
|
-
return maximumPivots_ ;
|
256
|
-
}
|
257
|
-
void maximumPivots ( int value );
|
258
|
-
|
259
|
-
/// Gets dense threshold
|
260
|
-
inline int denseThreshold() const
|
261
|
-
{ return denseThreshold_;}
|
262
|
-
/// Sets dense threshold
|
263
|
-
inline void setDenseThreshold(int value)
|
264
|
-
{ denseThreshold_ = value;}
|
265
|
-
/// Pivot tolerance
|
266
|
-
inline double pivotTolerance ( ) const {
|
267
|
-
return pivotTolerance_ ;
|
268
|
-
}
|
269
|
-
void pivotTolerance ( double value );
|
270
|
-
/// Zero tolerance
|
271
|
-
inline double zeroTolerance ( ) const {
|
272
|
-
return zeroTolerance_ ;
|
273
|
-
}
|
274
|
-
void zeroTolerance ( double value );
|
275
|
-
#ifndef COIN_FAST_CODE
|
276
|
-
/// Whether slack value is +1 or -1
|
277
|
-
inline double slackValue ( ) const {
|
278
|
-
return slackValue_ ;
|
279
|
-
}
|
280
|
-
void slackValue ( double value );
|
281
|
-
#endif
|
282
|
-
/// Returns maximum absolute value in factorization
|
283
|
-
double maximumCoefficient() const;
|
284
|
-
/// true if Forrest Tomlin update, false if PFI
|
285
|
-
inline bool forrestTomlin() const
|
286
|
-
{ return doForrestTomlin_;}
|
287
|
-
inline void setForrestTomlin(bool value)
|
288
|
-
{ doForrestTomlin_=value;}
|
289
|
-
/// True if FT update and space
|
290
|
-
inline bool spaceForForrestTomlin() const
|
291
|
-
{
|
292
|
-
CoinBigIndex start = startColumnU_.array()[maximumColumnsExtra_];
|
293
|
-
CoinBigIndex space = lengthAreaU_ - ( start + numberRowsExtra_ );
|
294
|
-
return (space>=0)&&doForrestTomlin_;
|
295
|
-
}
|
296
|
-
//@}
|
297
|
-
|
298
|
-
/**@name some simple stuff */
|
299
|
-
//@{
|
300
|
-
|
301
|
-
/// Returns number of dense rows
|
302
|
-
inline int numberDense() const
|
303
|
-
{ return numberDense_;}
|
304
|
-
|
305
|
-
/// Returns number in U area
|
306
|
-
inline CoinBigIndex numberElementsU ( ) const {
|
307
|
-
return lengthU_;
|
308
|
-
}
|
309
|
-
/// Setss number in U area
|
310
|
-
inline void setNumberElementsU(CoinBigIndex value)
|
311
|
-
{ lengthU_ = value; }
|
312
|
-
/// Returns length of U area
|
313
|
-
inline CoinBigIndex lengthAreaU ( ) const {
|
314
|
-
return lengthAreaU_;
|
315
|
-
}
|
316
|
-
/// Returns number in L area
|
317
|
-
inline CoinBigIndex numberElementsL ( ) const {
|
318
|
-
return lengthL_;
|
319
|
-
}
|
320
|
-
/// Returns length of L area
|
321
|
-
inline CoinBigIndex lengthAreaL ( ) const {
|
322
|
-
return lengthAreaL_;
|
323
|
-
}
|
324
|
-
/// Returns number in R area
|
325
|
-
inline CoinBigIndex numberElementsR ( ) const {
|
326
|
-
return lengthR_;
|
327
|
-
}
|
328
|
-
/// Number of compressions done
|
329
|
-
inline CoinBigIndex numberCompressions() const
|
330
|
-
{ return numberCompressions_;}
|
331
|
-
/// Number of entries in each row
|
332
|
-
inline int * numberInRow() const
|
333
|
-
{ return numberInRow_.array();}
|
334
|
-
/// Number of entries in each column
|
335
|
-
inline int * numberInColumn() const
|
336
|
-
{ return numberInColumn_.array();}
|
337
|
-
/// Elements of U
|
338
|
-
inline CoinFactorizationDouble * elementU() const
|
339
|
-
{ return elementU_.array();}
|
340
|
-
/// Row indices of U
|
341
|
-
inline int * indexRowU() const
|
342
|
-
{ return indexRowU_.array();}
|
343
|
-
/// Start of each column in U
|
344
|
-
inline CoinBigIndex * startColumnU() const
|
345
|
-
{ return startColumnU_.array();}
|
346
|
-
/// Maximum number of Columns after iterating
|
347
|
-
inline int maximumColumnsExtra()
|
348
|
-
{ return maximumColumnsExtra_;}
|
349
|
-
/** L to U bias
|
350
|
-
0 - U bias, 1 - some U bias, 2 some L bias, 3 L bias
|
351
|
-
*/
|
352
|
-
inline int biasLU() const
|
353
|
-
{ return biasLU_;}
|
354
|
-
inline void setBiasLU(int value)
|
355
|
-
{ biasLU_=value;}
|
356
|
-
/** Array persistence flag
|
357
|
-
If 0 then as now (delete/new)
|
358
|
-
1 then only do arrays if bigger needed
|
359
|
-
2 as 1 but give a bit extra if bigger needed
|
360
|
-
*/
|
361
|
-
inline int persistenceFlag() const
|
362
|
-
{ return persistenceFlag_;}
|
363
|
-
void setPersistenceFlag(int value);
|
364
|
-
//@}
|
365
|
-
|
366
|
-
/**@name rank one updates which do exist */
|
367
|
-
//@{
|
368
|
-
|
369
|
-
/** Replaces one Column to basis,
|
370
|
-
returns 0=OK, 1=Probably OK, 2=singular, 3=no room
|
371
|
-
If checkBeforeModifying is true will do all accuracy checks
|
372
|
-
before modifying factorization. Whether to set this depends on
|
373
|
-
speed considerations. You could just do this on first iteration
|
374
|
-
after factorization and thereafter re-factorize
|
375
|
-
partial update already in U */
|
376
|
-
int replaceColumn ( CoinIndexedVector * regionSparse,
|
377
|
-
int pivotRow,
|
378
|
-
double pivotCheck ,
|
379
|
-
bool checkBeforeModifying=false,
|
380
|
-
double acceptablePivot=1.0e-8);
|
381
|
-
/** Combines BtranU and delete elements
|
382
|
-
If deleted is NULL then delete elements
|
383
|
-
otherwise store where elements are
|
384
|
-
*/
|
385
|
-
void replaceColumnU ( CoinIndexedVector * regionSparse,
|
386
|
-
CoinBigIndex * deleted,
|
387
|
-
int internalPivotRow);
|
388
|
-
#ifdef ABC_USE_COIN_FACTORIZATION
|
389
|
-
/** returns empty fake vector carved out of existing
|
390
|
-
later - maybe use associated arrays */
|
391
|
-
CoinIndexedVector * fakeVector(CoinIndexedVector * vector,
|
392
|
-
int already=0) const;
|
393
|
-
void deleteFakeVector(CoinIndexedVector * vector,
|
394
|
-
CoinIndexedVector * fakeVector) const;
|
395
|
-
/** Checks if can replace one Column to basis,
|
396
|
-
returns update alpha
|
397
|
-
Fills in region for use later
|
398
|
-
partial update already in U */
|
399
|
-
double checkReplacePart1 ( CoinIndexedVector * regionSparse,
|
400
|
-
int pivotRow);
|
401
|
-
/** Checks if can replace one Column to basis,
|
402
|
-
returns update alpha
|
403
|
-
Fills in region for use later
|
404
|
-
partial update in vector */
|
405
|
-
double checkReplacePart1 ( CoinIndexedVector * regionSparse,
|
406
|
-
CoinIndexedVector * partialUpdate,
|
407
|
-
int pivotRow);
|
408
|
-
/** Checks if can replace one Column in basis,
|
409
|
-
returns 0=OK, 1=Probably OK, 2=singular, 3=no room, 5 max pivots */
|
410
|
-
int checkReplacePart2 ( int pivotRow,
|
411
|
-
double btranAlpha,
|
412
|
-
double ftranAlpha,
|
413
|
-
double ftAlpha,
|
414
|
-
double acceptablePivot = 1.0e-8);
|
415
|
-
/** Replaces one Column to basis,
|
416
|
-
partial update already in U */
|
417
|
-
void replaceColumnPart3 ( CoinIndexedVector * regionSparse,
|
418
|
-
int pivotRow,
|
419
|
-
double alpha );
|
420
|
-
/** Replaces one Column to basis,
|
421
|
-
partial update in vector */
|
422
|
-
void replaceColumnPart3 ( CoinIndexedVector * regionSparse,
|
423
|
-
CoinIndexedVector * partialUpdate,
|
424
|
-
int pivotRow,
|
425
|
-
double alpha );
|
426
|
-
/** Updates one column (FTRAN) from regionSparse2
|
427
|
-
Tries to do FT update
|
428
|
-
number returned is negative if no room
|
429
|
-
regionSparse starts as zero and is zero at end.
|
430
|
-
Note - if regionSparse2 packed on input - will be packed on output
|
431
|
-
long regions
|
432
|
-
*/
|
433
|
-
int updateColumnFT ( CoinIndexedVector & regionSparse);
|
434
|
-
int updateColumnFTPart1 ( CoinIndexedVector & regionSparse) ;
|
435
|
-
void updateColumnFTPart2 ( CoinIndexedVector & regionSparse) ;
|
436
|
-
/** Updates one column (FTRAN) - long region
|
437
|
-
Tries to do FT update
|
438
|
-
puts partial update in vector */
|
439
|
-
void updateColumnFT ( CoinIndexedVector & regionSparseFT,
|
440
|
-
CoinIndexedVector & partialUpdate,
|
441
|
-
int which);
|
442
|
-
/** Updates one column (FTRAN) long region */
|
443
|
-
int updateColumn ( CoinIndexedVector & regionSparse) const;
|
444
|
-
/** Updates one column (FTRAN) from regionFT
|
445
|
-
Tries to do FT update
|
446
|
-
number returned is negative if no room.
|
447
|
-
Also updates regionOther - long region*/
|
448
|
-
int updateTwoColumnsFT ( CoinIndexedVector & regionSparseFT,
|
449
|
-
CoinIndexedVector & regionSparseOther);
|
450
|
-
/** Updates one column (BTRAN) - long region*/
|
451
|
-
int updateColumnTranspose ( CoinIndexedVector & regionSparse) const;
|
452
|
-
/** Updates one column (FTRAN) - long region */
|
453
|
-
void updateColumnCpu ( CoinIndexedVector & regionSparse,int whichCpu) const;
|
454
|
-
/** Updates one column (BTRAN) - long region */
|
455
|
-
void updateColumnTransposeCpu ( CoinIndexedVector & regionSparse,int whichCpu) const;
|
456
|
-
/** Updates one full column (FTRAN) - long region */
|
457
|
-
void updateFullColumn ( CoinIndexedVector & regionSparse) const;
|
458
|
-
/** Updates one full column (BTRAN) - long region */
|
459
|
-
void updateFullColumnTranspose ( CoinIndexedVector & regionSparse) const;
|
460
|
-
/** Updates one column for dual steepest edge weights (FTRAN) - long region */
|
461
|
-
void updateWeights ( CoinIndexedVector & regionSparse) const;
|
462
|
-
/// Returns true if wants tableauColumn in replaceColumn
|
463
|
-
inline bool wantsTableauColumn() const
|
464
|
-
{return false;}
|
465
|
-
/// Pivot tolerance
|
466
|
-
inline double minimumPivotTolerance ( ) const {
|
467
|
-
return pivotTolerance_ ;
|
468
|
-
}
|
469
|
-
inline void minimumPivotTolerance ( double value )
|
470
|
-
{ pivotTolerance(value);}
|
471
|
-
/// Says parallel
|
472
|
-
inline void setParallelMode(int value)
|
473
|
-
{ parallelMode_=value;}
|
474
|
-
/// Sets solve mode
|
475
|
-
inline void setSolveMode(int value)
|
476
|
-
{ parallelMode_ &= 3;parallelMode_ |= (value<<2);}
|
477
|
-
/// Sets solve mode
|
478
|
-
inline int solveMode() const
|
479
|
-
{ return parallelMode_ >> 2;}
|
480
|
-
/// Update partial Ftran by R update
|
481
|
-
void updatePartialUpdate(CoinIndexedVector & partialUpdate);
|
482
|
-
/// Makes a non-singular basis by replacing variables
|
483
|
-
void makeNonSingular(int * COIN_RESTRICT sequence);
|
484
|
-
#endif
|
485
|
-
//@}
|
486
|
-
|
487
|
-
/**@name various uses of factorization (return code number elements)
|
488
|
-
which user may want to know about */
|
489
|
-
//@{
|
490
|
-
/** Updates one column (FTRAN) from regionSparse2
|
491
|
-
Tries to do FT update
|
492
|
-
number returned is negative if no room
|
493
|
-
regionSparse starts as zero and is zero at end.
|
494
|
-
Note - if regionSparse2 packed on input - will be packed on output
|
495
|
-
*/
|
496
|
-
int updateColumnFT ( CoinIndexedVector * regionSparse,
|
497
|
-
CoinIndexedVector * regionSparse2);
|
498
|
-
/** This version has same effect as above with FTUpdate==false
|
499
|
-
so number returned is always >=0 */
|
500
|
-
int updateColumn ( CoinIndexedVector * regionSparse,
|
501
|
-
CoinIndexedVector * regionSparse2,
|
502
|
-
bool noPermute=false) const;
|
503
|
-
/** Updates one column (FTRAN) from region2
|
504
|
-
Tries to do FT update
|
505
|
-
number returned is negative if no room.
|
506
|
-
Also updates region3
|
507
|
-
region1 starts as zero and is zero at end */
|
508
|
-
int updateTwoColumnsFT ( CoinIndexedVector * regionSparse1,
|
509
|
-
CoinIndexedVector * regionSparse2,
|
510
|
-
CoinIndexedVector * regionSparse3,
|
511
|
-
bool noPermuteRegion3=false) ;
|
512
|
-
/** Updates one column (BTRAN) from regionSparse2
|
513
|
-
regionSparse starts as zero and is zero at end
|
514
|
-
Note - if regionSparse2 packed on input - will be packed on output
|
515
|
-
*/
|
516
|
-
int updateColumnTranspose ( CoinIndexedVector * regionSparse,
|
517
|
-
CoinIndexedVector * regionSparse2) const;
|
518
|
-
/** makes a row copy of L for speed and to allow very sparse problems */
|
519
|
-
void goSparse();
|
520
|
-
/** get sparse threshold */
|
521
|
-
inline int sparseThreshold ( ) const
|
522
|
-
{ return sparseThreshold_;}
|
523
|
-
/** set sparse threshold */
|
524
|
-
void sparseThreshold ( int value );
|
525
|
-
//@}
|
526
|
-
/// *** Below this user may not want to know about
|
527
|
-
|
528
|
-
/**@name various uses of factorization (return code number elements)
|
529
|
-
which user may not want to know about (left over from my LP code) */
|
530
|
-
//@{
|
531
|
-
/// Get rid of all memory
|
532
|
-
inline void clearArrays()
|
533
|
-
{ gutsOfDestructor();}
|
534
|
-
//@}
|
535
|
-
|
536
|
-
/**@name various updates - none of which have been written! */
|
537
|
-
//@{
|
538
|
-
|
539
|
-
/** Adds given elements to Basis and updates factorization,
|
540
|
-
can increase size of basis. Returns rank */
|
541
|
-
int add ( CoinBigIndex numberElements,
|
542
|
-
int indicesRow[],
|
543
|
-
int indicesColumn[], double elements[] );
|
544
|
-
|
545
|
-
/** Adds one Column to basis,
|
546
|
-
can increase size of basis. Returns rank */
|
547
|
-
int addColumn ( CoinBigIndex numberElements,
|
548
|
-
int indicesRow[], double elements[] );
|
549
|
-
|
550
|
-
/** Adds one Row to basis,
|
551
|
-
can increase size of basis. Returns rank */
|
552
|
-
int addRow ( CoinBigIndex numberElements,
|
553
|
-
int indicesColumn[], double elements[] );
|
554
|
-
|
555
|
-
/// Deletes one Column from basis, returns rank
|
556
|
-
int deleteColumn ( int Row );
|
557
|
-
/// Deletes one Row from basis, returns rank
|
558
|
-
int deleteRow ( int Row );
|
559
|
-
|
560
|
-
/** Replaces one Row in basis,
|
561
|
-
At present assumes just a singleton on row is in basis
|
562
|
-
returns 0=OK, 1=Probably OK, 2=singular, 3 no space */
|
563
|
-
int replaceRow ( int whichRow, int numberElements,
|
564
|
-
const int indicesColumn[], const double elements[] );
|
565
|
-
/// Takes out all entries for given rows
|
566
|
-
void emptyRows(int numberToEmpty, const int which[]);
|
567
|
-
//@}
|
568
|
-
/**@name used by ClpFactorization */
|
569
|
-
/// See if worth going sparse
|
570
|
-
void checkSparse();
|
571
|
-
/// For statistics
|
572
|
-
#if 0 //def CLP_FACTORIZATION_INSTRUMENT
|
573
|
-
inline bool collectStatistics() const
|
574
|
-
{ return collectStatistics_;}
|
575
|
-
/// For statistics
|
576
|
-
inline void setCollectStatistics(bool onOff) const
|
577
|
-
{ collectStatistics_ = onOff;}
|
578
|
-
#else
|
579
|
-
inline bool collectStatistics() const
|
580
|
-
{ return true;}
|
581
|
-
/// For statistics
|
582
|
-
inline void setCollectStatistics(bool onOff) const
|
583
|
-
{ }
|
584
|
-
#endif
|
585
|
-
/// The real work of constructors etc 0 just scalars, 1 bit normal
|
586
|
-
void gutsOfDestructor(int type=1);
|
587
|
-
/// 1 bit - tolerances etc, 2 more, 4 dummy arrays
|
588
|
-
void gutsOfInitialize(int type);
|
589
|
-
void gutsOfCopy(const CoinFactorization &other);
|
590
|
-
|
591
|
-
/// Reset all sparsity etc statistics
|
592
|
-
void resetStatistics();
|
593
|
-
|
594
|
-
|
595
|
-
//@}
|
596
|
-
|
597
|
-
/**@name used by factorization */
|
598
|
-
/// Gets space for a factorization, called by constructors
|
599
|
-
void getAreas ( int numberRows,
|
600
|
-
int numberColumns,
|
601
|
-
CoinBigIndex maximumL,
|
602
|
-
CoinBigIndex maximumU );
|
603
|
-
|
604
|
-
/** PreProcesses raw triplet data.
|
605
|
-
state is 0 - triplets, 1 - some counts etc , 2 - .. */
|
606
|
-
void preProcess ( int state,
|
607
|
-
int possibleDuplicates = -1 );
|
608
|
-
/// Does most of factorization
|
609
|
-
int factor ( );
|
610
|
-
protected:
|
611
|
-
/** Does sparse phase of factorization
|
612
|
-
return code is <0 error, 0= finished */
|
613
|
-
int factorSparse ( );
|
614
|
-
/** Does sparse phase of factorization (for smaller problems)
|
615
|
-
return code is <0 error, 0= finished */
|
616
|
-
int factorSparseSmall ( );
|
617
|
-
/** Does sparse phase of factorization (for larger problems)
|
618
|
-
return code is <0 error, 0= finished */
|
619
|
-
int factorSparseLarge ( );
|
620
|
-
/** Does dense phase of factorization
|
621
|
-
return code is <0 error, 0= finished */
|
622
|
-
int factorDense ( );
|
623
|
-
|
624
|
-
/// Pivots when just one other row so faster?
|
625
|
-
bool pivotOneOtherRow ( int pivotRow,
|
626
|
-
int pivotColumn );
|
627
|
-
/// Does one pivot on Row Singleton in factorization
|
628
|
-
bool pivotRowSingleton ( int pivotRow,
|
629
|
-
int pivotColumn );
|
630
|
-
/// Does one pivot on Column Singleton in factorization
|
631
|
-
bool pivotColumnSingleton ( int pivotRow,
|
632
|
-
int pivotColumn );
|
633
|
-
|
634
|
-
/** Gets space for one Column with given length,
|
635
|
-
may have to do compression (returns True if successful),
|
636
|
-
also moves existing vector,
|
637
|
-
extraNeeded is over and above present */
|
638
|
-
bool getColumnSpace ( int iColumn,
|
639
|
-
int extraNeeded );
|
640
|
-
|
641
|
-
/** Reorders U so contiguous and in order (if there is space)
|
642
|
-
Returns true if it could */
|
643
|
-
bool reorderU();
|
644
|
-
/** getColumnSpaceIterateR. Gets space for one extra R element in Column
|
645
|
-
may have to do compression (returns true)
|
646
|
-
also moves existing vector */
|
647
|
-
bool getColumnSpaceIterateR ( int iColumn, double value,
|
648
|
-
int iRow);
|
649
|
-
/** getColumnSpaceIterate. Gets space for one extra U element in Column
|
650
|
-
may have to do compression (returns true)
|
651
|
-
also moves existing vector.
|
652
|
-
Returns -1 if no memory or where element was put
|
653
|
-
Used by replaceRow (turns off R version) */
|
654
|
-
CoinBigIndex getColumnSpaceIterate ( int iColumn, double value,
|
655
|
-
int iRow);
|
656
|
-
/** Gets space for one Row with given length,
|
657
|
-
may have to do compression (returns True if successful),
|
658
|
-
also moves existing vector */
|
659
|
-
bool getRowSpace ( int iRow, int extraNeeded );
|
660
|
-
|
661
|
-
/** Gets space for one Row with given length while iterating,
|
662
|
-
may have to do compression (returns True if successful),
|
663
|
-
also moves existing vector */
|
664
|
-
bool getRowSpaceIterate ( int iRow,
|
665
|
-
int extraNeeded );
|
666
|
-
/// Checks that row and column copies look OK
|
667
|
-
void checkConsistency ( );
|
668
|
-
/// Adds a link in chain of equal counts
|
669
|
-
inline void addLink ( int index, int count ) {
|
670
|
-
int *nextCount = nextCount_.array();
|
671
|
-
int *firstCount = firstCount_.array();
|
672
|
-
int *lastCount = lastCount_.array();
|
673
|
-
int next = firstCount[count];
|
674
|
-
lastCount[index] = -2 - count;
|
675
|
-
if ( next < 0 ) {
|
676
|
-
//first with that count
|
677
|
-
firstCount[count] = index;
|
678
|
-
nextCount[index] = -1;
|
679
|
-
} else {
|
680
|
-
firstCount[count] = index;
|
681
|
-
nextCount[index] = next;
|
682
|
-
lastCount[next] = index;
|
683
|
-
}}
|
684
|
-
/// Deletes a link in chain of equal counts
|
685
|
-
inline void deleteLink ( int index ) {
|
686
|
-
int *nextCount = nextCount_.array();
|
687
|
-
int *firstCount = firstCount_.array();
|
688
|
-
int *lastCount = lastCount_.array();
|
689
|
-
int next = nextCount[index];
|
690
|
-
int last = lastCount[index];
|
691
|
-
if ( last >= 0 ) {
|
692
|
-
nextCount[last] = next;
|
693
|
-
} else {
|
694
|
-
int count = -last - 2;
|
695
|
-
|
696
|
-
firstCount[count] = next;
|
697
|
-
}
|
698
|
-
if ( next >= 0 ) {
|
699
|
-
lastCount[next] = last;
|
700
|
-
}
|
701
|
-
nextCount[index] = -2;
|
702
|
-
lastCount[index] = -2;
|
703
|
-
return;
|
704
|
-
}
|
705
|
-
/// Separate out links with same row/column count
|
706
|
-
void separateLinks(int count,bool rowsFirst);
|
707
|
-
/// Cleans up at end of factorization
|
708
|
-
void cleanup ( );
|
709
|
-
|
710
|
-
/// Updates part of column (FTRANL)
|
711
|
-
void updateColumnL ( CoinIndexedVector * region, int * indexIn ) const;
|
712
|
-
/// Updates part of column (FTRANL) when densish
|
713
|
-
void updateColumnLDensish ( CoinIndexedVector * region, int * indexIn ) const;
|
714
|
-
/// Updates part of column (FTRANL) when sparse
|
715
|
-
void updateColumnLSparse ( CoinIndexedVector * region, int * indexIn ) const;
|
716
|
-
/// Updates part of column (FTRANL) when sparsish
|
717
|
-
void updateColumnLSparsish ( CoinIndexedVector * region, int * indexIn ) const;
|
718
|
-
|
719
|
-
/// Updates part of column (FTRANR) without FT update
|
720
|
-
void updateColumnR ( CoinIndexedVector * region ) const;
|
721
|
-
/** Updates part of column (FTRANR) with FT update.
|
722
|
-
Also stores update after L and R */
|
723
|
-
void updateColumnRFT ( CoinIndexedVector * region, int * indexIn );
|
724
|
-
|
725
|
-
/// Updates part of column (FTRANU)
|
726
|
-
void updateColumnU ( CoinIndexedVector * region, int * indexIn) const;
|
727
|
-
|
728
|
-
/// Updates part of column (FTRANU) when sparse
|
729
|
-
void updateColumnUSparse ( CoinIndexedVector * regionSparse,
|
730
|
-
int * indexIn) const;
|
731
|
-
/// Updates part of column (FTRANU) when sparsish
|
732
|
-
void updateColumnUSparsish ( CoinIndexedVector * regionSparse,
|
733
|
-
int * indexIn) const;
|
734
|
-
/// Updates part of column (FTRANU)
|
735
|
-
int updateColumnUDensish ( double * COIN_RESTRICT region,
|
736
|
-
int * COIN_RESTRICT regionIndex) const;
|
737
|
-
/// Updates part of 2 columns (FTRANU) real work
|
738
|
-
void updateTwoColumnsUDensish (
|
739
|
-
int & numberNonZero1,
|
740
|
-
double * COIN_RESTRICT region1,
|
741
|
-
int * COIN_RESTRICT index1,
|
742
|
-
int & numberNonZero2,
|
743
|
-
double * COIN_RESTRICT region2,
|
744
|
-
int * COIN_RESTRICT index2) const;
|
745
|
-
/// Updates part of column PFI (FTRAN) (after rest)
|
746
|
-
void updateColumnPFI ( CoinIndexedVector * regionSparse) const;
|
747
|
-
/// Permutes back at end of updateColumn
|
748
|
-
void permuteBack ( CoinIndexedVector * regionSparse,
|
749
|
-
CoinIndexedVector * outVector) const;
|
750
|
-
|
751
|
-
/// Updates part of column transpose PFI (BTRAN) (before rest)
|
752
|
-
void updateColumnTransposePFI ( CoinIndexedVector * region) const;
|
753
|
-
/** Updates part of column transpose (BTRANU),
|
754
|
-
assumes index is sorted i.e. region is correct */
|
755
|
-
void updateColumnTransposeU ( CoinIndexedVector * region,
|
756
|
-
int smallestIndex) const;
|
757
|
-
/** Updates part of column transpose (BTRANU) when sparsish,
|
758
|
-
assumes index is sorted i.e. region is correct */
|
759
|
-
void updateColumnTransposeUSparsish ( CoinIndexedVector * region,
|
760
|
-
int smallestIndex) const;
|
761
|
-
/** Updates part of column transpose (BTRANU) when densish,
|
762
|
-
assumes index is sorted i.e. region is correct */
|
763
|
-
void updateColumnTransposeUDensish ( CoinIndexedVector * region,
|
764
|
-
int smallestIndex) const;
|
765
|
-
/** Updates part of column transpose (BTRANU) when sparse,
|
766
|
-
assumes index is sorted i.e. region is correct */
|
767
|
-
void updateColumnTransposeUSparse ( CoinIndexedVector * region) const;
|
768
|
-
/** Updates part of column transpose (BTRANU) by column
|
769
|
-
assumes index is sorted i.e. region is correct */
|
770
|
-
void updateColumnTransposeUByColumn ( CoinIndexedVector * region,
|
771
|
-
int smallestIndex) const;
|
772
|
-
|
773
|
-
/// Updates part of column transpose (BTRANR)
|
774
|
-
void updateColumnTransposeR ( CoinIndexedVector * region ) const;
|
775
|
-
/// Updates part of column transpose (BTRANR) when dense
|
776
|
-
void updateColumnTransposeRDensish ( CoinIndexedVector * region ) const;
|
777
|
-
/// Updates part of column transpose (BTRANR) when sparse
|
778
|
-
void updateColumnTransposeRSparse ( CoinIndexedVector * region ) const;
|
779
|
-
|
780
|
-
/// Updates part of column transpose (BTRANL)
|
781
|
-
void updateColumnTransposeL ( CoinIndexedVector * region ) const;
|
782
|
-
/// Updates part of column transpose (BTRANL) when densish by column
|
783
|
-
void updateColumnTransposeLDensish ( CoinIndexedVector * region ) const;
|
784
|
-
/// Updates part of column transpose (BTRANL) when densish by row
|
785
|
-
void updateColumnTransposeLByRow ( CoinIndexedVector * region ) const;
|
786
|
-
/// Updates part of column transpose (BTRANL) when sparsish by row
|
787
|
-
void updateColumnTransposeLSparsish ( CoinIndexedVector * region ) const;
|
788
|
-
/// Updates part of column transpose (BTRANL) when sparse (by Row)
|
789
|
-
void updateColumnTransposeLSparse ( CoinIndexedVector * region ) const;
|
790
|
-
public:
|
791
|
-
/** Replaces one Column to basis for PFI
|
792
|
-
returns 0=OK, 1=Probably OK, 2=singular, 3=no room.
|
793
|
-
In this case region is not empty - it is incoming variable (updated)
|
794
|
-
*/
|
795
|
-
int replaceColumnPFI ( CoinIndexedVector * regionSparse,
|
796
|
-
int pivotRow, double alpha);
|
797
|
-
protected:
|
798
|
-
/** Returns accuracy status of replaceColumn
|
799
|
-
returns 0=OK, 1=Probably OK, 2=singular */
|
800
|
-
int checkPivot(double saveFromU, double oldPivot) const;
|
801
|
-
/********************************* START LARGE TEMPLATE ********/
|
802
|
-
#ifdef INT_IS_8
|
803
|
-
#define COINFACTORIZATION_BITS_PER_INT 64
|
804
|
-
#define COINFACTORIZATION_SHIFT_PER_INT 6
|
805
|
-
#define COINFACTORIZATION_MASK_PER_INT 0x3f
|
806
|
-
#else
|
807
|
-
#define COINFACTORIZATION_BITS_PER_INT 32
|
808
|
-
#define COINFACTORIZATION_SHIFT_PER_INT 5
|
809
|
-
#define COINFACTORIZATION_MASK_PER_INT 0x1f
|
810
|
-
#endif
|
811
|
-
template <class T> inline bool
|
812
|
-
pivot ( int pivotRow,
|
813
|
-
int pivotColumn,
|
814
|
-
CoinBigIndex pivotRowPosition,
|
815
|
-
CoinBigIndex pivotColumnPosition,
|
816
|
-
CoinFactorizationDouble work[],
|
817
|
-
unsigned int workArea2[],
|
818
|
-
int increment2,
|
819
|
-
T markRow[] ,
|
820
|
-
int largeInteger)
|
821
|
-
{
|
822
|
-
int *indexColumnU = indexColumnU_.array();
|
823
|
-
CoinBigIndex *startColumnU = startColumnU_.array();
|
824
|
-
int *numberInColumn = numberInColumn_.array();
|
825
|
-
CoinFactorizationDouble *elementU = elementU_.array();
|
826
|
-
int *indexRowU = indexRowU_.array();
|
827
|
-
CoinBigIndex *startRowU = startRowU_.array();
|
828
|
-
int *numberInRow = numberInRow_.array();
|
829
|
-
CoinFactorizationDouble *elementL = elementL_.array();
|
830
|
-
int *indexRowL = indexRowL_.array();
|
831
|
-
int *saveColumn = saveColumn_.array();
|
832
|
-
int *nextRow = nextRow_.array();
|
833
|
-
int *lastRow = lastRow_.array() ;
|
834
|
-
|
835
|
-
//store pivot columns (so can easily compress)
|
836
|
-
int numberInPivotRow = numberInRow[pivotRow] - 1;
|
837
|
-
CoinBigIndex startColumn = startColumnU[pivotColumn];
|
838
|
-
int numberInPivotColumn = numberInColumn[pivotColumn] - 1;
|
839
|
-
CoinBigIndex endColumn = startColumn + numberInPivotColumn + 1;
|
840
|
-
int put = 0;
|
841
|
-
CoinBigIndex startRow = startRowU[pivotRow];
|
842
|
-
CoinBigIndex endRow = startRow + numberInPivotRow + 1;
|
843
|
-
|
844
|
-
if ( pivotColumnPosition < 0 ) {
|
845
|
-
for ( pivotColumnPosition = startRow; pivotColumnPosition < endRow; pivotColumnPosition++ ) {
|
846
|
-
int iColumn = indexColumnU[pivotColumnPosition];
|
847
|
-
if ( iColumn != pivotColumn ) {
|
848
|
-
saveColumn[put++] = iColumn;
|
849
|
-
} else {
|
850
|
-
break;
|
851
|
-
}
|
852
|
-
}
|
853
|
-
} else {
|
854
|
-
for (CoinBigIndex i = startRow ; i < pivotColumnPosition ; i++ ) {
|
855
|
-
saveColumn[put++] = indexColumnU[i];
|
856
|
-
}
|
857
|
-
}
|
858
|
-
assert (pivotColumnPosition<endRow);
|
859
|
-
assert (indexColumnU[pivotColumnPosition]==pivotColumn);
|
860
|
-
pivotColumnPosition++;
|
861
|
-
for ( ; pivotColumnPosition < endRow; pivotColumnPosition++ ) {
|
862
|
-
saveColumn[put++] = indexColumnU[pivotColumnPosition];
|
863
|
-
}
|
864
|
-
//take out this bit of indexColumnU
|
865
|
-
int next = nextRow[pivotRow];
|
866
|
-
int last = lastRow[pivotRow];
|
867
|
-
|
868
|
-
nextRow[last] = next;
|
869
|
-
lastRow[next] = last;
|
870
|
-
nextRow[pivotRow] = numberGoodU_; //use for permute
|
871
|
-
lastRow[pivotRow] = -2;
|
872
|
-
numberInRow[pivotRow] = 0;
|
873
|
-
//store column in L, compress in U and take column out
|
874
|
-
CoinBigIndex l = lengthL_;
|
875
|
-
|
876
|
-
if ( l + numberInPivotColumn > lengthAreaL_ ) {
|
877
|
-
//need more memory
|
878
|
-
if ((messageLevel_&4)!=0)
|
879
|
-
printf("more memory needed in middle of invert\n");
|
880
|
-
return false;
|
881
|
-
}
|
882
|
-
//l+=currentAreaL_->elementByColumn-elementL;
|
883
|
-
CoinBigIndex lSave = l;
|
884
|
-
|
885
|
-
CoinBigIndex * startColumnL = startColumnL_.array();
|
886
|
-
startColumnL[numberGoodL_] = l; //for luck and first time
|
887
|
-
numberGoodL_++;
|
888
|
-
startColumnL[numberGoodL_] = l + numberInPivotColumn;
|
889
|
-
lengthL_ += numberInPivotColumn;
|
890
|
-
if ( pivotRowPosition < 0 ) {
|
891
|
-
for ( pivotRowPosition = startColumn; pivotRowPosition < endColumn; pivotRowPosition++ ) {
|
892
|
-
int iRow = indexRowU[pivotRowPosition];
|
893
|
-
if ( iRow != pivotRow ) {
|
894
|
-
indexRowL[l] = iRow;
|
895
|
-
elementL[l] = elementU[pivotRowPosition];
|
896
|
-
markRow[iRow] = static_cast<T>(l - lSave);
|
897
|
-
l++;
|
898
|
-
//take out of row list
|
899
|
-
CoinBigIndex start = startRowU[iRow];
|
900
|
-
CoinBigIndex end = start + numberInRow[iRow];
|
901
|
-
CoinBigIndex where = start;
|
902
|
-
|
903
|
-
while ( indexColumnU[where] != pivotColumn ) {
|
904
|
-
where++;
|
905
|
-
} /* endwhile */
|
906
|
-
#if DEBUG_COIN
|
907
|
-
if ( where >= end ) {
|
908
|
-
abort ( );
|
909
|
-
}
|
910
|
-
#endif
|
911
|
-
indexColumnU[where] = indexColumnU[end - 1];
|
912
|
-
numberInRow[iRow]--;
|
913
|
-
} else {
|
914
|
-
break;
|
915
|
-
}
|
916
|
-
}
|
917
|
-
} else {
|
918
|
-
CoinBigIndex i;
|
919
|
-
|
920
|
-
for ( i = startColumn; i < pivotRowPosition; i++ ) {
|
921
|
-
int iRow = indexRowU[i];
|
922
|
-
|
923
|
-
markRow[iRow] = static_cast<T>(l - lSave);
|
924
|
-
indexRowL[l] = iRow;
|
925
|
-
elementL[l] = elementU[i];
|
926
|
-
l++;
|
927
|
-
//take out of row list
|
928
|
-
CoinBigIndex start = startRowU[iRow];
|
929
|
-
CoinBigIndex end = start + numberInRow[iRow];
|
930
|
-
CoinBigIndex where = start;
|
931
|
-
|
932
|
-
while ( indexColumnU[where] != pivotColumn ) {
|
933
|
-
where++;
|
934
|
-
} /* endwhile */
|
935
|
-
#if DEBUG_COIN
|
936
|
-
if ( where >= end ) {
|
937
|
-
abort ( );
|
938
|
-
}
|
939
|
-
#endif
|
940
|
-
indexColumnU[where] = indexColumnU[end - 1];
|
941
|
-
numberInRow[iRow]--;
|
942
|
-
assert (numberInRow[iRow]>=0);
|
943
|
-
}
|
944
|
-
}
|
945
|
-
assert (pivotRowPosition<endColumn);
|
946
|
-
assert (indexRowU[pivotRowPosition]==pivotRow);
|
947
|
-
CoinFactorizationDouble pivotElement = elementU[pivotRowPosition];
|
948
|
-
CoinFactorizationDouble pivotMultiplier = 1.0 / pivotElement;
|
949
|
-
|
950
|
-
pivotRegion_.array()[numberGoodU_] = pivotMultiplier;
|
951
|
-
pivotRowPosition++;
|
952
|
-
for ( ; pivotRowPosition < endColumn; pivotRowPosition++ ) {
|
953
|
-
int iRow = indexRowU[pivotRowPosition];
|
954
|
-
|
955
|
-
markRow[iRow] = static_cast<T>(l - lSave);
|
956
|
-
indexRowL[l] = iRow;
|
957
|
-
elementL[l] = elementU[pivotRowPosition];
|
958
|
-
l++;
|
959
|
-
//take out of row list
|
960
|
-
CoinBigIndex start = startRowU[iRow];
|
961
|
-
CoinBigIndex end = start + numberInRow[iRow];
|
962
|
-
CoinBigIndex where = start;
|
963
|
-
|
964
|
-
while ( indexColumnU[where] != pivotColumn ) {
|
965
|
-
where++;
|
966
|
-
} /* endwhile */
|
967
|
-
#if DEBUG_COIN
|
968
|
-
if ( where >= end ) {
|
969
|
-
abort ( );
|
970
|
-
}
|
971
|
-
#endif
|
972
|
-
indexColumnU[where] = indexColumnU[end - 1];
|
973
|
-
numberInRow[iRow]--;
|
974
|
-
assert (numberInRow[iRow]>=0);
|
975
|
-
}
|
976
|
-
markRow[pivotRow] = static_cast<T>(largeInteger);
|
977
|
-
//compress pivot column (move pivot to front including saved)
|
978
|
-
numberInColumn[pivotColumn] = 0;
|
979
|
-
//use end of L for temporary space
|
980
|
-
int *indexL = &indexRowL[lSave];
|
981
|
-
CoinFactorizationDouble *multipliersL = &elementL[lSave];
|
982
|
-
|
983
|
-
//adjust
|
984
|
-
int j;
|
985
|
-
|
986
|
-
for ( j = 0; j < numberInPivotColumn; j++ ) {
|
987
|
-
multipliersL[j] *= pivotMultiplier;
|
988
|
-
}
|
989
|
-
//zero out fill
|
990
|
-
CoinBigIndex iErase;
|
991
|
-
for ( iErase = 0; iErase < increment2 * numberInPivotRow;
|
992
|
-
iErase++ ) {
|
993
|
-
workArea2[iErase] = 0;
|
994
|
-
}
|
995
|
-
CoinBigIndex added = numberInPivotRow * numberInPivotColumn;
|
996
|
-
unsigned int *temp2 = workArea2;
|
997
|
-
int * nextColumn = nextColumn_.array();
|
998
|
-
|
999
|
-
//pack down and move to work
|
1000
|
-
int jColumn;
|
1001
|
-
for ( jColumn = 0; jColumn < numberInPivotRow; jColumn++ ) {
|
1002
|
-
int iColumn = saveColumn[jColumn];
|
1003
|
-
CoinBigIndex startColumn = startColumnU[iColumn];
|
1004
|
-
CoinBigIndex endColumn = startColumn + numberInColumn[iColumn];
|
1005
|
-
int iRow = indexRowU[startColumn];
|
1006
|
-
CoinFactorizationDouble value = elementU[startColumn];
|
1007
|
-
double largest;
|
1008
|
-
CoinBigIndex put = startColumn;
|
1009
|
-
CoinBigIndex positionLargest = -1;
|
1010
|
-
CoinFactorizationDouble thisPivotValue = 0.0;
|
1011
|
-
|
1012
|
-
//compress column and find largest not updated
|
1013
|
-
bool checkLargest;
|
1014
|
-
int mark = markRow[iRow];
|
1015
|
-
|
1016
|
-
if ( mark == largeInteger+1 ) {
|
1017
|
-
largest = fabs ( value );
|
1018
|
-
positionLargest = put;
|
1019
|
-
put++;
|
1020
|
-
checkLargest = false;
|
1021
|
-
} else {
|
1022
|
-
//need to find largest
|
1023
|
-
largest = 0.0;
|
1024
|
-
checkLargest = true;
|
1025
|
-
if ( mark != largeInteger ) {
|
1026
|
-
//will be updated
|
1027
|
-
work[mark] = value;
|
1028
|
-
int word = mark >> COINFACTORIZATION_SHIFT_PER_INT;
|
1029
|
-
int bit = mark & COINFACTORIZATION_MASK_PER_INT;
|
1030
|
-
|
1031
|
-
temp2[word] = temp2[word] | ( 1 << bit ); //say already in counts
|
1032
|
-
added--;
|
1033
|
-
} else {
|
1034
|
-
thisPivotValue = value;
|
1035
|
-
}
|
1036
|
-
}
|
1037
|
-
CoinBigIndex i;
|
1038
|
-
for ( i = startColumn + 1; i < endColumn; i++ ) {
|
1039
|
-
iRow = indexRowU[i];
|
1040
|
-
value = elementU[i];
|
1041
|
-
int mark = markRow[iRow];
|
1042
|
-
|
1043
|
-
if ( mark == largeInteger+1 ) {
|
1044
|
-
//keep
|
1045
|
-
indexRowU[put] = iRow;
|
1046
|
-
elementU[put] = value;
|
1047
|
-
if ( checkLargest ) {
|
1048
|
-
double absValue = fabs ( value );
|
1049
|
-
|
1050
|
-
if ( absValue > largest ) {
|
1051
|
-
largest = absValue;
|
1052
|
-
positionLargest = put;
|
1053
|
-
}
|
1054
|
-
}
|
1055
|
-
put++;
|
1056
|
-
} else if ( mark != largeInteger ) {
|
1057
|
-
//will be updated
|
1058
|
-
work[mark] = value;
|
1059
|
-
int word = mark >> COINFACTORIZATION_SHIFT_PER_INT;
|
1060
|
-
int bit = mark & COINFACTORIZATION_MASK_PER_INT;
|
1061
|
-
|
1062
|
-
temp2[word] = temp2[word] | ( 1 << bit ); //say already in counts
|
1063
|
-
added--;
|
1064
|
-
} else {
|
1065
|
-
thisPivotValue = value;
|
1066
|
-
}
|
1067
|
-
}
|
1068
|
-
//slot in pivot
|
1069
|
-
elementU[put] = elementU[startColumn];
|
1070
|
-
indexRowU[put] = indexRowU[startColumn];
|
1071
|
-
if ( positionLargest == startColumn ) {
|
1072
|
-
positionLargest = put; //follow if was largest
|
1073
|
-
}
|
1074
|
-
put++;
|
1075
|
-
elementU[startColumn] = thisPivotValue;
|
1076
|
-
indexRowU[startColumn] = pivotRow;
|
1077
|
-
//clean up counts
|
1078
|
-
startColumn++;
|
1079
|
-
numberInColumn[iColumn] = put - startColumn;
|
1080
|
-
int * numberInColumnPlus = numberInColumnPlus_.array();
|
1081
|
-
numberInColumnPlus[iColumn]++;
|
1082
|
-
startColumnU[iColumn]++;
|
1083
|
-
//how much space have we got
|
1084
|
-
int next = nextColumn[iColumn];
|
1085
|
-
CoinBigIndex space;
|
1086
|
-
|
1087
|
-
space = startColumnU[next] - put - numberInColumnPlus[next];
|
1088
|
-
//assume no zero elements
|
1089
|
-
if ( numberInPivotColumn > space ) {
|
1090
|
-
//getColumnSpace also moves fixed part
|
1091
|
-
if ( !getColumnSpace ( iColumn, numberInPivotColumn ) ) {
|
1092
|
-
return false;
|
1093
|
-
}
|
1094
|
-
//redo starts
|
1095
|
-
if (positionLargest >= 0)
|
1096
|
-
positionLargest = positionLargest + startColumnU[iColumn] - startColumn;
|
1097
|
-
startColumn = startColumnU[iColumn];
|
1098
|
-
put = startColumn + numberInColumn[iColumn];
|
1099
|
-
}
|
1100
|
-
double tolerance = zeroTolerance_;
|
1101
|
-
|
1102
|
-
int *nextCount = nextCount_.array();
|
1103
|
-
for ( j = 0; j < numberInPivotColumn; j++ ) {
|
1104
|
-
value = work[j] - thisPivotValue * multipliersL[j];
|
1105
|
-
double absValue = fabs ( value );
|
1106
|
-
|
1107
|
-
if ( absValue > tolerance ) {
|
1108
|
-
work[j] = 0.0;
|
1109
|
-
assert (put<lengthAreaU_);
|
1110
|
-
elementU[put] = value;
|
1111
|
-
indexRowU[put] = indexL[j];
|
1112
|
-
if ( absValue > largest ) {
|
1113
|
-
largest = absValue;
|
1114
|
-
positionLargest = put;
|
1115
|
-
}
|
1116
|
-
put++;
|
1117
|
-
} else {
|
1118
|
-
work[j] = 0.0;
|
1119
|
-
added--;
|
1120
|
-
int word = j >> COINFACTORIZATION_SHIFT_PER_INT;
|
1121
|
-
int bit = j & COINFACTORIZATION_MASK_PER_INT;
|
1122
|
-
|
1123
|
-
if ( temp2[word] & ( 1 << bit ) ) {
|
1124
|
-
//take out of row list
|
1125
|
-
iRow = indexL[j];
|
1126
|
-
CoinBigIndex start = startRowU[iRow];
|
1127
|
-
CoinBigIndex end = start + numberInRow[iRow];
|
1128
|
-
CoinBigIndex where = start;
|
1129
|
-
|
1130
|
-
while ( indexColumnU[where] != iColumn ) {
|
1131
|
-
where++;
|
1132
|
-
} /* endwhile */
|
1133
|
-
#if DEBUG_COIN
|
1134
|
-
if ( where >= end ) {
|
1135
|
-
abort ( );
|
1136
|
-
}
|
1137
|
-
#endif
|
1138
|
-
indexColumnU[where] = indexColumnU[end - 1];
|
1139
|
-
numberInRow[iRow]--;
|
1140
|
-
} else {
|
1141
|
-
//make sure won't be added
|
1142
|
-
int word = j >> COINFACTORIZATION_SHIFT_PER_INT;
|
1143
|
-
int bit = j & COINFACTORIZATION_MASK_PER_INT;
|
1144
|
-
|
1145
|
-
temp2[word] = temp2[word] | ( 1 << bit ); //say already in counts
|
1146
|
-
}
|
1147
|
-
}
|
1148
|
-
}
|
1149
|
-
numberInColumn[iColumn] = put - startColumn;
|
1150
|
-
//move largest
|
1151
|
-
if ( positionLargest >= 0 ) {
|
1152
|
-
value = elementU[positionLargest];
|
1153
|
-
iRow = indexRowU[positionLargest];
|
1154
|
-
elementU[positionLargest] = elementU[startColumn];
|
1155
|
-
indexRowU[positionLargest] = indexRowU[startColumn];
|
1156
|
-
elementU[startColumn] = value;
|
1157
|
-
indexRowU[startColumn] = iRow;
|
1158
|
-
}
|
1159
|
-
//linked list for column
|
1160
|
-
if ( nextCount[iColumn + numberRows_] != -2 ) {
|
1161
|
-
//modify linked list
|
1162
|
-
deleteLink ( iColumn + numberRows_ );
|
1163
|
-
addLink ( iColumn + numberRows_, numberInColumn[iColumn] );
|
1164
|
-
}
|
1165
|
-
temp2 += increment2;
|
1166
|
-
}
|
1167
|
-
//get space for row list
|
1168
|
-
unsigned int *putBase = workArea2;
|
1169
|
-
int bigLoops = numberInPivotColumn >> COINFACTORIZATION_SHIFT_PER_INT;
|
1170
|
-
int i = 0;
|
1171
|
-
|
1172
|
-
// do linked lists and update counts
|
1173
|
-
while ( bigLoops ) {
|
1174
|
-
bigLoops--;
|
1175
|
-
int bit;
|
1176
|
-
for ( bit = 0; bit < COINFACTORIZATION_BITS_PER_INT; i++, bit++ ) {
|
1177
|
-
unsigned int *putThis = putBase;
|
1178
|
-
int iRow = indexL[i];
|
1179
|
-
|
1180
|
-
//get space
|
1181
|
-
int number = 0;
|
1182
|
-
int jColumn;
|
1183
|
-
|
1184
|
-
for ( jColumn = 0; jColumn < numberInPivotRow; jColumn++ ) {
|
1185
|
-
unsigned int test = *putThis;
|
1186
|
-
|
1187
|
-
putThis += increment2;
|
1188
|
-
test = 1 - ( ( test >> bit ) & 1 );
|
1189
|
-
number += test;
|
1190
|
-
}
|
1191
|
-
int next = nextRow[iRow];
|
1192
|
-
CoinBigIndex space;
|
1193
|
-
|
1194
|
-
space = startRowU[next] - startRowU[iRow];
|
1195
|
-
number += numberInRow[iRow];
|
1196
|
-
if ( space < number ) {
|
1197
|
-
if ( !getRowSpace ( iRow, number ) ) {
|
1198
|
-
return false;
|
1199
|
-
}
|
1200
|
-
}
|
1201
|
-
// now do
|
1202
|
-
putThis = putBase;
|
1203
|
-
next = nextRow[iRow];
|
1204
|
-
number = numberInRow[iRow];
|
1205
|
-
CoinBigIndex end = startRowU[iRow] + number;
|
1206
|
-
int saveIndex = indexColumnU[startRowU[next]];
|
1207
|
-
|
1208
|
-
//add in
|
1209
|
-
for ( jColumn = 0; jColumn < numberInPivotRow; jColumn++ ) {
|
1210
|
-
unsigned int test = *putThis;
|
1211
|
-
|
1212
|
-
putThis += increment2;
|
1213
|
-
test = 1 - ( ( test >> bit ) & 1 );
|
1214
|
-
indexColumnU[end] = saveColumn[jColumn];
|
1215
|
-
end += test;
|
1216
|
-
}
|
1217
|
-
//put back next one in case zapped
|
1218
|
-
indexColumnU[startRowU[next]] = saveIndex;
|
1219
|
-
markRow[iRow] = static_cast<T>(largeInteger+1);
|
1220
|
-
number = end - startRowU[iRow];
|
1221
|
-
numberInRow[iRow] = number;
|
1222
|
-
deleteLink ( iRow );
|
1223
|
-
addLink ( iRow, number );
|
1224
|
-
}
|
1225
|
-
putBase++;
|
1226
|
-
} /* endwhile */
|
1227
|
-
int bit;
|
1228
|
-
|
1229
|
-
for ( bit = 0; i < numberInPivotColumn; i++, bit++ ) {
|
1230
|
-
unsigned int *putThis = putBase;
|
1231
|
-
int iRow = indexL[i];
|
1232
|
-
|
1233
|
-
//get space
|
1234
|
-
int number = 0;
|
1235
|
-
int jColumn;
|
1236
|
-
|
1237
|
-
for ( jColumn = 0; jColumn < numberInPivotRow; jColumn++ ) {
|
1238
|
-
unsigned int test = *putThis;
|
1239
|
-
|
1240
|
-
putThis += increment2;
|
1241
|
-
test = 1 - ( ( test >> bit ) & 1 );
|
1242
|
-
number += test;
|
1243
|
-
}
|
1244
|
-
int next = nextRow[iRow];
|
1245
|
-
CoinBigIndex space;
|
1246
|
-
|
1247
|
-
space = startRowU[next] - startRowU[iRow];
|
1248
|
-
number += numberInRow[iRow];
|
1249
|
-
if ( space < number ) {
|
1250
|
-
if ( !getRowSpace ( iRow, number ) ) {
|
1251
|
-
return false;
|
1252
|
-
}
|
1253
|
-
}
|
1254
|
-
// now do
|
1255
|
-
putThis = putBase;
|
1256
|
-
next = nextRow[iRow];
|
1257
|
-
number = numberInRow[iRow];
|
1258
|
-
CoinBigIndex end = startRowU[iRow] + number;
|
1259
|
-
int saveIndex;
|
1260
|
-
|
1261
|
-
saveIndex = indexColumnU[startRowU[next]];
|
1262
|
-
|
1263
|
-
//add in
|
1264
|
-
for ( jColumn = 0; jColumn < numberInPivotRow; jColumn++ ) {
|
1265
|
-
unsigned int test = *putThis;
|
1266
|
-
|
1267
|
-
putThis += increment2;
|
1268
|
-
test = 1 - ( ( test >> bit ) & 1 );
|
1269
|
-
|
1270
|
-
indexColumnU[end] = saveColumn[jColumn];
|
1271
|
-
end += test;
|
1272
|
-
}
|
1273
|
-
indexColumnU[startRowU[next]] = saveIndex;
|
1274
|
-
markRow[iRow] = static_cast<T>(largeInteger+1);
|
1275
|
-
number = end - startRowU[iRow];
|
1276
|
-
numberInRow[iRow] = number;
|
1277
|
-
deleteLink ( iRow );
|
1278
|
-
addLink ( iRow, number );
|
1279
|
-
}
|
1280
|
-
markRow[pivotRow] = static_cast<T>(largeInteger+1);
|
1281
|
-
//modify linked list for pivots
|
1282
|
-
deleteLink ( pivotRow );
|
1283
|
-
deleteLink ( pivotColumn + numberRows_ );
|
1284
|
-
totalElements_ += added;
|
1285
|
-
return true;
|
1286
|
-
}
|
1287
|
-
|
1288
|
-
/********************************* END LARGE TEMPLATE ********/
|
1289
|
-
//@}
|
1290
|
-
////////////////// data //////////////////
|
1291
|
-
protected:
|
1292
|
-
|
1293
|
-
/**@name data */
|
1294
|
-
//@{
|
1295
|
-
/// Pivot tolerance
|
1296
|
-
double pivotTolerance_;
|
1297
|
-
/// Zero tolerance
|
1298
|
-
double zeroTolerance_;
|
1299
|
-
#ifndef COIN_FAST_CODE
|
1300
|
-
/// Whether slack value is +1 or -1
|
1301
|
-
double slackValue_;
|
1302
|
-
#else
|
1303
|
-
#ifndef slackValue_
|
1304
|
-
#define slackValue_ -1.0
|
1305
|
-
#endif
|
1306
|
-
#endif
|
1307
|
-
/// How much to multiply areas by
|
1308
|
-
double areaFactor_;
|
1309
|
-
/// Relax check on accuracy in replaceColumn
|
1310
|
-
double relaxCheck_;
|
1311
|
-
/// Number of Rows in factorization
|
1312
|
-
int numberRows_;
|
1313
|
-
/// Number of Rows after iterating
|
1314
|
-
int numberRowsExtra_;
|
1315
|
-
/// Maximum number of Rows after iterating
|
1316
|
-
int maximumRowsExtra_;
|
1317
|
-
/// Number of Columns in factorization
|
1318
|
-
int numberColumns_;
|
1319
|
-
/// Number of Columns after iterating
|
1320
|
-
int numberColumnsExtra_;
|
1321
|
-
/// Maximum number of Columns after iterating
|
1322
|
-
int maximumColumnsExtra_;
|
1323
|
-
/// Number factorized in U (not row singletons)
|
1324
|
-
int numberGoodU_;
|
1325
|
-
/// Number factorized in L
|
1326
|
-
int numberGoodL_;
|
1327
|
-
/// Maximum number of pivots before factorization
|
1328
|
-
int maximumPivots_;
|
1329
|
-
/// Number pivots since last factorization
|
1330
|
-
int numberPivots_;
|
1331
|
-
/// Number of elements in U (to go)
|
1332
|
-
/// or while iterating total overall
|
1333
|
-
CoinBigIndex totalElements_;
|
1334
|
-
/// Number of elements after factorization
|
1335
|
-
CoinBigIndex factorElements_;
|
1336
|
-
/// Pivot order for each Column
|
1337
|
-
CoinIntArrayWithLength pivotColumn_;
|
1338
|
-
/// Permutation vector for pivot row order
|
1339
|
-
CoinIntArrayWithLength permute_;
|
1340
|
-
/// DePermutation vector for pivot row order
|
1341
|
-
CoinIntArrayWithLength permuteBack_;
|
1342
|
-
/// Inverse Pivot order for each Column
|
1343
|
-
CoinIntArrayWithLength pivotColumnBack_;
|
1344
|
-
/// Status of factorization
|
1345
|
-
int status_;
|
1346
|
-
|
1347
|
-
/** 0 - no increasing rows - no permutations,
|
1348
|
-
1 - no increasing rows but permutations
|
1349
|
-
2 - increasing rows
|
1350
|
-
- taken out as always 2 */
|
1351
|
-
//int increasingRows_;
|
1352
|
-
|
1353
|
-
/// Number of trials before rejection
|
1354
|
-
int numberTrials_;
|
1355
|
-
/// Start of each Row as pointer
|
1356
|
-
CoinBigIndexArrayWithLength startRowU_;
|
1357
|
-
|
1358
|
-
/// Number in each Row
|
1359
|
-
CoinIntArrayWithLength numberInRow_;
|
1360
|
-
|
1361
|
-
/// Number in each Column
|
1362
|
-
CoinIntArrayWithLength numberInColumn_;
|
1363
|
-
|
1364
|
-
/// Number in each Column including pivoted
|
1365
|
-
CoinIntArrayWithLength numberInColumnPlus_;
|
1366
|
-
|
1367
|
-
/** First Row/Column with count of k,
|
1368
|
-
can tell which by offset - Rows then Columns */
|
1369
|
-
CoinIntArrayWithLength firstCount_;
|
1370
|
-
|
1371
|
-
/// Next Row/Column with count
|
1372
|
-
CoinIntArrayWithLength nextCount_;
|
1373
|
-
|
1374
|
-
/// Previous Row/Column with count
|
1375
|
-
CoinIntArrayWithLength lastCount_;
|
1376
|
-
|
1377
|
-
/// Next Column in memory order
|
1378
|
-
CoinIntArrayWithLength nextColumn_;
|
1379
|
-
|
1380
|
-
/// Previous Column in memory order
|
1381
|
-
CoinIntArrayWithLength lastColumn_;
|
1382
|
-
|
1383
|
-
/// Next Row in memory order
|
1384
|
-
CoinIntArrayWithLength nextRow_;
|
1385
|
-
|
1386
|
-
/// Previous Row in memory order
|
1387
|
-
CoinIntArrayWithLength lastRow_;
|
1388
|
-
|
1389
|
-
/// Columns left to do in a single pivot
|
1390
|
-
CoinIntArrayWithLength saveColumn_;
|
1391
|
-
|
1392
|
-
/// Marks rows to be updated
|
1393
|
-
CoinIntArrayWithLength markRow_;
|
1394
|
-
|
1395
|
-
/// Detail in messages
|
1396
|
-
int messageLevel_;
|
1397
|
-
|
1398
|
-
/// Larger of row and column size
|
1399
|
-
int biggerDimension_;
|
1400
|
-
|
1401
|
-
/// Base address for U (may change)
|
1402
|
-
CoinIntArrayWithLength indexColumnU_;
|
1403
|
-
|
1404
|
-
/// Pivots for L
|
1405
|
-
CoinIntArrayWithLength pivotRowL_;
|
1406
|
-
|
1407
|
-
/// Inverses of pivot values
|
1408
|
-
CoinFactorizationDoubleArrayWithLength pivotRegion_;
|
1409
|
-
|
1410
|
-
/// Number of slacks at beginning of U
|
1411
|
-
int numberSlacks_;
|
1412
|
-
|
1413
|
-
/// Number in U
|
1414
|
-
int numberU_;
|
1415
|
-
|
1416
|
-
/// Maximum space used in U
|
1417
|
-
CoinBigIndex maximumU_;
|
1418
|
-
|
1419
|
-
/// Base of U is always 0
|
1420
|
-
//int baseU_;
|
1421
|
-
|
1422
|
-
/// Length of U
|
1423
|
-
CoinBigIndex lengthU_;
|
1424
|
-
|
1425
|
-
/// Length of area reserved for U
|
1426
|
-
CoinBigIndex lengthAreaU_;
|
1427
|
-
|
1428
|
-
/// Elements of U
|
1429
|
-
CoinFactorizationDoubleArrayWithLength elementU_;
|
1430
|
-
|
1431
|
-
/// Row indices of U
|
1432
|
-
CoinIntArrayWithLength indexRowU_;
|
1433
|
-
|
1434
|
-
/// Start of each column in U
|
1435
|
-
CoinBigIndexArrayWithLength startColumnU_;
|
1436
|
-
|
1437
|
-
/// Converts rows to columns in U
|
1438
|
-
CoinBigIndexArrayWithLength convertRowToColumnU_;
|
1439
|
-
|
1440
|
-
/// Number in L
|
1441
|
-
CoinBigIndex numberL_;
|
1442
|
-
|
1443
|
-
/// Base of L
|
1444
|
-
CoinBigIndex baseL_;
|
1445
|
-
|
1446
|
-
/// Length of L
|
1447
|
-
CoinBigIndex lengthL_;
|
1448
|
-
|
1449
|
-
/// Length of area reserved for L
|
1450
|
-
CoinBigIndex lengthAreaL_;
|
1451
|
-
|
1452
|
-
/// Elements of L
|
1453
|
-
CoinFactorizationDoubleArrayWithLength elementL_;
|
1454
|
-
|
1455
|
-
/// Row indices of L
|
1456
|
-
CoinIntArrayWithLength indexRowL_;
|
1457
|
-
|
1458
|
-
/// Start of each column in L
|
1459
|
-
CoinBigIndexArrayWithLength startColumnL_;
|
1460
|
-
|
1461
|
-
/// true if Forrest Tomlin update, false if PFI
|
1462
|
-
bool doForrestTomlin_;
|
1463
|
-
|
1464
|
-
/// Number in R
|
1465
|
-
int numberR_;
|
1466
|
-
|
1467
|
-
/// Length of R stuff
|
1468
|
-
CoinBigIndex lengthR_;
|
1469
|
-
|
1470
|
-
/// length of area reserved for R
|
1471
|
-
CoinBigIndex lengthAreaR_;
|
1472
|
-
|
1473
|
-
/// Elements of R
|
1474
|
-
CoinFactorizationDouble *elementR_;
|
1475
|
-
|
1476
|
-
/// Row indices for R
|
1477
|
-
int *indexRowR_;
|
1478
|
-
|
1479
|
-
/// Start of columns for R
|
1480
|
-
CoinBigIndexArrayWithLength startColumnR_;
|
1481
|
-
|
1482
|
-
/// Dense area
|
1483
|
-
double * denseArea_;
|
1484
|
-
|
1485
|
-
/// Dense area - actually used (for alignment etc)
|
1486
|
-
double * denseAreaAddress_;
|
1487
|
-
|
1488
|
-
/// Dense permutation
|
1489
|
-
int * densePermute_;
|
1490
|
-
|
1491
|
-
/// Number of dense rows
|
1492
|
-
int numberDense_;
|
1493
|
-
|
1494
|
-
/// Dense threshold
|
1495
|
-
int denseThreshold_;
|
1496
|
-
|
1497
|
-
/// First work area
|
1498
|
-
CoinFactorizationDoubleArrayWithLength workArea_;
|
1499
|
-
|
1500
|
-
/// Second work area
|
1501
|
-
CoinUnsignedIntArrayWithLength workArea2_;
|
1502
|
-
|
1503
|
-
/// Number of compressions done
|
1504
|
-
CoinBigIndex numberCompressions_;
|
1505
|
-
|
1506
|
-
public:
|
1507
|
-
/// Below are all to collect
|
1508
|
-
mutable double ftranCountInput_;
|
1509
|
-
mutable double ftranCountAfterL_;
|
1510
|
-
mutable double ftranCountAfterR_;
|
1511
|
-
mutable double ftranCountAfterU_;
|
1512
|
-
mutable double btranCountInput_;
|
1513
|
-
mutable double btranCountAfterU_;
|
1514
|
-
mutable double btranCountAfterR_;
|
1515
|
-
mutable double btranCountAfterL_;
|
1516
|
-
|
1517
|
-
/// We can roll over factorizations
|
1518
|
-
mutable int numberFtranCounts_;
|
1519
|
-
mutable int numberBtranCounts_;
|
1520
|
-
|
1521
|
-
/// While these are average ratios collected over last period
|
1522
|
-
double ftranAverageAfterL_;
|
1523
|
-
double ftranAverageAfterR_;
|
1524
|
-
double ftranAverageAfterU_;
|
1525
|
-
double btranAverageAfterU_;
|
1526
|
-
double btranAverageAfterR_;
|
1527
|
-
double btranAverageAfterL_;
|
1528
|
-
protected:
|
1529
|
-
|
1530
|
-
/// For statistics
|
1531
|
-
#if 0
|
1532
|
-
mutable bool collectStatistics_;
|
1533
|
-
#else
|
1534
|
-
#define collectStatistics_ 1
|
1535
|
-
#endif
|
1536
|
-
|
1537
|
-
/// Below this use sparse technology - if 0 then no L row copy
|
1538
|
-
int sparseThreshold_;
|
1539
|
-
|
1540
|
-
/// And one for "sparsish"
|
1541
|
-
int sparseThreshold2_;
|
1542
|
-
|
1543
|
-
/// Start of each row in L
|
1544
|
-
CoinBigIndexArrayWithLength startRowL_;
|
1545
|
-
|
1546
|
-
/// Index of column in row for L
|
1547
|
-
CoinIntArrayWithLength indexColumnL_;
|
1548
|
-
|
1549
|
-
/// Elements in L (row copy)
|
1550
|
-
CoinFactorizationDoubleArrayWithLength elementByRowL_;
|
1551
|
-
|
1552
|
-
/// Sparse regions
|
1553
|
-
mutable CoinIntArrayWithLength sparse_;
|
1554
|
-
/** L to U bias
|
1555
|
-
0 - U bias, 1 - some U bias, 2 some L bias, 3 L bias
|
1556
|
-
*/
|
1557
|
-
int biasLU_;
|
1558
|
-
/** Array persistence flag
|
1559
|
-
If 0 then as now (delete/new)
|
1560
|
-
1 then only do arrays if bigger needed
|
1561
|
-
2 as 1 but give a bit extra if bigger needed
|
1562
|
-
*/
|
1563
|
-
int persistenceFlag_;
|
1564
|
-
#ifdef ABC_USE_COIN_FACTORIZATION
|
1565
|
-
/// Says if parallel
|
1566
|
-
int parallelMode_;
|
1567
|
-
#endif
|
1568
|
-
//@}
|
1569
|
-
};
|
1570
|
-
// Dense coding
|
1571
|
-
#ifdef COIN_HAS_LAPACK
|
1572
|
-
#ifndef COIN_FACTORIZATION_DENSE_CODE
|
1573
|
-
#define COIN_FACTORIZATION_DENSE_CODE 1
|
1574
|
-
#endif
|
1575
|
-
#endif
|
1576
|
-
#ifdef COIN_FACTORIZATION_DENSE_CODE
|
1577
|
-
/* Type of Fortran integer translated into C */
|
1578
|
-
#ifndef ipfint
|
1579
|
-
//typedef ipfint FORTRAN_INTEGER_TYPE ;
|
1580
|
-
typedef int ipfint;
|
1581
|
-
typedef const int cipfint;
|
1582
|
-
#endif
|
1583
|
-
#endif
|
1584
|
-
#endif
|
1585
|
-
// Extra for ugly include
|
1586
|
-
#ifdef UGLY_COIN_FACTOR_CODING
|
1587
|
-
#define FAC_UNSET (FAC_SET+1)
|
1588
|
-
{
|
1589
|
-
goodPivot=false;
|
1590
|
-
//store pivot columns (so can easily compress)
|
1591
|
-
CoinBigIndex startColumnThis = startColumn[iPivotColumn];
|
1592
|
-
CoinBigIndex endColumn = startColumnThis + numberDoColumn + 1;
|
1593
|
-
int put = 0;
|
1594
|
-
CoinBigIndex startRowThis = startRow[iPivotRow];
|
1595
|
-
CoinBigIndex endRow = startRowThis + numberDoRow + 1;
|
1596
|
-
if ( pivotColumnPosition < 0 ) {
|
1597
|
-
for ( pivotColumnPosition = startRowThis; pivotColumnPosition < endRow; pivotColumnPosition++ ) {
|
1598
|
-
int iColumn = indexColumn[pivotColumnPosition];
|
1599
|
-
if ( iColumn != iPivotColumn ) {
|
1600
|
-
saveColumn[put++] = iColumn;
|
1601
|
-
} else {
|
1602
|
-
break;
|
1603
|
-
}
|
1604
|
-
}
|
1605
|
-
} else {
|
1606
|
-
for (CoinBigIndex i = startRowThis ; i < pivotColumnPosition ; i++ ) {
|
1607
|
-
saveColumn[put++] = indexColumn[i];
|
1608
|
-
}
|
1609
|
-
}
|
1610
|
-
assert (pivotColumnPosition<endRow);
|
1611
|
-
assert (indexColumn[pivotColumnPosition]==iPivotColumn);
|
1612
|
-
pivotColumnPosition++;
|
1613
|
-
for ( ; pivotColumnPosition < endRow; pivotColumnPosition++ ) {
|
1614
|
-
saveColumn[put++] = indexColumn[pivotColumnPosition];
|
1615
|
-
}
|
1616
|
-
//take out this bit of indexColumn
|
1617
|
-
int next = nextRow[iPivotRow];
|
1618
|
-
int last = lastRow[iPivotRow];
|
1619
|
-
|
1620
|
-
nextRow[last] = next;
|
1621
|
-
lastRow[next] = last;
|
1622
|
-
nextRow[iPivotRow] = numberGoodU_; //use for permute
|
1623
|
-
lastRow[iPivotRow] = -2;
|
1624
|
-
numberInRow[iPivotRow] = 0;
|
1625
|
-
//store column in L, compress in U and take column out
|
1626
|
-
CoinBigIndex l = lengthL_;
|
1627
|
-
// **** HORRID coding coming up but a goto seems best!
|
1628
|
-
{
|
1629
|
-
if ( l + numberDoColumn > lengthAreaL_ ) {
|
1630
|
-
//need more memory
|
1631
|
-
if ((messageLevel_&4)!=0)
|
1632
|
-
printf("more memory needed in middle of invert\n");
|
1633
|
-
goto BAD_PIVOT;
|
1634
|
-
}
|
1635
|
-
//l+=currentAreaL_->elementByColumn-elementL;
|
1636
|
-
CoinBigIndex lSave = l;
|
1637
|
-
|
1638
|
-
CoinBigIndex * startColumnL = startColumnL_.array();
|
1639
|
-
startColumnL[numberGoodL_] = l; //for luck and first time
|
1640
|
-
numberGoodL_++;
|
1641
|
-
startColumnL[numberGoodL_] = l + numberDoColumn;
|
1642
|
-
lengthL_ += numberDoColumn;
|
1643
|
-
if ( pivotRowPosition < 0 ) {
|
1644
|
-
for ( pivotRowPosition = startColumnThis; pivotRowPosition < endColumn; pivotRowPosition++ ) {
|
1645
|
-
int iRow = indexRow[pivotRowPosition];
|
1646
|
-
if ( iRow != iPivotRow ) {
|
1647
|
-
indexRowL[l] = iRow;
|
1648
|
-
elementL[l] = element[pivotRowPosition];
|
1649
|
-
markRow[iRow] = l - lSave;
|
1650
|
-
l++;
|
1651
|
-
//take out of row list
|
1652
|
-
CoinBigIndex start = startRow[iRow];
|
1653
|
-
CoinBigIndex end = start + numberInRow[iRow];
|
1654
|
-
CoinBigIndex where = start;
|
1655
|
-
|
1656
|
-
while ( indexColumn[where] != iPivotColumn ) {
|
1657
|
-
where++;
|
1658
|
-
} /* endwhile */
|
1659
|
-
#if DEBUG_COIN
|
1660
|
-
if ( where >= end ) {
|
1661
|
-
abort ( );
|
1662
|
-
}
|
1663
|
-
#endif
|
1664
|
-
indexColumn[where] = indexColumn[end - 1];
|
1665
|
-
numberInRow[iRow]--;
|
1666
|
-
} else {
|
1667
|
-
break;
|
1668
|
-
}
|
1669
|
-
}
|
1670
|
-
} else {
|
1671
|
-
CoinBigIndex i;
|
1672
|
-
|
1673
|
-
for ( i = startColumnThis; i < pivotRowPosition; i++ ) {
|
1674
|
-
int iRow = indexRow[i];
|
1675
|
-
|
1676
|
-
markRow[iRow] = l - lSave;
|
1677
|
-
indexRowL[l] = iRow;
|
1678
|
-
elementL[l] = element[i];
|
1679
|
-
l++;
|
1680
|
-
//take out of row list
|
1681
|
-
CoinBigIndex start = startRow[iRow];
|
1682
|
-
CoinBigIndex end = start + numberInRow[iRow];
|
1683
|
-
CoinBigIndex where = start;
|
1684
|
-
|
1685
|
-
while ( indexColumn[where] != iPivotColumn ) {
|
1686
|
-
where++;
|
1687
|
-
} /* endwhile */
|
1688
|
-
#if DEBUG_COIN
|
1689
|
-
if ( where >= end ) {
|
1690
|
-
abort ( );
|
1691
|
-
}
|
1692
|
-
#endif
|
1693
|
-
indexColumn[where] = indexColumn[end - 1];
|
1694
|
-
numberInRow[iRow]--;
|
1695
|
-
assert (numberInRow[iRow]>=0);
|
1696
|
-
}
|
1697
|
-
}
|
1698
|
-
assert (pivotRowPosition<endColumn);
|
1699
|
-
assert (indexRow[pivotRowPosition]==iPivotRow);
|
1700
|
-
CoinFactorizationDouble pivotElement = element[pivotRowPosition];
|
1701
|
-
CoinFactorizationDouble pivotMultiplier = 1.0 / pivotElement;
|
1702
|
-
|
1703
|
-
pivotRegion_.array()[numberGoodU_] = pivotMultiplier;
|
1704
|
-
pivotRowPosition++;
|
1705
|
-
for ( ; pivotRowPosition < endColumn; pivotRowPosition++ ) {
|
1706
|
-
int iRow = indexRow[pivotRowPosition];
|
1707
|
-
|
1708
|
-
markRow[iRow] = l - lSave;
|
1709
|
-
indexRowL[l] = iRow;
|
1710
|
-
elementL[l] = element[pivotRowPosition];
|
1711
|
-
l++;
|
1712
|
-
//take out of row list
|
1713
|
-
CoinBigIndex start = startRow[iRow];
|
1714
|
-
CoinBigIndex end = start + numberInRow[iRow];
|
1715
|
-
CoinBigIndex where = start;
|
1716
|
-
|
1717
|
-
while ( indexColumn[where] != iPivotColumn ) {
|
1718
|
-
where++;
|
1719
|
-
} /* endwhile */
|
1720
|
-
#if DEBUG_COIN
|
1721
|
-
if ( where >= end ) {
|
1722
|
-
abort ( );
|
1723
|
-
}
|
1724
|
-
#endif
|
1725
|
-
indexColumn[where] = indexColumn[end - 1];
|
1726
|
-
numberInRow[iRow]--;
|
1727
|
-
assert (numberInRow[iRow]>=0);
|
1728
|
-
}
|
1729
|
-
markRow[iPivotRow] = FAC_SET;
|
1730
|
-
//compress pivot column (move pivot to front including saved)
|
1731
|
-
numberInColumn[iPivotColumn] = 0;
|
1732
|
-
//use end of L for temporary space
|
1733
|
-
int *indexL = &indexRowL[lSave];
|
1734
|
-
CoinFactorizationDouble *multipliersL = &elementL[lSave];
|
1735
|
-
|
1736
|
-
//adjust
|
1737
|
-
int j;
|
1738
|
-
|
1739
|
-
for ( j = 0; j < numberDoColumn; j++ ) {
|
1740
|
-
multipliersL[j] *= pivotMultiplier;
|
1741
|
-
}
|
1742
|
-
//zero out fill
|
1743
|
-
CoinBigIndex iErase;
|
1744
|
-
for ( iErase = 0; iErase < increment2 * numberDoRow;
|
1745
|
-
iErase++ ) {
|
1746
|
-
workArea2[iErase] = 0;
|
1747
|
-
}
|
1748
|
-
CoinBigIndex added = numberDoRow * numberDoColumn;
|
1749
|
-
unsigned int *temp2 = workArea2;
|
1750
|
-
int * nextColumn = nextColumn_.array();
|
1751
|
-
|
1752
|
-
//pack down and move to work
|
1753
|
-
int jColumn;
|
1754
|
-
for ( jColumn = 0; jColumn < numberDoRow; jColumn++ ) {
|
1755
|
-
int iColumn = saveColumn[jColumn];
|
1756
|
-
CoinBigIndex startColumnThis = startColumn[iColumn];
|
1757
|
-
CoinBigIndex endColumn = startColumnThis + numberInColumn[iColumn];
|
1758
|
-
int iRow = indexRow[startColumnThis];
|
1759
|
-
CoinFactorizationDouble value = element[startColumnThis];
|
1760
|
-
double largest;
|
1761
|
-
CoinBigIndex put = startColumnThis;
|
1762
|
-
CoinBigIndex positionLargest = -1;
|
1763
|
-
CoinFactorizationDouble thisPivotValue = 0.0;
|
1764
|
-
|
1765
|
-
//compress column and find largest not updated
|
1766
|
-
bool checkLargest;
|
1767
|
-
int mark = markRow[iRow];
|
1768
|
-
|
1769
|
-
if ( mark == FAC_UNSET ) {
|
1770
|
-
largest = fabs ( value );
|
1771
|
-
positionLargest = put;
|
1772
|
-
put++;
|
1773
|
-
checkLargest = false;
|
1774
|
-
} else {
|
1775
|
-
//need to find largest
|
1776
|
-
largest = 0.0;
|
1777
|
-
checkLargest = true;
|
1778
|
-
if ( mark != FAC_SET ) {
|
1779
|
-
//will be updated
|
1780
|
-
workArea[mark] = value;
|
1781
|
-
int word = mark >> COINFACTORIZATION_SHIFT_PER_INT;
|
1782
|
-
int bit = mark & COINFACTORIZATION_MASK_PER_INT;
|
1783
|
-
|
1784
|
-
temp2[word] = temp2[word] | ( 1 << bit ); //say already in counts
|
1785
|
-
added--;
|
1786
|
-
} else {
|
1787
|
-
thisPivotValue = value;
|
1788
|
-
}
|
1789
|
-
}
|
1790
|
-
CoinBigIndex i;
|
1791
|
-
for ( i = startColumnThis + 1; i < endColumn; i++ ) {
|
1792
|
-
iRow = indexRow[i];
|
1793
|
-
value = element[i];
|
1794
|
-
int mark = markRow[iRow];
|
1795
|
-
|
1796
|
-
if ( mark == FAC_UNSET ) {
|
1797
|
-
//keep
|
1798
|
-
indexRow[put] = iRow;
|
1799
|
-
element[put] = value;
|
1800
|
-
if ( checkLargest ) {
|
1801
|
-
double absValue = fabs ( value );
|
1802
|
-
|
1803
|
-
if ( absValue > largest ) {
|
1804
|
-
largest = absValue;
|
1805
|
-
positionLargest = put;
|
1806
|
-
}
|
1807
|
-
}
|
1808
|
-
put++;
|
1809
|
-
} else if ( mark != FAC_SET ) {
|
1810
|
-
//will be updated
|
1811
|
-
workArea[mark] = value;
|
1812
|
-
int word = mark >> COINFACTORIZATION_SHIFT_PER_INT;
|
1813
|
-
int bit = mark & COINFACTORIZATION_MASK_PER_INT;
|
1814
|
-
|
1815
|
-
temp2[word] = temp2[word] | ( 1 << bit ); //say already in counts
|
1816
|
-
added--;
|
1817
|
-
} else {
|
1818
|
-
thisPivotValue = value;
|
1819
|
-
}
|
1820
|
-
}
|
1821
|
-
//slot in pivot
|
1822
|
-
element[put] = element[startColumnThis];
|
1823
|
-
indexRow[put] = indexRow[startColumnThis];
|
1824
|
-
if ( positionLargest == startColumnThis ) {
|
1825
|
-
positionLargest = put; //follow if was largest
|
1826
|
-
}
|
1827
|
-
put++;
|
1828
|
-
element[startColumnThis] = thisPivotValue;
|
1829
|
-
indexRow[startColumnThis] = iPivotRow;
|
1830
|
-
//clean up counts
|
1831
|
-
startColumnThis++;
|
1832
|
-
numberInColumn[iColumn] = put - startColumnThis;
|
1833
|
-
int * numberInColumnPlus = numberInColumnPlus_.array();
|
1834
|
-
numberInColumnPlus[iColumn]++;
|
1835
|
-
startColumn[iColumn]++;
|
1836
|
-
//how much space have we got
|
1837
|
-
int next = nextColumn[iColumn];
|
1838
|
-
CoinBigIndex space;
|
1839
|
-
|
1840
|
-
space = startColumn[next] - put - numberInColumnPlus[next];
|
1841
|
-
//assume no zero elements
|
1842
|
-
if ( numberDoColumn > space ) {
|
1843
|
-
//getColumnSpace also moves fixed part
|
1844
|
-
if ( !getColumnSpace ( iColumn, numberDoColumn ) ) {
|
1845
|
-
goto BAD_PIVOT;
|
1846
|
-
}
|
1847
|
-
//redo starts
|
1848
|
-
positionLargest = positionLargest + startColumn[iColumn] - startColumnThis;
|
1849
|
-
startColumnThis = startColumn[iColumn];
|
1850
|
-
put = startColumnThis + numberInColumn[iColumn];
|
1851
|
-
}
|
1852
|
-
double tolerance = zeroTolerance_;
|
1853
|
-
|
1854
|
-
int *nextCount = nextCount_.array();
|
1855
|
-
for ( j = 0; j < numberDoColumn; j++ ) {
|
1856
|
-
value = workArea[j] - thisPivotValue * multipliersL[j];
|
1857
|
-
double absValue = fabs ( value );
|
1858
|
-
|
1859
|
-
if ( absValue > tolerance ) {
|
1860
|
-
workArea[j] = 0.0;
|
1861
|
-
element[put] = value;
|
1862
|
-
indexRow[put] = indexL[j];
|
1863
|
-
if ( absValue > largest ) {
|
1864
|
-
largest = absValue;
|
1865
|
-
positionLargest = put;
|
1866
|
-
}
|
1867
|
-
put++;
|
1868
|
-
} else {
|
1869
|
-
workArea[j] = 0.0;
|
1870
|
-
added--;
|
1871
|
-
int word = j >> COINFACTORIZATION_SHIFT_PER_INT;
|
1872
|
-
int bit = j & COINFACTORIZATION_MASK_PER_INT;
|
1873
|
-
|
1874
|
-
if ( temp2[word] & ( 1 << bit ) ) {
|
1875
|
-
//take out of row list
|
1876
|
-
iRow = indexL[j];
|
1877
|
-
CoinBigIndex start = startRow[iRow];
|
1878
|
-
CoinBigIndex end = start + numberInRow[iRow];
|
1879
|
-
CoinBigIndex where = start;
|
1880
|
-
|
1881
|
-
while ( indexColumn[where] != iColumn ) {
|
1882
|
-
where++;
|
1883
|
-
} /* endwhile */
|
1884
|
-
#if DEBUG_COIN
|
1885
|
-
if ( where >= end ) {
|
1886
|
-
abort ( );
|
1887
|
-
}
|
1888
|
-
#endif
|
1889
|
-
indexColumn[where] = indexColumn[end - 1];
|
1890
|
-
numberInRow[iRow]--;
|
1891
|
-
} else {
|
1892
|
-
//make sure won't be added
|
1893
|
-
int word = j >> COINFACTORIZATION_SHIFT_PER_INT;
|
1894
|
-
int bit = j & COINFACTORIZATION_MASK_PER_INT;
|
1895
|
-
|
1896
|
-
temp2[word] = temp2[word] | ( 1 << bit ); //say already in counts
|
1897
|
-
}
|
1898
|
-
}
|
1899
|
-
}
|
1900
|
-
numberInColumn[iColumn] = put - startColumnThis;
|
1901
|
-
//move largest
|
1902
|
-
if ( positionLargest >= 0 ) {
|
1903
|
-
value = element[positionLargest];
|
1904
|
-
iRow = indexRow[positionLargest];
|
1905
|
-
element[positionLargest] = element[startColumnThis];
|
1906
|
-
indexRow[positionLargest] = indexRow[startColumnThis];
|
1907
|
-
element[startColumnThis] = value;
|
1908
|
-
indexRow[startColumnThis] = iRow;
|
1909
|
-
}
|
1910
|
-
//linked list for column
|
1911
|
-
if ( nextCount[iColumn + numberRows_] != -2 ) {
|
1912
|
-
//modify linked list
|
1913
|
-
deleteLink ( iColumn + numberRows_ );
|
1914
|
-
addLink ( iColumn + numberRows_, numberInColumn[iColumn] );
|
1915
|
-
}
|
1916
|
-
temp2 += increment2;
|
1917
|
-
}
|
1918
|
-
//get space for row list
|
1919
|
-
unsigned int *putBase = workArea2;
|
1920
|
-
int bigLoops = numberDoColumn >> COINFACTORIZATION_SHIFT_PER_INT;
|
1921
|
-
int i = 0;
|
1922
|
-
|
1923
|
-
// do linked lists and update counts
|
1924
|
-
while ( bigLoops ) {
|
1925
|
-
bigLoops--;
|
1926
|
-
int bit;
|
1927
|
-
for ( bit = 0; bit < COINFACTORIZATION_BITS_PER_INT; i++, bit++ ) {
|
1928
|
-
unsigned int *putThis = putBase;
|
1929
|
-
int iRow = indexL[i];
|
1930
|
-
|
1931
|
-
//get space
|
1932
|
-
int number = 0;
|
1933
|
-
int jColumn;
|
1934
|
-
|
1935
|
-
for ( jColumn = 0; jColumn < numberDoRow; jColumn++ ) {
|
1936
|
-
unsigned int test = *putThis;
|
1937
|
-
|
1938
|
-
putThis += increment2;
|
1939
|
-
test = 1 - ( ( test >> bit ) & 1 );
|
1940
|
-
number += test;
|
1941
|
-
}
|
1942
|
-
int next = nextRow[iRow];
|
1943
|
-
CoinBigIndex space;
|
1944
|
-
|
1945
|
-
space = startRow[next] - startRow[iRow];
|
1946
|
-
number += numberInRow[iRow];
|
1947
|
-
if ( space < number ) {
|
1948
|
-
if ( !getRowSpace ( iRow, number ) ) {
|
1949
|
-
goto BAD_PIVOT;
|
1950
|
-
}
|
1951
|
-
}
|
1952
|
-
// now do
|
1953
|
-
putThis = putBase;
|
1954
|
-
next = nextRow[iRow];
|
1955
|
-
number = numberInRow[iRow];
|
1956
|
-
CoinBigIndex end = startRow[iRow] + number;
|
1957
|
-
int saveIndex = indexColumn[startRow[next]];
|
1958
|
-
|
1959
|
-
//add in
|
1960
|
-
for ( jColumn = 0; jColumn < numberDoRow; jColumn++ ) {
|
1961
|
-
unsigned int test = *putThis;
|
1962
|
-
|
1963
|
-
putThis += increment2;
|
1964
|
-
test = 1 - ( ( test >> bit ) & 1 );
|
1965
|
-
indexColumn[end] = saveColumn[jColumn];
|
1966
|
-
end += test;
|
1967
|
-
}
|
1968
|
-
//put back next one in case zapped
|
1969
|
-
indexColumn[startRow[next]] = saveIndex;
|
1970
|
-
markRow[iRow] = FAC_UNSET;
|
1971
|
-
number = end - startRow[iRow];
|
1972
|
-
numberInRow[iRow] = number;
|
1973
|
-
deleteLink ( iRow );
|
1974
|
-
addLink ( iRow, number );
|
1975
|
-
}
|
1976
|
-
putBase++;
|
1977
|
-
} /* endwhile */
|
1978
|
-
int bit;
|
1979
|
-
|
1980
|
-
for ( bit = 0; i < numberDoColumn; i++, bit++ ) {
|
1981
|
-
unsigned int *putThis = putBase;
|
1982
|
-
int iRow = indexL[i];
|
1983
|
-
|
1984
|
-
//get space
|
1985
|
-
int number = 0;
|
1986
|
-
int jColumn;
|
1987
|
-
|
1988
|
-
for ( jColumn = 0; jColumn < numberDoRow; jColumn++ ) {
|
1989
|
-
unsigned int test = *putThis;
|
1990
|
-
|
1991
|
-
putThis += increment2;
|
1992
|
-
test = 1 - ( ( test >> bit ) & 1 );
|
1993
|
-
number += test;
|
1994
|
-
}
|
1995
|
-
int next = nextRow[iRow];
|
1996
|
-
CoinBigIndex space;
|
1997
|
-
|
1998
|
-
space = startRow[next] - startRow[iRow];
|
1999
|
-
number += numberInRow[iRow];
|
2000
|
-
if ( space < number ) {
|
2001
|
-
if ( !getRowSpace ( iRow, number ) ) {
|
2002
|
-
goto BAD_PIVOT;
|
2003
|
-
}
|
2004
|
-
}
|
2005
|
-
// now do
|
2006
|
-
putThis = putBase;
|
2007
|
-
next = nextRow[iRow];
|
2008
|
-
number = numberInRow[iRow];
|
2009
|
-
CoinBigIndex end = startRow[iRow] + number;
|
2010
|
-
int saveIndex;
|
2011
|
-
|
2012
|
-
saveIndex = indexColumn[startRow[next]];
|
2013
|
-
|
2014
|
-
//add in
|
2015
|
-
for ( jColumn = 0; jColumn < numberDoRow; jColumn++ ) {
|
2016
|
-
unsigned int test = *putThis;
|
2017
|
-
|
2018
|
-
putThis += increment2;
|
2019
|
-
test = 1 - ( ( test >> bit ) & 1 );
|
2020
|
-
|
2021
|
-
indexColumn[end] = saveColumn[jColumn];
|
2022
|
-
end += test;
|
2023
|
-
}
|
2024
|
-
indexColumn[startRow[next]] = saveIndex;
|
2025
|
-
markRow[iRow] = FAC_UNSET;
|
2026
|
-
number = end - startRow[iRow];
|
2027
|
-
numberInRow[iRow] = number;
|
2028
|
-
deleteLink ( iRow );
|
2029
|
-
addLink ( iRow, number );
|
2030
|
-
}
|
2031
|
-
markRow[iPivotRow] = FAC_UNSET;
|
2032
|
-
//modify linked list for pivots
|
2033
|
-
deleteLink ( iPivotRow );
|
2034
|
-
deleteLink ( iPivotColumn + numberRows_ );
|
2035
|
-
totalElements_ += added;
|
2036
|
-
goodPivot= true;
|
2037
|
-
// **** UGLY UGLY UGLY
|
2038
|
-
}
|
2039
|
-
BAD_PIVOT:
|
2040
|
-
|
2041
|
-
;
|
2042
|
-
}
|
2043
|
-
#undef FAC_UNSET
|
2044
|
-
#endif
|