38 #ifndef CLP_INHERIT_MODE
39 #define CLP_INHERIT_MODE 1
41 #ifndef ABC_CLP_DEFAULTS
42 #define ABC_CLP_DEFAULTS 0
45 #undef ABC_CLP_DEFAULTS
46 #define ABC_CLP_DEFAULTS 1
57 #include <cilk/cilk.h>
67 #define LONG_REGION_2 1
69 #define SHORT_REGION 1
75 #define SHORT_REGION 1
77 #define SHORT_REGION 2
82 #define SHORT_REGION 2
85 #define LONG_REGION_2 1
86 #define SHORT_REGION 1
154 bool dropNames =
true,
bool dropIntegers =
true,
155 bool fixOthers =
false);
165 bool dropNames =
true,
bool dropIntegers =
true,
166 bool fixOthers =
false);
180 inline void setAbcState(
int state)
188 inline void setAbcSimplex(
AbcSimplex *simplex)
190 abcSimplex_ = simplex;
195 int doAbcPrimal(
int ifValuesPass);
233 const double *collb,
const double *colub,
235 const double *rowlb,
const double *rowub,
238 const double *collb,
const double *colub,
240 const double *rowlb,
const double *rowub,
245 void loadProblem(
const int numcols,
const int numrows,
248 const double *collb,
const double *colub,
250 const double *rowlb,
const double *rowub,
253 void loadProblem(
const int numcols,
const int numrows,
255 const double *value,
const int *length,
256 const double *collb,
const double *colub,
258 const double *rowlb,
const double *rowub,
266 int readMps(
const char *filename,
267 bool keepNames =
false,
268 bool ignoreErrors =
false);
270 int readGMPL(
const char *filename,
const char *dataName,
271 bool keepNames =
false);
274 int readLp(
const char *filename,
const double epsilon = 1e-5);
279 void writeLp(
const char *filename,
280 const char *extension =
"lp",
281 double epsilon = 1e-5,
282 int numberAcross = 10,
284 double objSense = 0.0,
285 bool useRowNames =
true)
const;
340 int dual(
int ifValuesPass = 0,
int startFinishOptions = 0);
342 int dualDebug(
int ifValuesPass = 0,
int startFinishOptions = 0);
353 int primal(
int ifValuesPass = 0,
int startFinishOptions = 0);
359 int nonlinearSLP(
int numberPasses,
double deltaTolerance);
366 int numberPasses,
double deltaTolerance);
369 int barrier(
bool crossover =
true);
391 bool originalOrder =
true,
bool keepSolution =
false);
406 int cleanup(
int cleanupScaling);
439 double *costIncrease,
int *sequenceIncrease,
440 double *costDecrease,
int *sequenceDecrease,
441 double *valueIncrease = NULL,
double *valueDecrease = NULL);
457 double *valueIncrease,
int *sequenceIncrease,
458 double *valueDecrease,
int *sequenceDecrease);
472 const double *newCoefficient,
473 const unsigned char *newStatus = NULL,
474 const double *newLower = NULL,
475 const double *newUpper = NULL,
476 const double *newObjective = NULL);
484 int outDuplicateRows(
int numberLook,
int *whichRows,
bool noOverlaps =
false,
double tolerance = -1.0,
485 double cleanUp = 0.0);
524 bool writeValues =
false,
525 int formatType = 0)
const;
583 double *newLower,
double *newUpper,
584 double **outputSolution,
585 int *outputStatus,
int *outputIterations,
586 bool stopOnFirstInfeasible =
true,
587 bool alwaysFinish =
false,
588 int startFinishOptions = 0);
652 int startup(
int ifValuesPass,
int startFinishOptions = 0);
653 void finish(
int startFinishOptions = 0);
833 const double *columnActivities);
845 const double *
lower,
const double *gradient);
884 const double *columnActivities);
886 void add(
double *array,
887 int column,
double multiplier)
const;
914 #ifndef CLP_USER_DRIVEN
925 const double *columnActivies = NULL);
953 double allowedInfeasibility);
1092 #ifndef CLP_USER_DRIVEN
1101 const double *givenPrimals,
1102 bool valuesPass =
false);
1118 bool createRim(
int what,
bool makeRowCopy =
false,
int startFinishOptions = 0);
1129 void deleteRim(
int getRidOfFactorizationData = 2);
1200 unsigned char &st_byte =
status_[sequence];
1201 st_byte =
static_cast< unsigned char >(st_byte & ~7);
1202 st_byte =
static_cast< unsigned char >(st_byte | newstatus);
1315 return dj_[sequence];
1319 return dj_[sequence];
1341 return cost_[sequence];
1346 return cost_[sequence];
1472 unsigned char &st_byte =
status_[sequence];
1473 st_byte =
static_cast< unsigned char >(st_byte & ~24);
1474 st_byte =
static_cast< unsigned char >(st_byte | (fakeBound << 3));
1483 st_byte =
static_cast< unsigned char >(st_byte & ~7);
1484 st_byte =
static_cast< unsigned char >(st_byte | newstatus);
1492 unsigned char &st_byte =
status_[sequence];
1493 st_byte =
static_cast< unsigned char >(st_byte & ~7);
1494 st_byte =
static_cast< unsigned char >(st_byte | newstatus);
1502 status_[sequence] =
static_cast< unsigned char >(
status_[sequence] | 32);
1506 status_[sequence] =
static_cast< unsigned char >(
status_[sequence] & ~32);
1510 return (((
status_[sequence] >> 5) & 1) != 0);
1516 status_[sequence] =
static_cast< unsigned char >(
status_[sequence] & ~64);
1520 return ((
status_[sequence] & 64) != 0);
1525 status_[iRow] =
static_cast< unsigned char >(
status_[iRow] | 128);
1529 status_[iRow] =
static_cast< unsigned char >(
status_[iRow] & ~128);
1533 return ((
status_[iRow] & 128) != 0);
1538 status_[iSequence] =
static_cast< unsigned char >(
status_[iSequence] | 128);
1542 status_[iSequence] =
static_cast< unsigned char >(
status_[iSequence] & ~128);
1546 return ((
status_[iSequence] & 128) != 0);
1616 void generateCpp(FILE *fp,
bool defaultFactor =
false);
1630 void getBInvARow(
int row,
double *z,
double *slack = NULL);
1680 const int *indexLast,
1681 const double *boundList);
1698 double newlower,
double newupper)
1710 const int *indexLast,
1711 const double *boundList)
1718 void setRowLower(
int elementIndex,
double elementValue);
1722 void setRowUpper(
int elementIndex,
double elementValue);
1735 const int *indexLast,
1736 const double *boundList);
1738 void resize(
int newNumberRows,
int newNumberColumns);
1818 #define CLP_INFEAS_SAVE 5
1955 #define CLP_ABC_WANTED 1
1956 #define CLP_ABC_WANTED_PARALLEL 2
1957 #define CLP_ABC_FULL_DONE 8
1960 #define CLP_ABC_BEEN_FEASIBLE 65536
1989 #define DEVEX_TRY_NORM 1.0e-4
1990 #define DEVEX_ADD_ONE 1.0
1991 #if defined(ABC_INHERIT) || defined(CBC_THREAD) || defined(THREADS_IN_ANALYZE)
1993 #include <pthread.h>
2003 class CoinPthreadStuff {
2009 CoinPthreadStuff(
int numberThreads = 0,
2010 void *parallelManager(
void *stuff) = NULL);
2012 CoinPthreadStuff &operator=(
const CoinPthreadStuff &rhs);
2014 ~CoinPthreadStuff();
2016 inline void setStopStart(
int value)
2020 #ifndef NUMBER_THREADS
2021 #define NUMBER_THREADS 8
2024 inline pthread_mutex_t *mutexPointer(
int which,
int thread = 0)
2026 return mutex_ + which + 3 * thread;
2028 #ifdef PTHREAD_BARRIER_SERIAL_THREAD
2029 inline pthread_barrier_t *barrierPointer()
2034 inline int whichLocked(
int thread = 0)
const
2036 return locked_[thread];
2038 inline CoinThreadInfo *threadInfoPointer(
int thread = 0)
2040 return threadInfo_ + thread;
2042 void startParallelTask(
int type,
int iThread,
void *info = NULL);
2043 int waitParallelTask(
int type,
int &iThread,
bool allowIdle);
2044 void waitAllTasks();
2046 int whichThread()
const;
2047 void sayIdle(
int iThread);
2052 #ifdef PTHREAD_BARRIER_SERIAL_THREAD
2053 pthread_barrier_t barrier_;
2061 void *clp_parallelManager(
void *stuff);
2096 void moveAndZero(
clpTempInfo *info,
int type,
void *extra);
2098 #ifdef ABCSTATE_LITE
2099 #if ABCSTATE_LITE == 2
2102 extern int abcState_;
2108 inline void setAbcState(
int state)
2117 #ifdef CLP_USER_DRIVEN
void setLargestPrimalError(double value)
Largest error on Ax-b.
void stopFastDual2(ClpNodeStuff *stuff)
Stops Fast dual2.
ClpFactorization * factorization_
factorization
int housekeeping(double objectiveChange)
This does basis housekeeping and does values for in/out variables.
void setAlphaAccuracy(double value)
If problem is primal feasible.
double * costRegion() const
Return row or column sections - not as much needed as it once was.
double rawObjectiveValue() const
Raw objective value (so always minimize in primal)
int gutsOfSolution(double *givenDuals, const double *givenPrimals, bool valuesPass=false)
May change basis and then returns number changed.
int fathom(void *stuff)
Fathom - 1 if solution.
int vectorMode_
Vector mode - try and use vector instructions.
int numberExtraRows_
Number of extra rows.
double valueIn() const
Value of In variable.
double lowerIn() const
Lower Bound on In variable.
double * perturbationArray_
Perturbation array (maximumPerturbationSize_)
void setAlpha(double value)
If problem is primal feasible.
double & reducedCostAddress(int sequence)
Return row or column sections - not as much needed as it once was.
bool pivoted(int sequence) const
To flag a variable (not inline to allow for column generation)
void createStatus()
Set up status array (can be used by OsiClp).
This is a simple minded model which is stored in a format which makes it easier to construct and modi...
double largestPrimalError() const
Largest error on Ax-b.
int readGMPL(const char *filename, const char *dataName, bool keepNames=false)
Read GMPL files from the given filenames.
double * savedSolution_
Saved version of solution.
double *COIN_RESTRICT spare
void setColumnSetBounds(const int *indexFirst, const int *indexLast, const double *boundList)
Set the bounds on a number of columns simultaneously The default implementation just invokes setColL...
const double *COIN_RESTRICT element
double * columnLowerWork_
Column lower bounds - working copy.
int baseIteration_
Iteration when we entered dual or primal.
ClpDataSave saveData()
Save data.
void setDualRowPivotAlgorithm(ClpDualRowPivot &choice)
Sets row pivot choice algorithm in dual.
double largestPrimalError_
Largest error on Ax-b.
int lastBadIteration() const
So we know when to be cautious.
void setFactorizationFrequency(int value)
If problem is primal feasible.
int writeBasis(const char *filename, bool writeValues=false, int formatType=0) const
Write the basis in MPS format to the specified file.
void clearActive(int iRow)
To flag a variable (not inline to allow for column generation)
double originalLower(int iSequence) const
Return original lower bound.
double currentDualTolerance() const
Current dual tolerance.
int changeMade_
If change has been made (first attempt at stopping looping)
This is a very simple class to guide algorithms.
Dual Row Pivot Abstract Base Class.
int solveBenders(CoinStructuredModel *model, ClpSolve &options)
Solve using Benders decomposition and maybe in parallel.
double allowedInfeasibility_
Best possible improvement using djs (primal) or obj change by flipping bounds to make dual feasible (...
double incomingInfeasibility_
For advanced use.
double dualOut_
Infeasibility (dual) or ? (primal) of Out variable.
void setColUpper(int elementIndex, double elementValue)
Set a single column upper bound Use DBL_MAX for infinity.
double zeroTolerance_
Zero tolerance.
void setPrimalColumnPivotAlgorithm(ClpPrimalColumnPivot &choice)
Sets column pivot choice algorithm in primal.
double scaleObjective(double value)
If input negative scales objective so maximum <= -value and returns scale factor used.
double largestDualError() const
Largest error on basic duals.
void add(double *array, int column, double multiplier) const
Adds multiple of a column into an array.
This is a tiny class where data can be saved round calls.
void setLowerOut(double value)
Set lower of out variable.
int numberColumns_
Number of columns.
double averageInfeasibility_[CLP_INFEAS_SAVE]
Best possible improvement using djs (primal) or obj change by flipping bounds to make dual feasible (...
double * rowUpper_
Row upper.
void setNonLinearCost(ClpNonLinearCost &nonLinearCost)
Set pointer to details of costs.
bool sanityCheck()
Sanity check on input rim data (after scaling) - returns true if okay.
bool startPermanentArrays()
Start or reset using maximumRows_ and Columns_ - true if change.
void unmarkHotStart(void *saveStuff)
Delete the snapshot.
int rowPrimalSequence_
Sequence of worst (-1 if feasible)
double sumPrimalInfeasibilities() const
Sum of primal infeasibilities.
int pivot()
Pivot in a variable and out a variable.
double moveTowardsPrimalFeasible()
Try simple crash like techniques to get closer to primal feasibility returns final sum of infeasibili...
double * cost_
Working copy of objective (Owner of arrays below)
void setColumnUpper(int elementIndex, double elementValue)
Set a single column upper bound Use DBL_MAX for infinity.
void setRowStatus(int sequence, Status newstatus)
To flag a variable (not inline to allow for column generation)
void restoreData(ClpDataSave saved)
Restore data.
double * djRegion(int section) const
Return row or column sections - not as much needed as it once was.
ClpNonLinearCost * nonLinearCost() const
Return pointer to details of costs.
int numberPrimalInfeasibilities_
Number of primal infeasibilities.
void setSumDualInfeasibilities(double value)
If problem is primal feasible.
void setSumOfRelaxedDualInfeasibilities(double value)
If problem is primal feasible.
int forceFactorization_
Now for some reliability aids This forces re-factorization early.
void setSparseFactorization(bool value)
If problem is primal feasible.
double & upperAddress(int sequence)
Return address of row or column upper bound.
int moreSpecialOptions_
More special options - see set for details.
void setNumberRefinements(int value)
If problem is primal feasible.
void miniPostsolve(const ClpSimplex *presolvedModel, void *info)
After mini presolve.
double zeroTolerance() const
Get zero tolerance.
int solveType() const
Solve type - 1 simplex, 2 simplex interface, 3 Interior.
Constraint Abstract Base Class.
void setSequenceOut(int sequence)
Return row or column sections - not as much needed as it once was.
int maximumBasic() const
Maximum number of basic variables - can be more than number of rows if GUB.
void solveFromHotStart(void *saveStuff)
Optimize starting from the hotstart.
double valueOut_
Value of Out variable.
void setPersistenceFlag(int value)
Array persistence flag If 0 then as now (delete/new) 1 then only do arrays if bigger needed 2 as 1 bu...
void setObjCoeff(int elementIndex, double elementValue)
Set an objective function coefficient.
void setVectorMode(int value)
Set vector mode.
CoinWarmStartBasis * getBasis() const
Returns a basis (to be deleted by user)
double upperIn() const
Upper Bound on In variable.
int numberInfeasibilities
void loadProblem(const ClpMatrixBase &matrix, const double *collb, const double *colub, const double *obj, const double *rowlb, const double *rowub, const double *rowObjective=NULL)
Loads a problem (the constraints on the rows are given by lower and upper bounds).
CoinPackedMatrix * matrix() const
Matrix (if not ClpPackedmatrix be careful about memory leak.
FakeBound getFakeBound(int sequence) const
To flag a variable (not inline to allow for column generation)
const double *COIN_RESTRICT lower
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.
int readBasis(const char *filename)
Read a basis from the given filename, returns -1 on file error, 0 if no values, 1 if values...
ClpSimplex * fastCrunch(ClpNodeStuff *stuff, int mode)
Deals with crunch aspects mode 0 - in 1 - out with solution 2 - out without solution returns small mo...
void createRim4(bool initial)
Does objective.
unsigned char * status_
Status (i.e.
double * rowReducedCost_
Reduced costs of slacks not same as duals (or - duals)
double & solutionAddress(int sequence)
Return address of row or column values.
void gutsOfCopy(const ClpSimplex &rhs)
Does most of copying.
void copyEnabledStuff(const ClpSimplex *rhs)
Copy across enabled stuff from one solver to another.
double lowerIn_
Lower Bound on In variable.
double minimumPrimalTolerance_
Minimum primal tolerance.
bool active(int iRow) const
To flag a variable (not inline to allow for column generation)
CoinIndexedVector * columnArray_[6]
Useful column length arrays.
void getBasics(int *index)
Get basic indices (order of indices corresponds to the order of elements in a vector retured by getBI...
ClpNonLinearCost * nonLinearCost_
Very wasteful way of dealing with infeasibilities in primal.
double solution(int sequence)
Return row or column values.
int dualDebug(int ifValuesPass=0, int startFinishOptions=0)
General solve algorithm which can do presolve.
void defaultFactorizationFrequency()
If user left factorization frequency then compute.
ClpSimplex & operator=(const ClpSimplex &rhs)
Assignment operator. This copies the data.
void setCurrentPrimalTolerance(double value)
If problem is primal feasible.
double sumDualInfeasibilities_
Sum of dual infeasibilities.
bool flagged(int sequence) const
To flag a variable (not inline to allow for column generation)
int primal(int ifValuesPass=0, int startFinishOptions=0)
Primal algorithm - see ClpSimplexPrimal.hpp for method.
bool automaticScaling() const
If automatic scaling on.
void setSumOfRelaxedPrimalInfeasibilities(double value)
If problem is primal feasible.
int numberRows() const
Number of rows.
int reducedGradient(int phase=0)
Solves non-linear using reduced gradient.
double *COIN_RESTRICT solution
double largeValue() const
Large bound value (for complementarity etc)
int numberChanged_
Can be used for count of changed costs (dual) or changed bounds (primal)
void setColumnBounds(int elementIndex, double lower, double upper)
Set a single column lower and upper bound.
int firstFree_
First free/super-basic variable (-1 if none)
int numberRefinements_
How many iterative refinements to do.
double * lowerRegion(int section) const
Return row or column sections - not as much needed as it once was.
int cleanPrimalSolution(double exactMultiple)
Clean primal solution If you expect solution to only have exact multiples of "exactMultiple" then thi...
Sparse Matrix Base Class.
ClpEventHandler * eventHandler() const
Event handler.
double * rowActivityWork_
Row activities - working copy.
void setValueOut(double value)
Set value of out variable.
For saving extra information to see if looping.
void forceFactorization(int value)
Force re-factorization early.
void setValuesPassAction(double incomingInfeasibility, double allowedInfeasibility)
For advanced use.
int columnPrimalSequence_
Sequence of worst (-1 if feasible)
double alpha_
Alpha (pivot element)
Primal Column Pivot Abstract Base Class.
double * lowerRegion() const
Return row or column sections - not as much needed as it once was.
void checkPrimalSolution(const double *rowActivities=NULL, const double *columnActivies=NULL)
This sets largest infeasibility and most infeasible and sum and number of infeasibilities (Primal) ...
int directionOut() const
Return row or column sections - not as much needed as it once was.
double * reducedCostWork_
Possible scaled reduced costs.
void setDualOut(double value)
Set dual value of out variable.
double originalUpper(int iSequence) const
Return original lower bound.
double * columnUpper_
Column Upper.
const double *COIN_RESTRICT upper
void checkBothSolutions()
This sets sum and number of infeasibilities (Dual and Primal)
void setInfeasibilityCost(double value)
If problem is primal feasible.
int isColumn(int sequence) const
Returns 1 if sequence indicates column.
double bestObjectiveValue_
"Best" objective value
int readMps(const char *filename, bool keepNames=false, bool ignoreErrors=false)
Read an mps file from the given filename.
void gutsOfDelete(int type)
Does most of deletion (0 = all, 1 = most, 2 most + factorization)
void setPivoted(int sequence)
To flag a variable (not inline to allow for column generation)
int cleanup(int cleanupScaling)
When scaling is on it is possible that the scaled problem is feasible but the unscaled is not...
void setDualIn(double value)
Set reduced cost of last incoming to force error.
void returnModel(ClpSimplex &otherModel)
Return model - updates any scalars.
int barrier(bool crossover=true)
Solves using barrier (assumes you have good cholesky factor code).
int * pivotVariable() const
Basic variables pivoting on which rows.
double sumOfRelaxedPrimalInfeasibilities_
Sum of Primal infeasibilities using tolerance based on error in primals.
double * rowObjective() const
Row Objective.
double * columnActivityWork_
Column activities - working copy.
ClpDisasterHandler * disasterHandler() const
Get disaster handler.
void computePrimals(const double *rowActivities, const double *columnActivities)
Computes primals from scratch.
double cost(int sequence)
Return row or column sections - not as much needed as it once was.
int modifyCoefficientsAndPivot(int number, const int *which, const CoinBigIndex *start, const int *row, const double *newCoefficient, const unsigned char *newStatus=NULL, const double *newLower=NULL, const double *newUpper=NULL, const double *newObjective=NULL)
Modifies coefficients etc and if necessary pivots in and out.
int dontFactorizePivots_
If may skip final factorize then allow up to this pivots (default 20)
ClpSimplex(bool emptyMessages=false)
Default constructor.
int forceFactorization() const
Force re-factorization early value.
void checkSolutionInternal()
Just check solution (for internal use) - sets sum of infeasibilities etc.
void setCurrentDualTolerance(double value)
If problem is primal feasible.
double primalToleranceToGetOptimal_
Primal tolerance needed to make dual feasible (<largeTolerance)
void setToBaseModel(ClpSimplex *model=NULL)
Reset to base model (just size and arrays needed) If model NULL use internal copy.
int crash(double gap, int pivot)
Crash - at present just aimed at dual, returns -2 if dual preferred and crash basis created -1 if dua...
int algorithm() const
Current (or last) algorithm.
int lastBadIteration_
So we know when to be cautious.
void writeLp(const char *filename, const char *extension="lp", double epsilon=1e-5, int numberAcross=10, int decimals=5, double objSense=0.0, bool useRowNames=true) const
Write the problem into an Lp file of the given filename.
int fastDual2(ClpNodeStuff *stuff)
Like Fast dual.
#define CLP_INFEAS_SAVE
Last few infeasibilities.
int pivotResultPart2(int algorithm, int state)
Do actual pivot state is 0 if need tableau column, 1 if in rowArray_[1].
int numberPrimalInfeasibilities() const
Number of primal infeasibilities.
double * infeasibilityRay(bool fullRay=false) const
Infeasibility/unbounded ray (NULL returned if none/wrong) Up to user to use delete [] on these arrays...
double sumPrimalInfeasibilities_
Sum of primal infeasibilities.
int baseIteration() const
Iteration when we entered dual or primal.
int numberDualInfeasibilitiesWithoutFree_
Number of dual infeasibilities (without free)
double acceptablePivot_
Acceptable pivot value just after factorization.
int numberDualInfeasibilities_
Number of dual infeasibilities.
void setUpperOut(double value)
Set upper of out variable.
ClpFactorization * swapFactorization(ClpFactorization *factorization)
General solve algorithm which can do presolve.
double * columnLower_
Column Lower.
ClpDisasterHandler * disasterArea_
Disaster handler.
double * columnUpperWork_
Column upper bounds - working copy.
void setStatus(int sequence, Status newstatus)
Return row or column sections - not as much needed as it once was.
void getBInvACol(int col, double *vec)
Get a column of the tableau.
int primalRanging(int numberCheck, const int *which, double *valueIncrease, int *sequenceIncrease, double *valueDecrease, int *sequenceDecrease)
Primal ranging.
int tightenPrimalBounds(double factor=0.0, int doTight=0, bool tightIntegers=false)
Tightens primal bounds to make dual faster.
void checkDualSolution()
This sets largest infeasibility and most infeasible and sum and number of infeasibilities (Dual) ...
void clearPivoted(int sequence)
To flag a variable (not inline to allow for column generation)
double largestDualError_
Largest error on basic duals.
double * solution_
Working copy of primal solution (Owner of arrays below)
void computeDuals(double *givenDjs)
Computes duals from scratch.
int startFastDual2(ClpNodeStuff *stuff)
Starts Fast dual2.
double valueIncomingDual() const
value of incoming variable (in Dual)
CoinIndexedVector * columnArray(int index) const
Useful column length arrays (0,1,2,3,4,5)
void ClpSimplexUnitTest(const std::string &mpsDir)
A function that tests the methods in the ClpSimplex class.
bool perturbed(int iSequence) const
To flag a variable (not inline to allow for column generation)
int createPiecewiseLinearCosts(const int *starts, const double *lower, const double *gradient)
Constructs a non linear cost from list of non-linearities (columns only) First lower of each column i...
int lastFlaggedIteration_
So we know when to open up again.
void setDirectionIn(int direction)
Set directionIn or Out.
void setZeroTolerance(double value)
Set zero tolerance.
double theta() const
Theta (pivot change)
Status
enums for status of various sorts.
Status getColumnStatus(int sequence) const
To flag a variable (not inline to allow for column generation)
int internalFactorize(int solveType)
Factorizes using current basis.
void setLargestDualError(double value)
Largest error on basic duals.
void clearPerturbed(int iSequence)
To flag a variable (not inline to allow for column generation)
void setFactorization(ClpFactorization &factorization)
Passes in factorization.
void generateCpp(FILE *fp, bool defaultFactor=false)
Create C++ lines to get to current state.
ClpSimplexProgress * progress()
For dealing with all issues of cycling etc.
void setSequenceIn(int sequence)
Set sequenceIn or Out.
ClpSimplex * baseModel_
A copy of model with certain state - normally without cuts.
double * rowObjectiveWork_
Row objective - working copy.
double sumDualInfeasibilities() const
Sum of dual infeasibilities.
int numberColumns() const
Number of rows.
void setNumberPrimalInfeasibilities(int value)
If problem is primal feasible.
void setRowLower(int elementIndex, double elementValue)
Set a single row lower bound Use -DBL_MAX for -infinity.
double largeValue_
Large bound value (for complementarity etc)
bool initialDenseFactorization() const
Return row or column sections - not as much needed as it once was.
Status getStatus(int sequence) const
Return row or column sections - not as much needed as it once was.
ClpSimplex * baseModel() const
See if we have base model.
int sequenceWithin(int sequence) const
Returns sequence number within section.
double * rowUpperWork_
Row upper bounds - working copy.
void borrowModel(ClpModel &otherModel)
Borrow model.
double lowerOut_
Lower Bound on Out variable.
void checkUnscaledSolution()
Check unscaled primal solution but allow for rounding error.
double dualIn_
Reduced cost of In variable.
int initialDualSolve()
Dual initial solve.
int maximumPerturbationSize_
Maximum perturbation array size (take out when code rewritten)
void setColumnLower(int elementIndex, double elementValue)
Set a single column lower bound Use -DBL_MAX for -infinity.
double bestPossibleImprovement() const
Best possible improvement using djs (primal) or obj change by flipping bounds to make dual feasible (...
double valueIn_
Value of In variable.
Base class for Clp disaster handling.
void setTheta(double value)
Set theta of out variable.
int numberRefinements() const
How many iterative refinements to do.
void deleteBaseModel()
Switch off base model.
void setRowUpper(int elementIndex, double elementValue)
Set a single row upper bound Use DBL_MAX for infinity.
double * solutionRegion() const
Return region as single array.
void setNumberDualInfeasibilities(int value)
If problem is primal feasible.
int progressFlag() const
Progress flag - at present 0 bit says artificials out.
void setFlagged(int sequence)
To flag a variable (not inline to allow for column generation)
int getSolution()
Given an existing factorization computes and checks primal and dual solutions.
int saveModel(const char *fileName)
Save model to file, returns 0 if success.
ClpDualRowPivot * dualRowPivot() const
dual row pivot choice
void setActive(int iRow)
To say row active in primal pivot row choice.
double objectiveValue_
Objective value.
int numberFake_
Can be used for count of fake bounds (dual) or fake costs (primal)
void setDirectionOut(int direction)
Return row or column sections - not as much needed as it once was.
double *COIN_RESTRICT reducedCost
int sequenceIn_
Sequence of In variable.
double * upper_
Working copy of upper bounds (Owner of arrays below)
void setFakeBound(int sequence, FakeBound fakeBound)
To flag a variable (not inline to allow for column generation)
int outDuplicateRows(int numberLook, int *whichRows, bool noOverlaps=false, double tolerance=-1.0, double cleanUp=0.0)
Take out duplicate rows (includes scaled rows and intersections).
void setMoreSpecialOptions(int value)
Set more special options 1 bit - if presolve says infeasible in ClpSolve return 2 bit - if presolved ...
void setPerturbed(int iSequence)
To say perturbed.
int readLp(const char *filename, const double epsilon=1e-5)
Read file in LP format from file with name filename.
int fathomMany(void *stuff)
Do up to N deep - returns -1 - no solution nNodes_ valid nodes >= if solution and that node gives sol...
int initialBarrierSolve()
Barrier initial solve.
double upperOut() const
Upper of out variable.
int directionIn() const
Return direction In or Out.
int dual(int ifValuesPass=0, int startFinishOptions=0)
Dual algorithm - see ClpSimplexDual.hpp for method.
ClpSimplexProgress progress_
For dealing with all issues of cycling etc.
double * solutionRegion(int section) const
Return row or column sections - not as much needed as it once was.
bool statusOfProblem(bool initial=false)
Factorizes and returns true if optimal.
void setRowSetBounds(const int *indexFirst, const int *indexLast, const double *boundList)
Set the bounds on a number of rows simultaneously
int initialSolve()
Default initial solve.
double computeInternalObjectiveValue()
Compute minimization objective value from internal solution without perturbation. ...
double sumOfRelaxedPrimalInfeasibilities() const
Sum of relaxed primal infeasibilities.
friend void ClpSimplexUnitTest(const std::string &mpsDir)
A function that tests the methods in the ClpSimplex class.
const CoinBigIndex *COIN_RESTRICT start
This solves LPs using the simplex method.
void setObjectiveCoefficient(int elementIndex, double elementValue)
Set an objective function coefficient.
int startup(int ifValuesPass, int startFinishOptions=0)
Common bits of coding for dual and primal.
double dualBound_
Dual bound.
double * upperRegion() const
Return row or column sections - not as much needed as it once was.
int automaticScale_
Automatic scaling of objective and rhs and bounds.
void checkSolution(int setToBounds=0)
Just check solution (for external use) - sets sum of infeasibilities etc.
void finish(int startFinishOptions=0)
Pivot in a variable and out a variable.
void createRim1(bool initial)
Does rows and columns.
double lowerOut() const
Lower of out variable.
double spareDoubleArray_[4]
Spare double array for passing information [0]!=0 switches on.
Base class for Clp event handling.
void moveInfo(const ClpSimplex &rhs, bool justStatus=false)
Move status and solution across.
void setAlgorithm(int value)
Set algorithm.
ClpPrimalColumnPivot * primalColumnPivot() const
primal column pivot choice
int dualRanging(int numberCheck, const int *which, double *costIncrease, int *sequenceIncrease, double *costDecrease, int *sequenceDecrease, double *valueIncrease=NULL, double *valueDecrease=NULL)
Dual ranging.
Abstract base class for Clp Matrices.
double sumOfRelaxedDualInfeasibilities_
Sum of Dual infeasibilities using tolerance based on error in duals.
int vectorMode() const
Get vector mode.
int initialBarrierNoCrossSolve()
Barrier initial solve, not to be followed by crossover.
int moreSpecialOptions() const
Return more special options 1 bit - if presolve says infeasible in ClpSolve return 2 bit - if presolv...
Status getRowStatus(int sequence) const
To flag a variable (not inline to allow for column generation)
void originalModel(ClpSimplex *miniModel)
This copies back stuff from miniModel and then deletes miniModel.
double alphaAccuracy_
For computing whether to re-factorize.
int directionOut_
Direction of Out, 1 to upper bound, -1 to lower bound, 0 - superbasic.
int progressFlag_
Progress flag - at present 0 bit says artificials out, 1 free in.
double doubleCheck()
Double checks OK.
void setDualBound(double value)
If problem is primal feasible.
void passInEventHandler(const ClpEventHandler *eventHandler)
Pass in Event handler (cloned and deleted at end)
void setInitialDenseFactorization(bool onOff)
Normally the first factorization does sparse coding because the factorization could be singular...
void unpackPacked(CoinIndexedVector *rowArray)
Unpacks one column of the matrix into indexed array as packed vector Uses sequenceIn_ Also applies sc...
int spareIntArray_[4]
Spare int array for passing information [0]!=0 switches on.
double upperOut_
Upper Bound on Out variable.
bool primalFeasible() const
If problem is primal feasible.
void copyFactorization(ClpFactorization &factorization)
Copies in factorization to existing one.
double dualIn() const
Reduced cost of last incoming for use by classes e.g. steepestedge.
bool sparseFactorization() const
Sparsity on or off.
double * objectiveWork_
Column objective - working copy.
double * upperRegion(int section) const
Return row or column sections - not as much needed as it once was.
void removeSuperBasicSlacks(int threshold=0)
Try simple crash like techniques to remove super basic slacks but only if > threshold.
void getBInvCol(int col, double *vec)
Get a column of the basis inverse.
void setPivotRow(int value)
If problem is primal feasible.
double valueOut() const
Value of Out variable.
void setColSetBounds(const int *indexFirst, const int *indexLast, const double *boundList)
Set the bounds on a number of columns simultaneously
void getBInvRow(int row, double *z)
Get a row of the basis inverse.
double theta_
Theta (pivot change)
void resize(int newNumberRows, int newNumberColumns)
Resizes rim part of model.
void deleteRim(int getRidOfFactorizationData=2)
releases above arrays and does solution scaling out.
double dualBound() const
Dual bound.
double reducedCost(int sequence)
Return row or column sections - not as much needed as it once was.
bool goodAccuracy() const
Returns true if model looks OK.
const unsigned char *COIN_RESTRICT status
double upper(int sequence)
Return row or column sections - not as much needed as it once was.
int dualPivotResultPart1()
Pivot out a variable and choose an incoing one.
void markHotStart(void *&saveStuff)
Create a hotstart point of the optimization process.
int factorizationFrequency() const
Factorization frequency.
double * costRegion(int section) const
Return row or column sections - not as much needed as it once was.
double *COIN_RESTRICT infeas
void setRowBounds(int elementIndex, double lower, double upper)
Set a single row lower and upper bound.
ClpFactorization * getEmptyFactorization()
Gets clean and emptyish factorization.
int solveDW(CoinStructuredModel *model, ClpSolve &options)
Solve using Dantzig-Wolfe decomposition and maybe in parallel.
void setLastBadIteration(int value)
Set so we know when to be cautious.
void makeBaseModel()
Save a copy of model with certain state - normally without cuts.
void miniSolve(char *rowType, char *columnType, int algorithm, int startUp)
mini presolve and solve
void setColBounds(int elementIndex, double newlower, double newupper)
Set a single column lower and upper bound.
double * rowLowerWork_
Row lower bounds - working copy.
void setPerturbation(int value)
If problem is primal feasible.
int directionIn_
Direction of In, 1 going up, -1 going down, 0 not a clue.
void dropNames()
Drops names - makes lengthnames 0 and names empty.
double * rowLower_
Row lower.
const int *COIN_RESTRICT row
void computeObjectiveValue(bool useWorkingSolution=false)
Compute objective value from solution and put in objectiveValue_.
ClpSimplex * miniPresolve(char *rowType, char *columnType, void **info)
Mini presolve (faster) Char arrays must be numberRows and numberColumns long on entry second part mus...
CoinIndexedVector * rowArray(int index) const
Useful row length arrays (0,1,2,3,4,5)
double * lower_
Working copy of lower bounds (Owner of arrays below)
void setColumnStatus(int sequence, Status newstatus)
To flag a variable (not inline to allow for column generation)
int factorize()
Factorizes using current basis. For external use.
friend class OsiCLPSolverInterface
And OsiCLP.
int lastGoodIteration_
Last good iteration (immediately after a re-factorization)
int pivotRow() const
Pivot Row for use by classes e.g. steepestedge.
int solve(CoinStructuredModel *model)
Solve using structure of model and maybe in parallel.
int algorithm_
Algorithm >0 == Primal, <0 == Dual.
double alpha() const
Alpha (pivot element) for use by classes e.g. steepestedge.
double upperIn_
Upper Bound on In variable.
double dualOut() const
Dual value of Out variable.
This deals with Factorization and Updates.
bool dualFeasible() const
If problem is dual feasible.
double sumOfRelaxedDualInfeasibilities() const
Sum of relaxed dual infeasibilities.
int sequenceOut_
Sequence of Out variable.
int sequenceIn() const
Return sequence In or Out.
int perturbation() const
Amount of print out: 0 - none 1 - just final 2 - just factorizations 3 - as 2 plus a bit more 4 - ver...
void setDisasterHandler(ClpDisasterHandler *handler)
Objective value.
int numberDualInfeasibilitiesWithoutFree() const
Number of dual infeasibilities (without free)
double bestPossibleImprovement_
Best possible improvement using djs (primal) or obj change by flipping bounds to make dual feasible (...
void cleanStatus()
Clean up status.
void allSlackBasis(bool resetSolution=false)
Sets up all slack basis and resets solution to as it was after initial load or readMps.
int numberDualInfeasibilities() const
Number of dual infeasibilities.
void setLargeValue(double value)
If problem is primal feasible.
int maximumBasic_
Maximum number of basic variables - can be more than number of rows if GUB.
bool createRim(int what, bool makeRowCopy=false, int startFinishOptions=0)
puts in format I like (rowLower,rowUpper) also see StandardMatrix 1 bit does rows (now and columns)...
double & costAddress(int sequence)
Return address of row or column cost.
void getbackSolution(const ClpSimplex &smallModel, const int *whichRow, const int *whichColumn)
Puts solution back into small model.
const double *COIN_RESTRICT cost
double dualTolerance_
Current dual tolerance for algorithm.
int perturbation_
Perturbation: -50 to +50 - perturb by this power of ten (-6 sounds good) 100 - auto perturb if takes ...
ClpDualRowPivot * dualRowPivot_
dual row pivot choice
CoinIndexedVector * rowArray_[6]
Useful row length arrays.
int * pivotVariable_
Basic variables pivoting on which rows.
double currentPrimalTolerance() const
Current primal tolerance.
bool isObjectiveLimitTestValid() const
Return true if the objective limit test can be relied upon.
int numberExtraRows() const
Number of extra rows.
int nonlinearSLP(int numberPasses, double deltaTolerance)
Solves nonlinear problem using SLP - may be used as crash for other algorithms when number of iterati...
int numberDegeneratePivots_
Number of degenerate pivots since last perturbed.
int primalPivotResult()
Pivot in a variable and choose an outgoing one.
int loadNonLinear(void *info, int &numberConstraints, ClpConstraint **&constraints)
Load nonlinear part of problem from AMPL info Returns 0 if linear 1 if quadratic objective 2 if quadr...
double infeasibilityCost_
Weight assigned to being infeasible in primal.
double lower(int sequence)
Return row or column sections - not as much needed as it once was.
void unpack(CoinIndexedVector *rowArray) const
Unpacks one column of the matrix into indexed array Uses sequenceIn_ Also applies scaling if needed...
const int *COIN_RESTRICT pivotVariable
void createRim5(bool initial)
Does rows and columns and objective.
ClpFactorization * factorization() const
factorization
double & lowerAddress(int sequence)
Return address of row or column lower bound.
double *COIN_RESTRICT work
The default COIN simplex (basis-oriented) warm start class.
This just implements CoinFactorization when an ClpMatrixBase object is passed.
unsigned char * saveStatus_
Saved status regions.
void getBInvARow(int row, double *z, double *slack=NULL)
Get a row of the tableau (slack part in slack if not NULL)
int numberTimesOptimal_
Number of times code has tentatively thought optimal.
int sequenceOut() const
Return row or column sections - not as much needed as it once was.
ClpPrimalColumnPivot * primalColumnPivot_
primal column pivot choice
double alphaAccuracy() const
Initial value for alpha accuracy calculation (-1.0 off)
void setSumPrimalInfeasibilities(double value)
If problem is primal feasible.
int cleanFactorization(int ifValuesPass)
Get a clean factorization - i.e.
void clearFlagged(int sequence)
To flag a variable (not inline to allow for column generation)
int restoreModel(const char *fileName)
Restore model from file, returns 0 if success, deletes current model.
double infeasibilityCost() const
Infeasibility cost.
double primalTolerance_
Current primal tolerance for algorithm.
void setEmptyFactorization()
May delete or may make clean and emptyish factorization.
double * djRegion() const
Return row or column sections - not as much needed as it once was.
int initialPrimalSolve()
Primal initial solve.
void setAutomaticScaling(bool onOff)
If problem is primal feasible.
void setColLower(int elementIndex, double elementValue)
Set a single column lower bound Use -DBL_MAX for -infinity.
double * dj_
Working copy of reduced costs (Owner of arrays below)