- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

AbcSimplexDual.hpp
Go to the documentation of this file.
1 /* $Id: AbcSimplexDual.hpp 1910 2013-01-27 02:00:13Z stefan $ */
2 // Copyright (C) 2002, International Business Machines
3 // Corporation and others, Copyright (C) 2012, FasterCoin. All Rights Reserved.
4 // This code is licensed under the terms of the Eclipse Public License (EPL).
5 /*
6 Authors
7
8 John Forrest
9
10 */
11 #ifndef AbcSimplexDual_H
12 #define AbcSimplexDual_H
13
14 #include "AbcSimplex.hpp"
15 #if 0
16 #undef ABC_PARALLEL
17 #define ABC_PARALLEL 2
18 #undef cilk_for
19 #undef cilk_spawn
20 #undef cilk_sync
21 #include <cilk/cilk.h>
22 #endif
23 typedef struct {
24 double theta;
25 double totalThru;
26 double useThru;
27 double bestEverPivot;
28 double increaseInObjective;
29 double tentativeTheta;
30 double lastPivotValue;
31 double thisPivotValue;
32 double thruThis;
33 double increaseInThis;
34 int lastSequence;
35 int sequence;
36 int block;
37 int numberSwapped;
38 int numberRemaining;
39 int numberLastSwapped;
40 bool modifyCosts;
41 } dualColumnResult;
49 class AbcSimplexDual : public AbcSimplex {
50
51 public:
52
144 int dual();
153 int strongBranching(int numberVariables, const int * variables,
154 double * newLower, double * newUpper,
155 double ** outputSolution,
156 int * outputStatus, int * outputIterations,
157 bool stopOnFirstInfeasible = true,
158 bool alwaysFinish = false,
159 int startFinishOptions = 0);
161 AbcSimplexFactorization * setupForStrongBranching(char * arrays, int numberRows,
162 int numberColumns, bool solveLp = false);
164 void cleanupAfterStrongBranching(AbcSimplexFactorization * factorization);
166
182 int whileIteratingSerial();
183 #if ABC_PARALLEL==1
184 int whileIteratingThread();
185 #endif
186 #if ABC_PARALLEL==2
187 int whileIteratingCilk();
188 #endif
189 void whileIterating2();
190 int whileIteratingParallel(int numberIterations);
191 int whileIterating3();
192 void updatePrimalSolution();
193 int noPivotRow();
194 int noPivotColumn();
195 void dualPivotColumn();
197 void createDualPricingVectorSerial();
198 int getTableauColumnFlipAndStartReplaceSerial();
199 void getTableauColumnPart1Serial();
200 #if ABC_PARALLEL==1
201 void createDualPricingVectorThread();
203 int getTableauColumnFlipAndStartReplaceThread();
204 void getTableauColumnPart1Thread();
205 #endif
206 #if ABC_PARALLEL==2
207 void createDualPricingVectorCilk();
209 int getTableauColumnFlipAndStartReplaceCilk();
210 void getTableauColumnPart1Cilk();
211 #endif
212 void getTableauColumnPart2();
213 int checkReplace();
214 void replaceColumnPart3();
215 void checkReplacePart1();
216 void checkReplacePart1a();
217 void checkReplacePart1b();
219 void updateDualsInDual();
223 //void updateDualsInValuesPass(CoinIndexedVector * array,
224 // double theta);
229 int flipBounds();
232 void flipBack(int number);
239 void dualColumn1(bool doAll=false);
245 double dualColumn1A();
247 double dualColumn1B();
253 void dualColumn2();
254 void dualColumn2Most(dualColumnResult & result);
255 void dualColumn2First(dualColumnResult & result);
261 void dualColumn2(dualColumnResult & result);
266 void checkPossibleCleanup(CoinIndexedVector * array);
273 void dualPivotRow();
281 int changeBounds(int initialize, double & changeCost);
284 bool changeBound( int iSequence);
286 void originalBound(int iSequence);
289 int checkUnbounded(CoinIndexedVector & ray, double changeCost);
299 void statusOfProblemInDual(int type);
305 int whatNext();
309 bool checkCutoff(bool computeObjective);
311 int bounceTolerances(int type);
313 void perturb(double factor);
315 void perturbB(double factor,int type);
317 int makeNonFreeVariablesDualFeasible(bool changeCosts=false);
318 int fastDual(bool alwaysFinish = false);
321 int numberAtFakeBound();
322
327 int pivotResultPart1();
329 int nextSuperBasic();
331 void startupSolve();
333 void finishSolve();
334 void gutsOfDual();
335 //int dual2(int ifValuesPass,int startFinishOptions=0);
336 int resetFakeBounds(int type);
337
339 };
340 #if ABC_PARALLEL==1
341 void * abc_parallelManager(void * simplex);
342 #endif
343 #endif
AbcSimplexDual::dualColumn2
void dualColumn2()
Chooses incoming Puts flipped ones in list If necessary will modify costs.
AbcSimplexDual::perturb
void perturb(double factor)
Perturbs problem.
AbcSimplex
Definition: AbcSimplex.hpp:62
AbcSimplexDual::resetFakeBounds
int resetFakeBounds(int type)
This has the flow between re-factorizations Broken out for clarity and will be used by strong branchi...
dualColumnResult::theta
double theta
Definition: AbcSimplexDual.hpp:24
AbcSimplexDual::dualColumn1B
double dualColumn1B()
Do all given tableau row.
AbcSimplex.hpp
ClpModel::numberIterations
int numberIterations() const
Number of iterations.
Definition: ClpModel.hpp:363
AbcSimplex::computeObjective
void computeObjective()
Computes nonbasic cost and total cost.
AbcSimplexDual::startupSolve
void startupSolve()
Startup part of dual.
dualColumnResult::lastPivotValue
double lastPivotValue
Definition: AbcSimplexDual.hpp:30
dualColumnResult::increaseInObjective
double increaseInObjective
Definition: AbcSimplexDual.hpp:28
dualColumnResult::modifyCosts
bool modifyCosts
Definition: AbcSimplexDual.hpp:40
AbcSimplexDual::bounceTolerances
int bounceTolerances(int type)
Does something about fake tolerances.
dualColumnResult::bestEverPivot
double bestEverPivot
Definition: AbcSimplexDual.hpp:27
dualColumnResult::thruThis
double thruThis
Definition: AbcSimplexDual.hpp:32
AbcSimplexDual::pivotResultPart1
int pivotResultPart1()
Pivot in a variable and choose an outgoing one.
AbcSimplexDual::whileIterating3
int whileIterating3()
This has the flow between re-factorizations Broken out for clarity and will be used by strong branchi...
AbcSimplexDual::noPivotColumn
int noPivotColumn()
This has the flow between re-factorizations Broken out for clarity and will be used by strong branchi...
AbcSimplexDual::dualPivotColumn
void dualPivotColumn()
This has the flow between re-factorizations Broken out for clarity and will be used by strong branchi...
AbcSimplexDual::perturbB
void perturbB(double factor, int type)
Perturbs problem B.
dualColumnResult::useThru
double useThru
Definition: AbcSimplexDual.hpp:26
dualColumnResult::lastSequence
int lastSequence
Definition: AbcSimplexDual.hpp:34
dualColumnResult::tentativeTheta
double tentativeTheta
Definition: AbcSimplexDual.hpp:29
AbcSimplexDual::whileIterating2
void whileIterating2()
This has the flow between re-factorizations Broken out for clarity and will be used by strong branchi...
AbcSimplexDual::finishSolve
void finishSolve()
Ending part of dual.
AbcSimplexDual::originalBound
void originalBound(int iSequence)
Restores bound to original bound.
dualColumnResult::block
int block
Definition: AbcSimplexDual.hpp:36
AbcSimplexDual::flipBack
void flipBack(int number)
Undo a flip.
AbcSimplexDual::updateDualsInDual
void updateDualsInDual()
The duals are updated.
AbcSimplexDual::changeBounds
int changeBounds(int initialize, double &changeCost)
Checks if any fake bounds active - if so returns number and modifies updatedDualBound_ and everything...
ClpModel::numberRows
int numberRows() const
Number of rows.
Definition: ClpModel.hpp:315
AbcSimplexDual::getTableauColumnPart1Serial
void getTableauColumnPart1Serial()
This has the flow between re-factorizations Broken out for clarity and will be used by strong branchi...
AbcSimplexDual::checkUnbounded
int checkUnbounded(CoinIndexedVector &ray, double changeCost)
Checks if tentative optimal actually means unbounded in dual Returns -3 if not, 2 if is unbounded...
AbcSimplexDual::dualPivotRow
void dualPivotRow()
Chooses dual pivot row Would be faster with separate region to scan and will have this (with square o...
dualColumnResult::numberLastSwapped
int numberLastSwapped
Definition: AbcSimplexDual.hpp:39
AbcSimplexDual::whileIteratingSerial
int whileIteratingSerial()
This has the flow between re-factorizations Broken out for clarity and will be used by strong branchi...
AbcSimplexDual::noPivotRow
int noPivotRow()
This has the flow between re-factorizations Broken out for clarity and will be used by strong branchi...
AbcSimplexDual::checkReplacePart1b
void checkReplacePart1b()
This has the flow between re-factorizations Broken out for clarity and will be used by strong branchi...
AbcSimplexDual::numberAtFakeBound
int numberAtFakeBound()
Checks number of variables at fake bounds.
AbcSimplexDual::fastDual
int fastDual(bool alwaysFinish=false)
This has the flow between re-factorizations Broken out for clarity and will be used by strong branchi...
dualColumnResult::totalThru
double totalThru
Definition: AbcSimplexDual.hpp:25
AbcSimplexDual::whatNext
int whatNext()
Fast iterations.
AbcSimplexDual::updatePrimalSolution
void updatePrimalSolution()
This has the flow between re-factorizations Broken out for clarity and will be used by strong branchi...
AbcSimplexDual
This solves LPs using the dual simplex method.
Definition: AbcSimplexDual.hpp:49
AbcSimplexDual::checkReplacePart1
void checkReplacePart1()
This has the flow between re-factorizations Broken out for clarity and will be used by strong branchi...
dualColumnResult::sequence
int sequence
Definition: AbcSimplexDual.hpp:35
ClpModel::numberColumns
int numberColumns() const
Number of rows.
Definition: ClpModel.hpp:325
AbcSimplexDual::changeBound
bool changeBound(int iSequence)
As changeBounds but just changes new bounds for a single variable.
AbcSimplexDual::replaceColumnPart3
void replaceColumnPart3()
This has the flow between re-factorizations Broken out for clarity and will be used by strong branchi...
dualColumnResult::increaseInThis
double increaseInThis
Definition: AbcSimplexDual.hpp:33
AbcSimplexDual::nextSuperBasic
int nextSuperBasic()
Get next free , -1 if none.
AbcSimplexDual::checkReplace
int checkReplace()
This has the flow between re-factorizations Broken out for clarity and will be used by strong branchi...
CoinIndexedVector
Indexed Vector.
Definition: CoinIndexedVector.hpp:104
AbcSimplexDual::setupForStrongBranching
AbcSimplexFactorization * setupForStrongBranching(char *arrays, int numberRows, int numberColumns, bool solveLp=false)
This does first part of StrongBranching.
AbcSimplexDual::getTableauColumnFlipAndStartReplaceSerial
int getTableauColumnFlipAndStartReplaceSerial()
This has the flow between re-factorizations Broken out for clarity and will be used by strong branchi...
AbcSimplexDual::makeNonFreeVariablesDualFeasible
int makeNonFreeVariablesDualFeasible(bool changeCosts=false)
Make non free variables dual feasible by moving to a bound.
dualColumnResult::thisPivotValue
double thisPivotValue
Definition: AbcSimplexDual.hpp:31
AbcSimplexDual::checkCutoff
bool checkCutoff(bool computeObjective)
see if cutoff reached
AbcSimplexDual::dualColumn2Most
void dualColumn2Most(dualColumnResult &result)
This has the flow between re-factorizations Broken out for clarity and will be used by strong branchi...
AbcSimplexDual::strongBranching
int strongBranching(int numberVariables, const int *variables, double *newLower, double *newUpper, double **outputSolution, int *outputStatus, int *outputIterations, bool stopOnFirstInfeasible=true, bool alwaysFinish=false, int startFinishOptions=0)
For strong branching.
AbcSimplexDual::gutsOfDual
void gutsOfDual()
This has the flow between re-factorizations Broken out for clarity and will be used by strong branchi...
AbcSimplexDual::dualColumn1A
double dualColumn1A()
Array has tableau row (row section) Just does slack part Returns guess at upper theta (infinite if no...
AbcSimplexFactorization
This just implements AbcFactorization when an AbcMatrix object is passed.
Definition: AbcSimplexFactorization.hpp:27
AbcSimplexDual::whileIteratingParallel
int whileIteratingParallel(int numberIterations)
This has the flow between re-factorizations Broken out for clarity and will be used by strong branchi...
AbcSimplexDual::dualColumn1
void dualColumn1(bool doAll=false)
Array has tableau row (row section) Puts candidates for rows in list Returns guess at upper theta (in...
AbcSimplexDual::getTableauColumnPart2
void getTableauColumnPart2()
This has the flow between re-factorizations Broken out for clarity and will be used by strong branchi...
AbcSimplexDual::checkReplacePart1a
void checkReplacePart1a()
This has the flow between re-factorizations Broken out for clarity and will be used by strong branchi...
AbcSimplex::factorization
AbcSimplexFactorization * factorization() const
factorization
Definition: AbcSimplex.hpp:199
dualColumnResult
Definition: AbcSimplexDual.hpp:23
AbcSimplexDual::flipBounds
int flipBounds()
The duals are updated by the given arrays.
AbcSimplexDual::createDualPricingVectorSerial
void createDualPricingVectorSerial()
Create dual pricing vector.
AbcSimplexDual::checkPossibleCleanup
void checkPossibleCleanup(CoinIndexedVector *array)
This sees what is best thing to do in branch and bound cleanup If sequenceIn_ &lt; 0 then can&#39;t do anythi...
dualColumnResult::numberSwapped
int numberSwapped
Definition: AbcSimplexDual.hpp:37
AbcSimplexDual::cleanupAfterStrongBranching
void cleanupAfterStrongBranching(AbcSimplexFactorization *factorization)
This cleans up after strong branching.
AbcSimplexDual::dualColumn2First
void dualColumn2First(dualColumnResult &result)
This has the flow between re-factorizations Broken out for clarity and will be used by strong branchi...
AbcSimplexDual::dual
int dual()
Dual algorithm.
dualColumnResult::numberRemaining
int numberRemaining
Definition: AbcSimplexDual.hpp:38
AbcSimplexDual::statusOfProblemInDual
void statusOfProblemInDual(int type)
Refactorizes if necessary Checks if finished.
ClpModel::ray
double * ray() const
For advanced users - no need to delete - sign not changed.
Definition: ClpModel.hpp:772