Go to the documentation of this file.
23 class CoinIndexedVector;
26 class CoinStructuredModel;
28 class CoinWarmStartBasis;
36 #ifndef CLP_INHERIT_MODE
37 #define CLP_INHERIT_MODE 1
39 #ifndef ABC_CLP_DEFAULTS
40 #define ABC_CLP_DEFAULTS 0
43 #undef ABC_CLP_DEFAULTS
44 #define ABC_CLP_DEFAULTS 1
118 bool dropNames =
true,
bool dropIntegers =
true,
119 bool fixOthers =
false);
129 bool dropNames =
true,
bool dropIntegers =
true,
130 bool fixOthers =
false);
145 {
return abcSimplex_;}
146 inline void setAbcSimplex(
AbcSimplex * simplex)
147 { abcSimplex_=simplex;}
151 int doAbcPrimal(
int ifValuesPass);
188 const double* collb,
const double* colub,
190 const double* rowlb,
const double* rowub,
193 const double* collb,
const double* colub,
195 const double* rowlb,
const double* rowub,
201 const CoinBigIndex* start,
const int* index,
203 const double* collb,
const double* colub,
205 const double* rowlb,
const double* rowub,
209 const CoinBigIndex* start,
const int* index,
210 const double* value,
const int * length,
211 const double* collb,
const double* colub,
213 const double* rowlb,
const double* rowub,
219 int loadProblem ( CoinModel & modelObject,
bool keepSolution =
false);
222 bool keepNames =
false,
223 bool ignoreErrors =
false);
225 int readGMPL(
const char *filename,
const char * dataName,
226 bool keepNames =
false);
229 int readLp(
const char *filename,
const double epsilon = 1e-5);
284 int dual(
int ifValuesPass = 0,
int startFinishOptions = 0);
286 int dualDebug(
int ifValuesPass = 0,
int startFinishOptions = 0);
297 int primal(
int ifValuesPass = 0,
int startFinishOptions = 0);
310 int numberPasses,
double deltaTolerance);
318 int solve(CoinStructuredModel * model);
335 bool originalOrder =
true,
bool keepSolution =
false);
372 double * costIncrease,
int * sequenceIncrease,
373 double * costDecrease,
int * sequenceDecrease,
374 double * valueIncrease = NULL,
double * valueDecrease = NULL);
390 double * valueIncrease,
int * sequenceIncrease,
391 double * valueDecrease,
int * sequenceDecrease);
403 const CoinBigIndex * start,
405 const double * newCoefficient,
406 const unsigned char * newStatus=NULL,
407 const double * newLower=NULL,
408 const double * newUpper=NULL,
409 const double * newObjective=NULL);
417 int outDuplicateRows(
int numberLook,
int * whichRows,
bool noOverlaps=
false,
double tolerance=-1.0,
457 bool writeValues =
false,
458 int formatType = 0)
const;
516 double * newLower,
double * newUpper,
517 double ** outputSolution,
518 int * outputStatus,
int * outputIterations,
519 bool stopOnFirstInfeasible =
true,
520 bool alwaysFinish =
false,
521 int startFinishOptions = 0);
585 int startup(
int ifValuesPass,
int startFinishOptions = 0);
727 inline CoinIndexedVector *
rowArray(
int index)
const {
743 const double * columnActivities);
755 const double *
lower,
const double * gradient);
791 const double * columnActivities);
794 int column,
double multiplier)
const;
821 #ifndef CLP_USER_DRIVEN
832 const double * columnActivies = NULL);
859 double allowedInfeasibility);
972 #ifndef CLP_USER_DRIVEN
981 const double * givenPrimals,
982 bool valuesPass =
false);
998 bool createRim(
int what,
bool makeRowCopy =
false,
int startFinishOptions = 0);
1058 unsigned char & st_byte =
status_[sequence];
1059 st_byte =
static_cast<unsigned char>(st_byte & ~7);
1060 st_byte =
static_cast<unsigned char>(st_byte | newstatus);
1143 return dj_[sequence];
1146 return dj_[sequence];
1163 return cost_[sequence];
1167 return cost_[sequence];
1250 unsigned char & st_byte =
status_[sequence];
1251 st_byte =
static_cast<unsigned char>(st_byte & ~24);
1252 st_byte =
static_cast<unsigned char>(st_byte | (fakeBound << 3));
1259 st_byte =
static_cast<unsigned char>(st_byte & ~7);
1260 st_byte =
static_cast<unsigned char>(st_byte | newstatus);
1266 unsigned char & st_byte =
status_[sequence];
1267 st_byte =
static_cast<unsigned char>(st_byte & ~7);
1268 st_byte =
static_cast<unsigned char>(st_byte | newstatus);
1274 status_[sequence] =
static_cast<unsigned char>(
status_[sequence] | 32);
1277 status_[sequence] =
static_cast<unsigned char>(
status_[sequence] & ~32);
1280 return (((
status_[sequence] >> 5) & 1) != 0);
1285 status_[sequence] =
static_cast<unsigned char>(
status_[sequence] & ~64);
1288 return ((
status_[sequence] & 64) != 0);
1295 status_[iRow] =
static_cast<unsigned char>(
status_[iRow] & ~128);
1298 return ((
status_[iRow] & 128) != 0);
1302 status_[iSequence] =
static_cast<unsigned char>(
status_[iSequence] | 128);
1305 status_[iSequence] =
static_cast<unsigned char>(
status_[iSequence] & ~128);
1308 return ((
status_[iSequence] & 128) != 0);
1430 const int* indexLast,
1431 const double* boundList);
1446 double newlower,
double newupper ) {
1457 const int* indexLast,
1458 const double* boundList) {
1481 const int* indexLast,
1482 const double* boundList);
1484 void resize (
int newNumberRows,
int newNumberColumns);
1563 #define CLP_INFEAS_SAVE 5
1699 #define CLP_ABC_WANTED 1
1700 #define CLP_ABC_WANTED_PARALLEL 2
1701 #define CLP_ABC_FULL_DONE 8
1704 #define CLP_ABC_BEEN_FEASIBLE 65536
1733 #define DEVEX_TRY_NORM 1.0e-4
1734 #define DEVEX_ADD_ONE 1.0
1735 #if defined(ABC_INHERIT) || defined(CBC_THREAD) || defined(THREADS_IN_ANALYZE)
1737 #include <pthread.h>
1747 class CoinPthreadStuff {
1753 CoinPthreadStuff (
int numberThreads=0,
1754 void * parallelManager(
void * stuff)=NULL);
1756 CoinPthreadStuff & operator=(
const CoinPthreadStuff & rhs);
1758 ~CoinPthreadStuff ( );
1760 inline void setStopStart(
int value)
1761 { stopStart_=value;}
1762 #ifndef NUMBER_THREADS
1763 #define NUMBER_THREADS 8
1766 inline pthread_mutex_t * mutexPointer(
int which,
int thread=0)
1767 {
return mutex_+which+3*thread;}
1768 #ifdef PTHREAD_BARRIER_SERIAL_THREAD
1769 inline pthread_barrier_t * barrierPointer()
1770 {
return &barrier_;}
1772 inline int whichLocked(
int thread=0)
const
1773 {
return locked_[thread];}
1774 inline CoinThreadInfo * threadInfoPointer(
int thread=0)
1775 {
return threadInfo_+thread;}
1776 void startParallelTask(
int type,
int iThread,
void * info=NULL);
1777 int waitParallelTask(
int type,
int & iThread,
bool allowIdle);
1778 void waitAllTasks();
1780 int whichThread()
const;
1781 void sayIdle(
int iThread);
1786 #ifdef PTHREAD_BARRIER_SERIAL_THREAD
1787 pthread_barrier_t barrier_;
1795 void * clp_parallelManager(
void * stuff);
This solves LPs using the simplex method.
This just implements CoinFactorization when an ClpMatrixBase object is passed.
double theta() const
Theta (pivot change)
void setLargestDualError(double value)
Largest error on basic duals.
double sumOfRelaxedPrimalInfeasibilities_
Sum of Primal infeasibilities using tolerance based on error in primals.
int initialBarrierSolve()
Barrier initial solve.
void setActive(int iRow)
To say row active in primal pivot row choice.
void getBInvARow(int row, double *z, double *slack=NULL)
Get a row of the tableau (slack part in slack if not NULL)
int firstFree_
First free/super-basic variable (-1 if none)
int readLp(const char *filename, const double epsilon=1e-5)
Read file in LP format from file with name filename.
void setStatus(int sequence, Status newstatus)
void checkDualSolution()
This sets largest infeasibility and most infeasible and sum and number of infeasibilities (Dual)
int numberTimesOptimal_
Number of times code has tentatively thought optimal.
double * columnUpper_
Column Upper.
double alphaAccuracy() const
Initial value for alpha accuracy calculation (-1.0 off)
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.
void moveInfo(const ClpSimplex &rhs, bool justStatus=false)
Move status and solution across.
void loadProblem(const int numcols, const int numrows, const CoinBigIndex *start, const int *index, const double *value, const int *length, const double *collb, const double *colub, const double *obj, const double *rowlb, const double *rowub, const double *rowObjective=NULL)
This one is for after presolve to save memory.
int initialPrimalSolve()
Primal initial solve.
void setDualRowPivotAlgorithm(ClpDualRowPivot &choice)
Sets row pivot choice algorithm in dual.
void setColLower(int elementIndex, double elementValue)
Set a single column lower bound Use -DBL_MAX for -infinity.
int lastBadIteration() const
So we know when to be cautious.
int progressFlag_
Progress flag - at present 0 bit says artificials out, 1 free in.
This is a very simple class to guide algorithms.
int algorithm_
Algorithm >0 == Primal, <0 == Dual.
CoinIndexedVector * rowArray(int index) const
Useful row length arrays (0,1,2,3,4,5)
int initialBarrierNoCrossSolve()
Barrier initial solve, not to be followed by crossover.
Status getRowStatus(int sequence) const
int isColumn(int sequence) const
Returns 1 if sequence indicates column.
int solveType() const
Solve type - 1 simplex, 2 simplex interface, 3 Interior.
bool primalFeasible() const
If problem is primal feasible.
double doubleCheck()
Double checks OK.
void setDirectionOut(int direction)
void add(double *array, int column, double multiplier) const
Adds multiple of a column into an array.
unsigned char * saveStatus_
Saved status regions.
ClpFactorization * factorization_
factorization
void setDisasterHandler(ClpDisasterHandler *handler)
Objective value.
bool automaticScaling() const
If automatic scaling on.
int automaticScale_
Automatic scaling of objective and rhs and bounds.
int numberPrimalInfeasibilities_
Number of primal infeasibilities.
ClpNonLinearCost * nonLinearCost() const
Return pointer to details of costs.
double computeInternalObjectiveValue()
Compute minimization objective value from internal solution without perturbation.
double dualBound_
Dual bound.
void setSumDualInfeasibilities(double value)
void passInEventHandler(const ClpEventHandler *eventHandler)
Pass in Event handler (cloned and deleted at end)
void setAlphaAccuracy(double value)
void setColumnLower(int elementIndex, double elementValue)
Set a single column lower bound Use -DBL_MAX for -infinity.
double dualOut() const
Dual value of Out variable.
Status getStatus(int sequence) const
int rowPrimalSequence_
Sequence of worst (-1 if feasible)
int directionOut_
Direction of Out, 1 to upper bound, -1 to lower bound, 0 - superbasic.
double * rowObjective() const
Row Objective.
double * columnLower_
Column Lower.
void borrowModel(ClpModel &otherModel)
Borrow model.
int writeBasis(const char *filename, bool writeValues=false, int formatType=0) const
Write the basis in MPS format to the specified file.
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...
CoinIndexedVector * columnArray(int index) const
Useful column length arrays (0,1,2,3,4,5)
int readBasis(const char *filename)
Read a basis from the given filename, returns -1 on file error, 0 if no values, 1 if values.
int initialDualSolve()
Dual initial solve.
int fathomMany(void *stuff)
Do up to N deep - returns -1 - no solution nNodes_ valid nodes >= if solution and that node gives sol...
double & costAddress(int sequence)
Return address of row or column cost.
void setColBounds(int elementIndex, double newlower, double newupper)
Set a single column lower and upper bound.
double dualOut_
Infeasibility (dual) or ? (primal) of Out variable.
int solveDW(CoinStructuredModel *model, ClpSolve &options)
Solve using Dantzig-Wolfe decomposition and maybe in parallel.
int perturbation() const
Amount of print out: 0 - none 1 - just final 2 - just factorizations 3 - as 2 plus a bit more 4 - ver...
This is a tiny class where data can be saved round calls.
int numberDualInfeasibilitiesWithoutFree() const
Number of dual infeasibilities (without free)
void setSequenceOut(int sequence)
int solve(CoinStructuredModel *model)
Solve using structure of model and maybe in parallel.
double * solutionRegion(int section) const
Return row or column sections - not as much needed as it once was.
int spareIntArray_[4]
Spare int array for passing information [0]!=0 switches on.
int perturbation_
Perturbation: -50 to +50 - perturb by this power of ten (-6 sounds good) 100 - auto perturb if takes ...
double valueIncomingDual() const
value of incoming variable (in Dual)
CoinIndexedVector * columnArray_[6]
Useful column length arrays.
double * solutionRegion() const
Return region as single array.
ClpSimplex & operator=(const ClpSimplex &rhs)
Assignment operator. This copies the data.
double * columnUpperWork_
Column upper bounds - working copy.
void deleteBaseModel()
Switch off base model.
void clearPivoted(int sequence)
double currentDualTolerance() const
Current dual tolerance.
void setColSetBounds(const int *indexFirst, const int *indexLast, const double *boundList)
Set the bounds on a number of columns simultaneously
int startFastDual2(ClpNodeStuff *stuff)
Starts Fast dual2.
CoinWarmStartBasis * getBasis() const
Returns a basis (to be deleted by user)
#define CLP_INFEAS_SAVE
Last few infeasibilities.
double & lowerAddress(int sequence)
Return address of row or column lower bound.
ClpSimplex(const ClpSimplex &rhs, int scalingMode=-1)
Copy constructor.
int saveModel(const char *fileName)
Save model to file, returns 0 if success.
int lastBadIteration_
So we know when to be cautious.
double reducedCost(int sequence)
double sumOfRelaxedDualInfeasibilities_
Sum of Dual infeasibilities using tolerance based on error in duals.
bool pivoted(int sequence) const
int * pivotVariable() const
Basic variables pivoting on which rows.
bool sanityCheck()
Sanity check on input rim data (after scaling) - returns true if okay.
void setAbcState(int state)
int readGMPL(const char *filename, const char *dataName, bool keepNames=false)
Read GMPL files from the given filenames.
int baseIteration() const
Iteration when we entered dual or primal.
void ClpSimplexUnitTest(const std::string &mpsDir)
A function that tests the methods in the ClpSimplex class.
void setSumPrimalInfeasibilities(double value)
void checkSolution(int setToBounds=0)
Just check solution (for external use) - sets sum of infeasibilities etc.
double * upperRegion() const
double lowerIn_
Lower Bound on In variable.
bool sparseFactorization() const
Sparsity on or off.
double bestPossibleImprovement() const
Best possible improvement using djs (primal) or obj change by flipping bounds to make dual feasible (...
void loadProblem(const CoinPackedMatrix &matrix, const double *collb, const double *colub, const double *obj, const double *rowlb, const double *rowub, const double *rowObjective=NULL)
void setInfeasibilityCost(double value)
CoinPackedMatrix * matrix() const
Matrix (if not ClpPackedmatrix be careful about memory leak.
void createRim4(bool initial)
Does objective.
int numberDualInfeasibilitiesWithoutFree_
Number of dual infeasibilities (without free)
void unpack(CoinIndexedVector *rowArray, int sequence) const
Unpacks one column of the matrix into indexed array Slack if sequence>= numberColumns Also applies sc...
void setMoreSpecialOptions(int value)
Set more special options 1 bit - if presolve says infeasible in ClpSolve return 2 bit - if presolved ...
int columnPrimalSequence_
Sequence of worst (-1 if feasible)
double zeroTolerance_
Zero tolerance.
double averageInfeasibility_[CLP_INFEAS_SAVE]
double * djRegion() const
void setAlpha(double value)
void setLargeValue(double value)
Status getColumnStatus(int sequence) const
void unpackPacked(CoinIndexedVector *rowArray, int sequence)
Unpacks one column of the matrix into indexed array as packed vector Slack if sequence>= numberColumn...
int maximumBasic() const
Maximum number of basic variables - can be more than number of rows if GUB.
double primalToleranceToGetOptimal_
Primal tolerance needed to make dual feasible (<largeTolerance)
int moreSpecialOptions_
More special options - see set for details.
int restoreModel(const char *fileName)
Restore model from file, returns 0 if success, deletes current model.
int readMps(const char *filename, bool keepNames=false, bool ignoreErrors=false)
Read an mps file from the given filename.
double bestPossibleImprovement_
Best possible improvement using djs (primal) or obj change by flipping bounds to make dual feasible (...
int directionIn() const
Return direction In or Out.
int baseIteration_
Iteration when we entered dual or primal.
ClpSimplex(const ClpModel *wholeModel, int numberRows, const int *whichRows, int numberColumns, const int *whichColumns, bool dropNames=true, bool dropIntegers=true, bool fixOthers=false)
Subproblem constructor.
void setPerturbation(int value)
void miniSolve(char *rowType, char *columnType, int algorithm, int startUp)
mini presolve and solve
void gutsOfCopy(const ClpSimplex &rhs)
Does most of copying.
ClpPrimalColumnPivot * primalColumnPivot_
primal column pivot choice
double alpha_
Alpha (pivot element)
int solveBenders(CoinStructuredModel *model, ClpSolve &options)
Solve using Benders decomposition and maybe in parallel.
void setColumnUpper(int elementIndex, double elementValue)
Set a single column upper bound Use DBL_MAX for infinity.
void setValuesPassAction(double incomingInfeasibility, double allowedInfeasibility)
For advanced use.
double * columnActivityWork_
Column activities - working copy.
int maximumBasic_
Maximum number of basic variables - can be more than number of rows if GUB.
int loadProblem(CoinStructuredModel &modelObject, bool originalOrder=true, bool keepSolution=false)
This loads a model from a CoinStructuredModel object - returns number of errors.
ClpSimplex(const ClpSimplex *wholeModel, int numberRows, const int *whichRows, int numberColumns, const int *whichColumns, bool dropNames=true, bool dropIntegers=true, bool fixOthers=false)
Subproblem constructor.
int maximumPerturbationSize_
Maximum perturbation array size (take out when code rewritten)
int primal(int ifValuesPass=0, int startFinishOptions=0)
Primal algorithm - see ClpSimplexPrimal.hpp for method.
For saving extra information to see if looping.
void setFactorization(ClpFactorization &factorization)
Passes in factorization.
double upperIn_
Upper Bound on In variable.
double sumPrimalInfeasibilities() const
Sum of primal infeasibilities.
double largeValue_
Large bound value (for complementarity etc)
int fastDual2(ClpNodeStuff *stuff)
Like Fast dual.
void getBasics(int *index)
Get basic indices (order of indices corresponds to the order of elements in a vector retured by getBI...
void clearActive(int iRow)
int sequenceIn_
Sequence of In variable.
void deleteRim(int getRidOfFactorizationData=2)
releases above arrays and does solution scaling out.
double minimumPrimalTolerance_
Minimum primal tolerance.
void returnModel(ClpSimplex &otherModel)
Return model - updates any scalars.
void allSlackBasis(bool resetSolution=false)
Sets up all slack basis and resets solution to as it was after initial load or readMps.
int tightenPrimalBounds(double factor=0.0, int doTight=0, bool tightIntegers=false)
Tightens primal bounds to make dual faster.
void unpack(CoinIndexedVector *rowArray) const
Unpacks one column of the matrix into indexed array Uses sequenceIn_ Also applies scaling if needed.
ClpSimplex(const ClpModel &rhs, int scalingMode=-1)
Copy constructor from model.
void copyFactorization(ClpFactorization &factorization)
Copies in factorization to existing one.
int sequenceIn() const
Return sequence In or Out.
double valueIn_
Value of In variable.
double upperOut_
Upper Bound on Out variable.
void computePrimals(const double *rowActivities, const double *columnActivities)
Computes primals from scratch.
Constraint Abstract Base Class.
int getSolution(const double *rowActivities, const double *columnActivities)
Given an existing factorization computes and checks primal and dual solutions.
Base class for Clp disaster handling.
double * dj_
Working copy of reduced costs (Owner of arrays below)
int dualRanging(int numberCheck, const int *which, double *costIncrease, int *sequenceIncrease, double *costDecrease, int *sequenceDecrease, double *valueIncrease=NULL, double *valueDecrease=NULL)
Dual ranging.
double * rowUpperWork_
Row upper bounds - working copy.
int barrier(bool crossover=true)
Solves using barrier (assumes you have good cholesky factor code).
int nonlinearSLP(int numberPasses, double deltaTolerance)
Solves nonlinear problem using SLP - may be used as crash for other algorithms when number of iterati...
bool startPermanentArrays()
Start or reset using maximumRows_ and Columns_ - true if change.
double theta_
Theta (pivot change)
void setPerturbed(int iSequence)
To say perturbed.
int numberChanged_
Can be used for count of changed costs (dual) or changed bounds (primal)
double sumDualInfeasibilities_
Sum of dual infeasibilities.
int pivot()
Pivot in a variable and out a variable.
void setRowLower(int elementIndex, double elementValue)
Set a single row lower bound Use -DBL_MAX for -infinity.
void setPivoted(int sequence)
void setSparseFactorization(bool value)
int factorizationFrequency() const
Factorization frequency.
int lastGoodIteration_
Last good iteration (immediately after a re-factorization)
ClpFactorization * factorization() const
factorization
ClpPrimalColumnPivot * primalColumnPivot() const
primal column pivot choice
int numberColumns_
Number of columns.
double largestDualError() const
Largest error on basic duals.
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).
void solveFromHotStart(void *saveStuff)
Optimize starting from the hotstart.
double * costRegion() const
int progressFlag() const
Progress flag - at present 0 bit says artificials out.
void checkPrimalSolution(const double *rowActivities=NULL, const double *columnActivies=NULL)
This sets largest infeasibility and most infeasible and sum and number of infeasibilities (Primal)
Abstract base class for Clp Matrices.
double * lowerRegion() const
int fathom(void *stuff)
Fathom - 1 if solution.
double infeasibilityCost() const
Infeasibility cost.
double dualBound() const
Dual bound.
void setFactorizationFrequency(int value)
double * upperRegion(int section) const
void markHotStart(void *&saveStuff)
Create a hotstart point of the optimization process.
double acceptablePivot_
Acceptable pivot value just after factorization.
double * costRegion(int section) const
int cleanFactorization(int ifValuesPass)
Get a clean factorization - i.e.
double moveTowardsPrimalFeasible()
Try simple crash like techniques to get closer to primal feasibility returns final sum of infeasibili...
void clearPerturbed(int iSequence)
int * pivotVariable_
Basic variables pivoting on which rows.
void setInitialDenseFactorization(bool onOff)
Normally the first factorization does sparse coding because the factorization could be singular.
double * perturbationArray_
Perturbation array (maximumPerturbationSize_)
double * cost_
Working copy of objective (Owner of arrays below)
double * upper_
Working copy of upper bounds (Owner of arrays below)
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 copyEnabledStuff(const ClpSimplex *rhs)
Copy across enabled stuff from one solver to another.
bool goodAccuracy() const
Returns true if model looks OK.
int numberDualInfeasibilities_
Number of dual infeasibilities.
void setTheta(double value)
Set theta of out variable.
Primal Column Pivot Abstract Base Class.
void setUpperOut(double value)
Set upper of out variable.
double * rowActivityWork_
Row activities - working copy.
double primalTolerance_
Current primal tolerance for algorithm.
void loadProblem(const int numcols, const int numrows, const CoinBigIndex *start, const int *index, const double *value, const double *collb, const double *colub, const double *obj, const double *rowlb, const double *rowub, const double *rowObjective=NULL)
Just like the other loadProblem() method except that the matrix is given in a standard column major o...
int initialSolve(ClpSolve &options)
General solve algorithm which can do presolve.
bool statusOfProblem(bool initial=false)
Factorizes and returns true if optimal.
ClpFactorization * getEmptyFactorization()
Gets clean and emptyish factorization.
void cleanStatus()
Clean up status.
double objectiveValue_
Objective value.
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 dualDebug(int ifValuesPass=0, int startFinishOptions=0)
void setColumnBounds(int elementIndex, double lower, double upper)
Set a single column lower and upper bound.
double originalLower(int iSequence) const
Return original lower bound.
double * reducedCostWork_
Possible scaled reduced costs.
int moreSpecialOptions() const
Return more special options 1 bit - if presolve says infeasible in ClpSolve return 2 bit - if presolv...
void getBInvCol(int col, double *vec)
Get a column of the basis inverse.
bool active(int iRow) const
double * rowObjectiveWork_
Row objective - working copy.
int startup(int ifValuesPass, int startFinishOptions=0)
Common bits of coding for dual and primal.
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).
double rawObjectiveValue() const
Raw objective value (so always minimize in primal)
ClpSimplex * baseModel_
A copy of model with certain state - normally without cuts.
double dualIn_
Reduced cost of In variable.
int loadProblem(CoinModel &modelObject, bool keepSolution=false)
This loads a model from a coinModel object - returns number of errors.
friend void ClpSimplexUnitTest(const std::string &mpsDir)
A function that tests the methods in the ClpSimplex class.
int numberRefinements_
How many iterative refinements to do.
double * columnLowerWork_
Column lower bounds - working copy.
int numberExtraRows() const
Number of extra rows.
double * infeasibilityRay(bool fullRay=false) const
Infeasibility/unbounded ray (NULL returned if none/wrong) Up to user to use delete [] on these arrays...
void setFlagged(int sequence)
To flag a variable (not inline to allow for column generation)
void createRim1(bool initial)
Does rows and columns.
int pivotRow() const
Pivot Row for use by classes e.g. steepestedge.
void setZeroTolerance(double value)
Set zero tolerance.
void unpackPacked(CoinIndexedVector *rowArray)
Unpacks one column of the matrix into indexed array as packed vector Uses sequenceIn_ Also applies sc...
int nonlinearSLP(int numberConstraints, ClpConstraint **constraints, int numberPasses, double deltaTolerance)
Solves problem with nonlinear constraints using SLP - may be used as crash for other algorithms when ...
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 sumDualInfeasibilities() const
Sum of dual infeasibilities.
ClpDisasterHandler * disasterHandler() const
Get disaster handler.
ClpFactorization * swapFactorization(ClpFactorization *factorization)
int sequenceWithin(int sequence) const
Returns sequence number within section.
int dualPivotResultPart1()
Pivot out a variable and choose an incoing one.
double * objectiveWork_
Column objective - working copy.
int algorithm() const
Current (or last) algorithm.
void setFakeBound(int sequence, FakeBound fakeBound)
double sumOfRelaxedPrimalInfeasibilities() const
Sum of relaxed primal infeasibilities.
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...
void setPivotRow(int value)
double solution(int sequence)
Return row or column values.
double bestObjectiveValue_
"Best" objective value
int dual(int ifValuesPass=0, int startFinishOptions=0)
Dual algorithm - see ClpSimplexDual.hpp for method.
void generateCpp(FILE *fp, bool defaultFactor=false)
Create C++ lines to get to current state.
int directionIn_
Direction of In, 1 going up, -1 going down, 0 not a clude.
double upper(int sequence)
double largestDualError_
Largest error on basic duals.
bool initialDenseFactorization() const
ClpDisasterHandler * disasterArea_
Disaster handler.
friend class OsiCLPSolverInterface
And OsiCLP.
double * djRegion(int section) const
void setObjectiveCoefficient(int elementIndex, double elementValue)
Set an objective function coefficient.
double sumPrimalInfeasibilities_
Sum of primal infeasibilities.
void setLastBadIteration(int value)
Set so we know when to be cautious.
ClpSimplexProgress progress_
For dealing with all issues of cycling etc.
void setValueOut(double value)
Set value of out variable.
void setRowSetBounds(const int *indexFirst, const int *indexLast, const double *boundList)
Set the bounds on a number of rows simultaneously
int dontFactorizePivots_
If may skip final factorize then allow up to this pivots (default 20)
void setAutomaticScaling(bool onOff)
void setSequenceIn(int sequence)
Set sequenceIn or Out.
bool perturbed(int iSequence) const
void setObjCoeff(int elementIndex, double elementValue)
Set an objective function coefficient.
void setAlgorithm(int value)
Set algorithm.
int numberFake_
Can be used for count of fake bounds (dual) or fake costs (primal)
double valueOut_
Value of Out variable.
void setDualOut(double value)
Set dual value of out variable.
ClpSimplex(bool emptyMessages=false)
Default constructor.
ClpDataSave saveData()
Save data.
int numberRefinements() const
How many iterative refinements to do.
bool isObjectiveLimitTestValid() const
Return true if the objective limit test can be relied upon.
double * rowLower_
Row lower.
ClpDualRowPivot * dualRowPivot() const
dual row pivot choice
int numberPrimalInfeasibilities() const
Number of primal infeasibilities.
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...
bool dualFeasible() const
If problem is dual feasible.
double dualIn() const
Reduced cost of last incoming for use by classes e.g. steepestedge.
unsigned char * status_
Status (i.e.
void setDualIn(double value)
Set reduced cost of last incoming to force error.
double alpha() const
Alpha (pivot element) for use by classes e.g. steepestedge.
int housekeeping(double objectiveChange)
This does basis housekeeping and does values for in/out variables.
double lower(int sequence)
void setNumberDualInfeasibilities(int value)
void createRim5(bool initial)
Does rows and columns and objective.
void setToBaseModel(ClpSimplex *model=NULL)
Reset to base model (just size and arrays needed) If model NULL use internal copy.
void setColumnStatus(int sequence, Status newstatus)
void gutsOfDelete(int type)
Does most of deletion (0 = all, 1 = most, 2 most + factorization)
void checkSolutionInternal()
Just check solution (for internal use) - sets sum of infeasibilities etc.
void getBInvRow(int row, double *z)
Get a row of the basis inverse.
double sumOfRelaxedDualInfeasibilities() const
Sum of relaxed dual infeasibilities.
Dual Row Pivot Abstract Base Class.
double currentPrimalTolerance() const
Current primal tolerance.
double dualTolerance_
Current dual tolerance for algorithm.
void setEmptyFactorization()
May delete or may make clean and emptyish factorization.
double cost(int sequence)
void forceFactorization(int value)
Force re-factorization early.
int getSolution()
Given an existing factorization computes and checks primal and dual solutions.
void finish(int startFinishOptions=0)
ClpSimplex * fastCrunch(ClpNodeStuff *stuff, int mode)
Deals with crunch aspects mode 0 - in 1 - out with solution 2 - out without solution returns small mo...
int primalRanging(int numberCheck, const int *which, double *valueIncrease, int *sequenceIncrease, double *valueDecrease, int *sequenceDecrease)
Primal ranging.
void miniPostsolve(const ClpSimplex *presolvedModel, void *info)
After mini presolve.
int primalPivotResult()
Pivot in a variable and choose an outgoing one.
void restoreData(ClpDataSave saved)
Restore data.
double valueOut() const
Value of Out variable.
void computeObjectiveValue(bool useWorkingSolution=false)
Compute objective value from solution and put in objectiveValue_.
ClpEventHandler * eventHandler() const
Event handler.
Base class for Clp event handling.
int numberColumns() const
int numberDualInfeasibilities() const
Number of dual infeasibilities.
void setColUpper(int elementIndex, double elementValue)
Set a single column upper bound Use DBL_MAX for infinity.
ClpDualRowPivot * dualRowPivot_
dual row pivot choice
void checkBothSolutions()
This sets sum and number of infeasibilities (Dual and Primal)
double * solution_
Working copy of primal solution (Owner of arrays below)
void createStatus()
Set up status array (can be used by OsiClp).
ClpSimplex * miniPresolve(char *rowType, char *columnType, void **info)
Mini presolve (faster) Char arrays must be numberRows and numberColumns long on entry second part mus...
double allowedInfeasibility_
void setLowerOut(double value)
Set lower of out variable.
double & reducedCostAddress(int sequence)
void stopFastDual2(ClpNodeStuff *stuff)
Stops Fast dual2.
int cleanup(int cleanupScaling)
When scaling is on it is possible that the scaled problem is feasible but the unscaled is not.
int gutsOfSolution(double *givenDuals, const double *givenPrimals, bool valuesPass=false)
May change basis and then returns number changed.
int sequenceOut_
Sequence of Out variable.
double * rowReducedCost_
Reduced costs of slacks not same as duals (or - duals)
void setDualBound(double value)
void defaultFactorizationFrequency()
If user left factorization frequency then compute.
double largestPrimalError() const
Largest error on Ax-b.
void setRowUpper(int elementIndex, double elementValue)
Set a single row upper bound Use DBL_MAX for infinity.
void computeDuals(double *givenDjs)
Computes duals from scratch.
void originalModel(ClpSimplex *miniModel)
This copies back stuff from miniModel and then deletes miniModel.
int internalFactorize(int solveType)
Factorizes using current basis.
void borrowModel(ClpSimplex &otherModel)
int reducedGradient(int phase=0)
Solves non-linear using reduced gradient.
double originalUpper(int iSequence) const
Return original lower bound.
int initialSolve()
Default initial solve.
double * lowerRegion(int section) const
void setRowStatus(int sequence, Status newstatus)
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 numberExtraRows_
Number of extra rows.
ClpNonLinearCost * nonLinearCost_
Very wasteful way of dealing with infeasibilities in primal.
double largeValue() const
Large bound value (for complementarity etc)
double largestPrimalError_
Largest error on Ax-b.
double infeasibilityCost_
Weight assigned to being infeasible in primal.
double scaleObjective(double value)
If input negative scales objective so maximum <= -value and returns scale factor used.
void clearFlagged(int sequence)
int numberDegeneratePivots_
Number of degenerate pivots since last perturbed.
void setNumberPrimalInfeasibilities(int value)
void setRowBounds(int elementIndex, double lower, double upper)
Set a single row lower and upper bound.
ClpSimplex(ClpSimplex *wholeModel, int numberColumns, const int *whichColumns)
This constructor modifies original ClpSimplex and stores original stuff in created ClpSimplex.
double incomingInfeasibility_
For advanced use.
int factorize()
Factorizes using current basis. For external use.
void setDirectionIn(int direction)
Set directionIn or Out.
CoinIndexedVector * rowArray_[6]
Useful row length arrays.
void getBInvACol(int col, double *vec)
Get a column of the tableau.
int forceFactorization() const
Force re-factorization early value.
void setSumOfRelaxedDualInfeasibilities(double value)
void removeSuperBasicSlacks(int threshold=0)
Try simple crash like techniques to remove super basic slacks but only if > threshold.
int lastFlaggedIteration_
So we know when to open up again.
void setPrimalColumnPivotAlgorithm(ClpPrimalColumnPivot &choice)
Sets column pivot choice algorithm in primal.
ClpSimplex * baseModel() const
See if we have base model.
void getbackSolution(const ClpSimplex &smallModel, const int *whichRow, const int *whichColumn)
Puts solution back into small model.
FakeBound getFakeBound(int sequence) const
void resize(int newNumberRows, int newNumberColumns)
Resizes rim part of model.
double lowerOut_
Lower Bound on Out variable.
void checkUnscaledSolution()
Check unscaled primal solution but allow for rounding error.
void makeBaseModel()
Save a copy of model with certain state - normally without cuts.
double * savedSolution_
Saved version of solution.
void setSumOfRelaxedPrimalInfeasibilities(double value)
void setCurrentPrimalTolerance(double value)
bool flagged(int sequence) const
void setLargestPrimalError(double value)
Largest error on Ax-b.
double * rowLowerWork_
Row lower bounds - working copy.
double zeroTolerance() const
Get zero tolerance.
int numberRows() const
Number of rows.
ClpSimplexProgress * progress()
For dealing with all issues of cycling etc.
int pivotResultPart2(int algorithm, int state)
Do actual pivot state is 0 if need tableau column, 1 if in rowArray_[1].
double * rowUpper_
Row upper.
void dropNames()
Drops names - makes lengthnames 0 and names empty.
int changeMade_
If change has been made (first attempt at stopping looping)
int forceFactorization_
Now for some reliability aids This forces re-factorization early.
void unmarkHotStart(void *saveStuff)
Delete the snapshot.
double & solutionAddress(int sequence)
Return address of row or column values.
Status
enums for status of various sorts.
double * lower_
Working copy of lower bounds (Owner of arrays below)
void setNumberRefinements(int value)
void setCurrentDualTolerance(double value)
double alphaAccuracy_
For computing whether to re-factorize.
double spareDoubleArray_[4]
Spare double array for passing information [0]!=0 switches on.
double & upperAddress(int sequence)
Return address of row or column upper bound.