Loading...
Searching...
No Matches
ClpSimplex.hpp
Go to the documentation of this file.
/* $Id$ */
// Copyright (C) 2002, International Business Machines
// Corporation and others. All Rights Reserved.
// This code is licensed under the terms of the Eclipse Public License (EPL).
/*
Authors
John Forrest
*/
#ifndef ClpSimplex_H
#define ClpSimplex_H
#include <iostream>
#include <cfloat>
#include "ClpModel.hpp"
#include "ClpMatrixBase.hpp"
#include "ClpSolve.hpp"
#include "ClpConfig.h"
#include "CoinIndexedVector.hpp"
class ClpDualRowPivot;
class ClpPrimalColumnPivot;
class ClpFactorization;
class CoinFactorization;
class CoinIndexedVector;
class ClpNonLinearCost;
class ClpNodeStuff;
class CoinStructuredModel;
class OsiClpSolverInterface;
class CoinWarmStartBasis;
class ClpDisasterHandler;
class ClpConstraint;
/*
May want to use Clp defaults so that with ABC defined but not used
it behaves as Clp (and ABC used will be different than if not defined)
*/
#ifdef ABC_INHERIT
#ifndef CLP_INHERIT_MODE
#define CLP_INHERIT_MODE 1
#endif
#ifndef ABC_CLP_DEFAULTS
#define ABC_CLP_DEFAULTS 0
#endif
#else
#undef ABC_CLP_DEFAULTS
#define ABC_CLP_DEFAULTS 1
#endif
#ifdef CLP_HAS_ABC
#include "AbcCommon.hpp"
class AbcTolerancesEtc;
class AbcSimplex;
#include "CoinAbcCommon.hpp"
#endif
#ifndef ABC_INHERIT
#if ABOCA_LITE
#ifndef FAKE_CILK
#include <cilk/cilk.h>
#else
#undef cilk_for
#undef cilk_spawn
#undef cilk_sync
#define cilk_for for
#define cilk_spawn
#define cilk_sync
#endif
#ifndef LONG_REGION_2
#define LONG_REGION_2 1
#endif
#define SHORT_REGION 1
#else
#define cilk_spawn
#define cilk_sync
#endif
#ifdef LONG_REGION_2
#define SHORT_REGION 1
#else
#define SHORT_REGION 2
#endif
// for now keep simple
#undef LONG_REGION_2
#undef SHORT_REGION
#define SHORT_REGION 2
#else
//ABC_INHERIT
#define LONG_REGION_2 1
#define SHORT_REGION 1
#endif
class ClpSimplex : public ClpModel {
friend void ClpSimplexUnitTest(const std::string &mpsDir);
public:
enum Status {
isFree = 0x00,
basic = 0x01,
atUpperBound = 0x02,
atLowerBound = 0x03,
superBasic = 0x04,
isFixed = 0x05
};
// For Dual
enum FakeBound {
noFake = 0x00,
lowerFake = 0x01,
upperFake = 0x02,
bothFake = 0x03
};
ClpSimplex(bool emptyMessages = false);
ClpSimplex(const ClpSimplex &rhs, int scalingMode = -1);
ClpSimplex(const ClpModel &rhs, int scalingMode = -1);
ClpSimplex(const ClpModel *wholeModel,
int numberRows, const int *whichRows,
int numberColumns, const int *whichColumns,
bool dropNames = true, bool dropIntegers = true,
bool fixOthers = false);
ClpSimplex(const ClpSimplex *wholeModel,
int numberRows, const int *whichRows,
int numberColumns, const int *whichColumns,
bool dropNames = true, bool dropIntegers = true,
bool fixOthers = false);
ClpSimplex(ClpSimplex *wholeModel,
int numberColumns, const int *whichColumns);
void originalModel(ClpSimplex *miniModel);
#ifdef ABC_INHERIT
inline int abcState() const
{
return abcState_;
}
inline void setAbcState(int state)
{
abcState_ = state;
}
inline AbcSimplex *abcSimplex() const
{
return abcSimplex_;
}
inline void setAbcSimplex(AbcSimplex *simplex)
{
abcSimplex_ = simplex;
}
int doAbcDual();
int doAbcPrimal(int ifValuesPass);
#endif
void setPersistenceFlag(int value);
void makeBaseModel();
void deleteBaseModel();
inline ClpSimplex *baseModel() const
{
return baseModel_;
}
void setToBaseModel(ClpSimplex *model = NULL);
ClpSimplex &operator=(const ClpSimplex &rhs);
~ClpSimplex();
// Ones below are just ClpModel with some changes
void loadProblem(const ClpMatrixBase &matrix,
const double *collb, const double *colub,
const double *obj,
const double *rowlb, const double *rowub,
const double *rowObjective = NULL);
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 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);
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);
int loadProblem(CoinModel &modelObject, bool keepSolution = false);
int readMps(const char *filename,
bool keepNames = false,
bool ignoreErrors = false);
int readGMPL(const char *filename, const char *dataName,
bool keepNames = false);
int readLp(const char *filename, const double epsilon = 1e-5);
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;
void borrowModel(ClpModel &otherModel);
void borrowModel(ClpSimplex &otherModel);
void passInEventHandler(const ClpEventHandler *eventHandler);
void getbackSolution(const ClpSimplex &smallModel, const int *whichRow, const int *whichColumn);
int loadNonLinear(void *info, int &numberConstraints,
ClpConstraint **&constraints);
#ifdef ABC_INHERIT
void loadTolerancesEtc(const AbcTolerancesEtc &data);
void unloadTolerancesEtc(AbcTolerancesEtc &data);
#endif
int initialSolve(ClpSolve &options);
int initialSolve();
int initialDualSolve();
int initialPrimalSolve();
int initialBarrierSolve();
int initialBarrierNoCrossSolve();
int dual(int ifValuesPass = 0, int startFinishOptions = 0);
// If using Debug
int dualDebug(int ifValuesPass = 0, int startFinishOptions = 0);
int primal(int ifValuesPass = 0, int startFinishOptions = 0);
int nonlinearSLP(int numberPasses, double deltaTolerance);
int nonlinearSLP(int numberConstraints, ClpConstraint **constraints,
int numberPasses, double deltaTolerance);
int barrier(bool crossover = true);
int reducedGradient(int phase = 0);
int solve(CoinStructuredModel *model);
#ifdef ABC_INHERIT
AbcSimplex *dealWithAbc(int solveType, int startUp, bool interrupt = false);
//void dealWithAbc(int solveType,int startUp,bool interrupt=false);
#endif
int loadProblem(CoinStructuredModel &modelObject,
bool originalOrder = true, bool keepSolution = false);
int cleanup(int cleanupScaling);
int cleanPrimalSolution(double exactMultiple);
int dualRanging(int numberCheck, const int *which,
double *costIncrease, int *sequenceIncrease,
double *costDecrease, int *sequenceDecrease,
double *valueIncrease = NULL, double *valueDecrease = NULL);
int primalRanging(int numberCheck, const int *which,
double *valueIncrease, int *sequenceIncrease,
double *valueDecrease, int *sequenceDecrease);
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);
int outDuplicateRows(int numberLook, int *whichRows, bool noOverlaps = false, double tolerance = -1.0,
double cleanUp = 0.0);
double moveTowardsPrimalFeasible();
void removeSuperBasicSlacks(int threshold = 0);
ClpSimplex *miniPresolve(char *rowType, char *columnType, void **info);
void miniPostsolve(const ClpSimplex *presolvedModel, void *info);
void miniSolve(char *rowType, char *columnType, int algorithm, int startUp);
int writeBasis(const char *filename,
bool writeValues = false,
int formatType = 0) const;
int readBasis(const char *filename);
CoinWarmStartBasis *getBasis() const;
void setFactorization(ClpFactorization &factorization);
// Swaps factorization
ClpFactorization *swapFactorization(ClpFactorization *factorization);
void copyFactorization(ClpFactorization &factorization);
int tightenPrimalBounds(double factor = 0.0, int doTight = 0, bool tightIntegers = false);
int crash(double gap, int pivot);
void setDualRowPivotAlgorithm(ClpDualRowPivot &choice);
void setPrimalColumnPivotAlgorithm(ClpPrimalColumnPivot &choice);
void markHotStart(void *&saveStuff);
void solveFromHotStart(void *saveStuff);
void unmarkHotStart(void *saveStuff);
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);
int fathom(void *stuff);
int fathomMany(void *stuff);
double doubleCheck();
int startFastDual2(ClpNodeStuff *stuff);
int fastDual2(ClpNodeStuff *stuff);
void stopFastDual2(ClpNodeStuff *stuff);
ClpSimplex *fastCrunch(ClpNodeStuff *stuff, int mode);
int pivot();
int primalPivotResult();
int dualPivotResultPart1();
int pivotResultPart2(int algorithm, int state);
int startup(int ifValuesPass, int startFinishOptions = 0);
void finish(int startFinishOptions = 0);
bool statusOfProblem(bool initial = false);
void defaultFactorizationFrequency();
void copyEnabledStuff(const ClpSimplex *rhs);
inline bool primalFeasible() const
{
return (numberPrimalInfeasibilities_ == 0);
}
inline bool dualFeasible() const
{
return (numberDualInfeasibilities_ == 0);
}
inline ClpFactorization *factorization() const
{
return factorization_;
}
bool sparseFactorization() const;
void setSparseFactorization(bool value);
int factorizationFrequency() const;
void setFactorizationFrequency(int value);
inline double dualBound() const
{
return dualBound_;
}
void setDualBound(double value);
inline double infeasibilityCost() const
{
return infeasibilityCost_;
}
void setInfeasibilityCost(double value);
inline int perturbation() const
{
return perturbation_;
}
void setPerturbation(int value);
inline int algorithm() const
{
return algorithm_;
}
inline void setAlgorithm(int value)
{
algorithm_ = value;
}
bool isObjectiveLimitTestValid() const;
inline double sumDualInfeasibilities() const
{
return sumDualInfeasibilities_;
}
inline void setSumDualInfeasibilities(double value)
{
sumDualInfeasibilities_ = value;
}
inline double sumOfRelaxedDualInfeasibilities() const
{
return sumOfRelaxedDualInfeasibilities_;
}
inline void setSumOfRelaxedDualInfeasibilities(double value)
{
sumOfRelaxedDualInfeasibilities_ = value;
}
inline int numberDualInfeasibilities() const
{
return numberDualInfeasibilities_;
}
inline void setNumberDualInfeasibilities(int value)
{
numberDualInfeasibilities_ = value;
}
inline int numberDualInfeasibilitiesWithoutFree() const
{
return numberDualInfeasibilitiesWithoutFree_;
}
inline double sumPrimalInfeasibilities() const
{
return sumPrimalInfeasibilities_;
}
inline void setSumPrimalInfeasibilities(double value)
{
sumPrimalInfeasibilities_ = value;
}
inline double sumOfRelaxedPrimalInfeasibilities() const
{
return sumOfRelaxedPrimalInfeasibilities_;
}
inline void setSumOfRelaxedPrimalInfeasibilities(double value)
{
sumOfRelaxedPrimalInfeasibilities_ = value;
}
inline int numberPrimalInfeasibilities() const
{
return numberPrimalInfeasibilities_;
}
inline void setNumberPrimalInfeasibilities(int value)
{
numberPrimalInfeasibilities_ = value;
}
int saveModel(const char *fileName);
int restoreModel(const char *fileName);
void checkSolution(int setToBounds = 0);
void checkSolutionInternal();
void checkUnscaledSolution();
inline CoinIndexedVector *rowArray(int index) const
{
return rowArray_[index];
}
inline CoinIndexedVector *columnArray(int index) const
{
return columnArray_[index];
}
/******************** End of most useful part **************/
int getSolution(const double *rowActivities,
const double *columnActivities);
int getSolution();
int createPiecewiseLinearCosts(const int *starts,
const double *lower, const double *gradient);
inline ClpDualRowPivot *dualRowPivot() const
{
return dualRowPivot_;
}
inline ClpPrimalColumnPivot *primalColumnPivot() const
{
return primalColumnPivot_;
}
inline bool goodAccuracy() const
{
return (largestPrimalError_ < 1.0e-7 && largestDualError_ < 1.0e-7);
}
void returnModel(ClpSimplex &otherModel);
int internalFactorize(int solveType);
ClpDataSave saveData();
void restoreData(ClpDataSave saved);
void cleanStatus();
int factorize();
void computeDuals(double *givenDjs);
void computePrimals(const double *rowActivities,
const double *columnActivities);
void add(double *array,
int column, double multiplier) const;
void unpack(CoinIndexedVector *rowArray) const;
void unpack(CoinIndexedVector *rowArray, int sequence) const;
void unpackPacked(CoinIndexedVector *rowArray);
void unpackPacked(CoinIndexedVector *rowArray, int sequence);
#ifndef CLP_USER_DRIVEN
protected:
#endif
int housekeeping(double objectiveChange);
void checkPrimalSolution(const double *rowActivities = NULL,
const double *columnActivies = NULL);
void checkDualSolution();
void checkBothSolutions();
double scaleObjective(double value);
int solveDW(CoinStructuredModel *model, ClpSolve &options);
int solveBenders(CoinStructuredModel *model, ClpSolve &options);
public:
void setValuesPassAction(double incomingInfeasibility,
double allowedInfeasibility);
int cleanFactorization(int ifValuesPass);
public:
inline double alphaAccuracy() const
{
return alphaAccuracy_;
}
inline void setAlphaAccuracy(double value)
{
alphaAccuracy_ = value;
}
public:
//inline double objectiveValue() const {
//return (objectiveValue_-bestPossibleImprovement_)*optimizationDirection_ - dblParam_[ClpObjOffset];
//}
inline void setDisasterHandler(ClpDisasterHandler *handler)
{
disasterArea_ = handler;
}
inline ClpDisasterHandler *disasterHandler() const
{
return disasterArea_;
}
inline double largeValue() const
{
return largeValue_;
}
void setLargeValue(double value);
inline double largestPrimalError() const
{
return largestPrimalError_;
}
inline double largestDualError() const
{
return largestDualError_;
}
inline void setLargestPrimalError(double value)
{
largestPrimalError_ = value;
}
inline void setLargestDualError(double value)
{
largestDualError_ = value;
}
inline double zeroTolerance() const
{
return zeroTolerance_; /*factorization_->zeroTolerance();*/
}
inline void setZeroTolerance(double value)
{
zeroTolerance_ = value;
}
inline int *pivotVariable() const
{
return pivotVariable_;
}
inline bool automaticScaling() const
{
return automaticScale_ != 0;
}
inline void setAutomaticScaling(bool onOff)
{
automaticScale_ = onOff ? 1 : 0;
}
inline double currentDualTolerance() const
{
return dualTolerance_;
}
inline void setCurrentDualTolerance(double value)
{
dualTolerance_ = value;
}
inline double currentPrimalTolerance() const
{
return primalTolerance_;
}
inline void setCurrentPrimalTolerance(double value)
{
primalTolerance_ = value;
}
inline int numberRefinements() const
{
return numberRefinements_;
}
void setNumberRefinements(int value);
inline double alpha() const
{
return alpha_;
}
inline void setAlpha(double value)
{
alpha_ = value;
}
inline double dualIn() const
{
return dualIn_;
}
inline void setDualIn(double value)
{
dualIn_ = value;
}
inline int pivotRow() const
{
return pivotRow_;
}
inline void setPivotRow(int value)
{
pivotRow_ = value;
}
double valueIncomingDual() const;
#ifndef CLP_USER_DRIVEN
protected:
#endif
int gutsOfSolution(double *givenDuals,
const double *givenPrimals,
bool valuesPass = false);
void gutsOfDelete(int type);
void gutsOfCopy(const ClpSimplex &rhs);
bool createRim(int what, bool makeRowCopy = false, int startFinishOptions = 0);
void createRim1(bool initial);
void createRim4(bool initial);
void createRim5(bool initial);
void deleteRim(int getRidOfFactorizationData = 2);
bool sanityCheck();
public:
inline double *solutionRegion(int section) const
{
if (!section)
return rowActivityWork_;
else
return columnActivityWork_;
}
inline double *djRegion(int section) const
{
if (!section)
return rowReducedCost_;
else
return reducedCostWork_;
}
inline double *lowerRegion(int section) const
{
if (!section)
return rowLowerWork_;
else
return columnLowerWork_;
}
inline double *upperRegion(int section) const
{
if (!section)
return rowUpperWork_;
else
return columnUpperWork_;
}
inline double *costRegion(int section) const
{
if (!section)
return rowObjectiveWork_;
else
return objectiveWork_;
}
inline double *solutionRegion() const
{
return solution_;
}
inline double *djRegion() const
{
return dj_;
}
inline double *lowerRegion() const
{
return lower_;
}
inline double *upperRegion() const
{
return upper_;
}
inline double *costRegion() const
{
return cost_;
}
inline Status getStatus(int sequence) const
{
return static_cast< Status >(status_[sequence] & 7);
}
inline void setStatus(int sequence, Status newstatus)
{
unsigned char &st_byte = status_[sequence];
st_byte = static_cast< unsigned char >(st_byte & ~7);
st_byte = static_cast< unsigned char >(st_byte | newstatus);
}
bool startPermanentArrays();
void setInitialDenseFactorization(bool onOff);
bool initialDenseFactorization() const;
inline int sequenceIn() const
{
return sequenceIn_;
}
inline int sequenceOut() const
{
return sequenceOut_;
}
inline void setSequenceIn(int sequence)
{
sequenceIn_ = sequence;
}
inline void setSequenceOut(int sequence)
{
sequenceOut_ = sequence;
}
inline int directionIn() const
{
return directionIn_;
}
inline int directionOut() const
{
return directionOut_;
}
inline void setDirectionIn(int direction)
{
directionIn_ = direction;
}
inline void setDirectionOut(int direction)
{
directionOut_ = direction;
}
inline double valueOut() const
{
return valueOut_;
}
inline double lowerOut() const
{
return lowerOut_;
}
inline double upperOut() const
{
return upperOut_;
}
inline void setValueOut(double value)
{
valueOut_ = value;
}
inline double dualOut() const
{
return dualOut_;
}
inline void setDualOut(double value)
{
dualOut_ = value;
}
inline void setLowerOut(double value)
{
lowerOut_ = value;
}
inline void setUpperOut(double value)
{
upperOut_ = value;
}
inline void setTheta(double value)
{
theta_ = value;
}
inline int isColumn(int sequence) const
{
return sequence < numberColumns_ ? 1 : 0;
}
inline int sequenceWithin(int sequence) const
{
return sequence < numberColumns_ ? sequence : sequence - numberColumns_;
}
inline double solution(int sequence)
{
return solution_[sequence];
}
inline double &solutionAddress(int sequence)
{
return solution_[sequence];
}
inline double reducedCost(int sequence)
{
return dj_[sequence];
}
inline double &reducedCostAddress(int sequence)
{
return dj_[sequence];
}
inline double lower(int sequence)
{
return lower_[sequence];
}
inline double &lowerAddress(int sequence)
{
return lower_[sequence];
}
inline double upper(int sequence)
{
return upper_[sequence];
}
inline double &upperAddress(int sequence)
{
return upper_[sequence];
}
inline double cost(int sequence)
{
return cost_[sequence];
}
inline double &costAddress(int sequence)
{
return cost_[sequence];
}
inline double originalLower(int iSequence) const
{
if (iSequence < numberColumns_)
return columnLower_[iSequence];
else
return rowLower_[iSequence - numberColumns_];
}
inline double originalUpper(int iSequence) const
{
if (iSequence < numberColumns_)
return columnUpper_[iSequence];
else
return rowUpper_[iSequence - numberColumns_];
}
inline double theta() const
{
return theta_;
}
inline double lowerIn() const
{
return lowerIn_;
}
inline double valueIn() const
{
return valueIn_;
}
inline double upperIn() const
{
return upperIn_;
}
inline double bestPossibleImprovement() const
{
return bestPossibleImprovement_;
}
inline ClpNonLinearCost *nonLinearCost() const
{
return nonLinearCost_;
}
void setNonLinearCost(ClpNonLinearCost &nonLinearCost);
inline int moreSpecialOptions() const
{
return moreSpecialOptions_;
}
inline int vectorMode() const
{
return vectorMode_;
}
inline void setMoreSpecialOptions(int value)
{
moreSpecialOptions_ = value;
}
inline void setVectorMode(int value)
{
vectorMode_ = value;
}
inline void setFakeBound(int sequence, FakeBound fakeBound)
{
unsigned char &st_byte = status_[sequence];
st_byte = static_cast< unsigned char >(st_byte & ~24);
st_byte = static_cast< unsigned char >(st_byte | (fakeBound << 3));
}
inline FakeBound getFakeBound(int sequence) const
{
return static_cast< FakeBound >((status_[sequence] >> 3) & 3);
}
inline void setRowStatus(int sequence, Status newstatus)
{
unsigned char &st_byte = status_[sequence + numberColumns_];
st_byte = static_cast< unsigned char >(st_byte & ~7);
st_byte = static_cast< unsigned char >(st_byte | newstatus);
}
inline Status getRowStatus(int sequence) const
{
return static_cast< Status >(status_[sequence + numberColumns_] & 7);
}
inline void setColumnStatus(int sequence, Status newstatus)
{
unsigned char &st_byte = status_[sequence];
st_byte = static_cast< unsigned char >(st_byte & ~7);
st_byte = static_cast< unsigned char >(st_byte | newstatus);
}
inline Status getColumnStatus(int sequence) const
{
return static_cast< Status >(status_[sequence] & 7);
}
inline void setPivoted(int sequence)
{
status_[sequence] = static_cast< unsigned char >(status_[sequence] | 32);
}
inline void clearPivoted(int sequence)
{
status_[sequence] = static_cast< unsigned char >(status_[sequence] & ~32);
}
inline bool pivoted(int sequence) const
{
return (((status_[sequence] >> 5) & 1) != 0);
}
void setFlagged(int sequence);
inline void clearFlagged(int sequence)
{
status_[sequence] = static_cast< unsigned char >(status_[sequence] & ~64);
}
inline bool flagged(int sequence) const
{
return ((status_[sequence] & 64) != 0);
}
inline void setActive(int iRow)
{
status_[iRow] = static_cast< unsigned char >(status_[iRow] | 128);
}
inline void clearActive(int iRow)
{
status_[iRow] = static_cast< unsigned char >(status_[iRow] & ~128);
}
inline bool active(int iRow) const
{
return ((status_[iRow] & 128) != 0);
}
inline void setPerturbed(int iSequence)
{
status_[iSequence] = static_cast< unsigned char >(status_[iSequence] | 128);
}
inline void clearPerturbed(int iSequence)
{
status_[iSequence] = static_cast< unsigned char >(status_[iSequence] & ~128);
}
inline bool perturbed(int iSequence) const
{
return ((status_[iSequence] & 128) != 0);
}
void createStatus();
void allSlackBasis(bool resetSolution = false);
inline int lastBadIteration() const
{
return lastBadIteration_;
}
inline void setLastBadIteration(int value)
{
lastBadIteration_ = value;
}
inline int progressFlag() const
{
return (progressFlag_ & 3);
}
inline ClpSimplexProgress *progress()
{
return &progress_;
}
inline int forceFactorization() const
{
return forceFactorization_;
}
inline void forceFactorization(int value)
{
forceFactorization_ = value;
}
inline double rawObjectiveValue() const
{
return objectiveValue_;
}
void computeObjectiveValue(bool useWorkingSolution = false);
double computeInternalObjectiveValue();
double *infeasibilityRay(bool fullRay = false) const;
inline int numberExtraRows() const
{
return numberExtraRows_;
}
inline int maximumBasic() const
{
return maximumBasic_;
}
inline int baseIteration() const
{
return baseIteration_;
}
void generateCpp(FILE *fp, bool defaultFactor = false);
ClpFactorization *getEmptyFactorization();
void setEmptyFactorization();
void moveInfo(const ClpSimplex &rhs, bool justStatus = false);
// These are only to be used using startFinishOptions (ClpSimplexDual, ClpSimplexPrimal)
// *** At present only without scaling
// *** Slacks havve -1.0 element (so == row activity) - take care
void getBInvARow(int row, double *z, double *slack = NULL);
void getBInvRow(int row, double *z);
void getBInvACol(int col, double *vec);
void getBInvCol(int col, double *vec);
void getBasics(int *index);
//-------------------------------------------------------------------------
void setObjectiveCoefficient(int elementIndex, double elementValue);
inline void setObjCoeff(int elementIndex, double elementValue)
{
setObjectiveCoefficient(elementIndex, elementValue);
}
void setColumnLower(int elementIndex, double elementValue);
void setColumnUpper(int elementIndex, double elementValue);
void setColumnBounds(int elementIndex,
double lower, double upper);
void setColumnSetBounds(const int *indexFirst,
const int *indexLast,
const double *boundList);
inline void setColLower(int elementIndex, double elementValue)
{
setColumnLower(elementIndex, elementValue);
}
inline void setColUpper(int elementIndex, double elementValue)
{
setColumnUpper(elementIndex, elementValue);
}
inline void setColBounds(int elementIndex,
double newlower, double newupper)
{
setColumnBounds(elementIndex, newlower, newupper);
}
inline void setColSetBounds(const int *indexFirst,
const int *indexLast,
const double *boundList)
{
setColumnSetBounds(indexFirst, indexLast, boundList);
}
void setRowLower(int elementIndex, double elementValue);
void setRowUpper(int elementIndex, double elementValue);
void setRowBounds(int elementIndex,
double lower, double upper);
void setRowSetBounds(const int *indexFirst,
const int *indexLast,
const double *boundList);
void resize(int newNumberRows, int newNumberColumns);
protected:
double bestPossibleImprovement_;
double zeroTolerance_;
int columnPrimalSequence_;
int rowPrimalSequence_;
double bestObjectiveValue_;
int moreSpecialOptions_;
int baseIteration_;
int vectorMode_;
double primalToleranceToGetOptimal_;
double largeValue_;
double largestPrimalError_;
double largestDualError_;
double alphaAccuracy_;
double dualBound_;
double alpha_;
double theta_;
double lowerIn_;
double valueIn_;
double upperIn_;
double dualIn_;
double lowerOut_;
double valueOut_;
double upperOut_;
double dualOut_;
double dualTolerance_;
double primalTolerance_;
double sumDualInfeasibilities_;
double sumPrimalInfeasibilities_;
double infeasibilityCost_;
double sumOfRelaxedDualInfeasibilities_;
double sumOfRelaxedPrimalInfeasibilities_;
double acceptablePivot_;
double minimumPrimalTolerance_;
#define CLP_INFEAS_SAVE 5
double averageInfeasibility_[CLP_INFEAS_SAVE];
double *lower_;
double *rowLowerWork_;
double *columnLowerWork_;
double *upper_;
double *rowUpperWork_;
double *columnUpperWork_;
double *cost_;
double *rowObjectiveWork_;
double *objectiveWork_;
CoinIndexedVector *rowArray_[6];
CoinIndexedVector *columnArray_[6];
int sequenceIn_;
int directionIn_;
int sequenceOut_;
int directionOut_;
int pivotRow_;
int lastGoodIteration_;
double *dj_;
double *rowReducedCost_;
double *reducedCostWork_;
double *solution_;
double *rowActivityWork_;
double *columnActivityWork_;
int numberDualInfeasibilities_;
int numberDualInfeasibilitiesWithoutFree_;
int numberPrimalInfeasibilities_;
int numberRefinements_;
ClpDualRowPivot *dualRowPivot_;
ClpPrimalColumnPivot *primalColumnPivot_;
int *pivotVariable_;
ClpFactorization *factorization_;
double *savedSolution_;
int numberTimesOptimal_;
ClpDisasterHandler *disasterArea_;
int changeMade_;
int algorithm_;
int forceFactorization_;
int perturbation_;
unsigned char *saveStatus_;
ClpNonLinearCost *nonLinearCost_;
int lastBadIteration_;
int lastFlaggedIteration_;
int numberFake_;
int numberChanged_;
int progressFlag_;
int firstFree_;
int numberExtraRows_;
int maximumBasic_;
int dontFactorizePivots_;
double incomingInfeasibility_;
double allowedInfeasibility_;
int automaticScale_;
int maximumPerturbationSize_;
double *perturbationArray_;
ClpSimplex *baseModel_;
ClpSimplexProgress progress_;
#ifdef ABC_INHERIT
AbcSimplex *abcSimplex_;
int abcState_;
#define CLP_ABC_WANTED 1
#define CLP_ABC_WANTED_PARALLEL 2
#define CLP_ABC_FULL_DONE 8
// bits 256,512,1024 for crash
#endif
#define CLP_ABC_BEEN_FEASIBLE 65536
int numberDegeneratePivots_;
public:
mutable int spareIntArray_[4];
mutable double spareDoubleArray_[4];
protected:
friend class OsiClpSolverInterface;
friend class OsiCLPSolverInterface;
};
//#############################################################################
void ClpSimplexUnitTest(const std::string &mpsDir);
// For Devex stuff
#define DEVEX_TRY_NORM 1.0e-4
#define DEVEX_ADD_ONE 1.0
#if defined(ABC_INHERIT) || defined(THREADS_IN_ANALYZE)
// Use pthreads
#include <pthread.h>
typedef struct {
double result;
//const CoinIndexedVector * constVector; // can get rid of
//CoinIndexedVector * vectors[2]; // can get rid of
void *extraInfo;
void *extraInfo2;
int status;
int stuff[4];
} CoinThreadInfo;
class CoinPthreadStuff {
public:
CoinPthreadStuff(int numberThreads = 0,
void *parallelManager(void *stuff) = NULL);
CoinPthreadStuff &operator=(const CoinPthreadStuff &rhs);
~CoinPthreadStuff();
inline void setStopStart(int value)
{
stopStart_ = value;
}
#ifndef NUMBER_THREADS
#define NUMBER_THREADS 8
#endif
// For waking up thread
inline pthread_mutex_t *mutexPointer(int which, int thread = 0)
{
return mutex_ + which + 3 * thread;
}
#ifdef PTHREAD_BARRIER_SERIAL_THREAD
inline pthread_barrier_t *barrierPointer()
{
return &barrier_;
}
#endif
inline int whichLocked(int thread = 0) const
{
return locked_[thread];
}
inline CoinThreadInfo *threadInfoPointer(int thread = 0)
{
return threadInfo_ + thread;
}
void startParallelTask(int type, int iThread, void *info = NULL);
int waitParallelTask(int type, int &iThread, bool allowIdle);
void waitAllTasks();
int whichThread() const;
void sayIdle(int iThread);
//void startThreads(int numberThreads);
//void stopThreads();
// For waking up thread
pthread_mutex_t mutex_[3 * (NUMBER_THREADS + 1)];
#ifdef PTHREAD_BARRIER_SERIAL_THREAD
pthread_barrier_t barrier_;
#endif
CoinThreadInfo threadInfo_[NUMBER_THREADS + 1];
pthread_t abcThread_[NUMBER_THREADS + 1];
int locked_[NUMBER_THREADS + 1];
int stopStart_;
int numberThreads_;
};
void *clp_parallelManager(void *stuff);
#endif
typedef struct {
double upperTheta;
double bestPossible;
double acceptablePivot;
double tolerance;
double dualTolerance;
double theta;
double primalRatio;
double changeObj;
const double *COIN_RESTRICT cost;
double *COIN_RESTRICT solution;
double *COIN_RESTRICT reducedCost;
const double *COIN_RESTRICT lower;
const double *COIN_RESTRICT upper;
double *COIN_RESTRICT work;
int *COIN_RESTRICT index;
double *COIN_RESTRICT spare;
const unsigned char *COIN_RESTRICT status;
int *COIN_RESTRICT which;
double *COIN_RESTRICT infeas;
const int *COIN_RESTRICT pivotVariable;
const double *COIN_RESTRICT element;
const CoinBigIndex *COIN_RESTRICT start;
const int *COIN_RESTRICT row;
int numberAdded;
int numberInfeasibilities;
int numberRemaining;
int startColumn;
int numberToDo;
int numberColumns;
} clpTempInfo;
#ifndef ABC_INHERIT
#if ABOCA_LITE
void moveAndZero(clpTempInfo *info, int type, void *extra);
// 2 is owner of abcState_
#ifdef ABCSTATE_LITE
#if ABCSTATE_LITE == 2
int abcState_ = 0;
#else
extern int abcState_;
#endif
inline int abcState()
{
return abcState_;
}
inline void setAbcState(int state)
{
abcState_ = state;
}
#endif
#else
#define abcState 0
#endif
#endif
#ifdef CLP_USER_DRIVEN
// expand as needed
typedef struct {
double alpha;
double totalThru;
double rhs;
double value;
double lower;
double upper;
double cost;
int type;
int row;
int sequence;
int printing;
int change;
} clpUserStruct;
#endif
#endif
/* vi: softtabstop=2 shiftwidth=2 expandtab tabstop=2
*/
AbcCommon.hpp
NUMBER_THREADS
#define NUMBER_THREADS
Definition AbcSimplex.hpp:1028
AbcSimplex
#define AbcSimplex
Definition AbcWarmStart.hpp:16
type
CbcOrClpParameterType type() const
type
Definition CbcOrClpParam.hpp:462
operator=
CbcOrClpParam & operator=(const CbcOrClpParam &rhs)
Assignment operator. This copies the data.
ClpConfig.h
ClpMatrixBase.hpp
COIN_RESTRICT
#define COIN_RESTRICT
Definition ClpMatrixBase.hpp:21
ClpModel.hpp
ClpSimplexUnitTest
void ClpSimplexUnitTest(const std::string &mpsDir)
A function that tests the methods in the ClpSimplex class.
CLP_INFEAS_SAVE
#define CLP_INFEAS_SAVE
Last few infeasibilities.
Definition ClpSimplex.hpp:1818
abcState
#define abcState
Definition ClpSimplex.hpp:2114
ClpSolve.hpp
CoinAbcCommon.hpp
AbcTolerancesEtc
Definition CoinAbcCommon.hpp:254
ClpConstraint
Constraint Abstract Base Class.
Definition ClpConstraint.hpp:18
ClpDataSave
This is a tiny class where data can be saved round calls.
Definition ClpModel.hpp:1402
ClpDisasterHandler
Base class for Clp disaster handling.
Definition ClpEventHandler.hpp:138
ClpDualRowPivot
Dual Row Pivot Abstract Base Class.
Definition ClpDualRowPivot.hpp:22
ClpEventHandler
Base class for Clp event handling.
Definition ClpEventHandler.hpp:27
ClpFactorization
This just implements CoinFactorization when an ClpMatrixBase object is passed.
Definition ClpFactorization.hpp:38
ClpMatrixBase
Abstract base class for Clp Matrices.
Definition ClpMatrixBase.hpp:38
ClpModel::numberColumns_
int numberColumns_
Number of columns.
Definition ClpModel.hpp:1259
ClpModel::status_
unsigned char * status_
Status (i.e.
Definition ClpModel.hpp:1306
ClpModel::rowUpper_
double * rowUpper_
Row upper.
Definition ClpModel.hpp:1271
ClpModel::rowLower_
double * rowLower_
Row lower.
Definition ClpModel.hpp:1269
ClpModel::columnUpper_
double * columnUpper_
Column Upper.
Definition ClpModel.hpp:1279
ClpModel::rowObjective
double * rowObjective() const
Row Objective.
Definition ClpModel.hpp:746
ClpModel::numberColumns
int numberColumns() const
Definition ClpModel.hpp:332
ClpModel::numberRows
int numberRows() const
Number of rows.
Definition ClpModel.hpp:319
ClpModel::matrix
CoinPackedMatrix * matrix() const
Matrix (if not ClpPackedmatrix be careful about memory leak.
Definition ClpModel.hpp:773
ClpModel::objectiveValue_
double objectiveValue_
Objective value.
Definition ClpModel.hpp:1249
ClpModel::solveType
int solveType() const
Solve type - 1 simplex, 2 simplex interface, 3 Interior.
Definition ClpModel.hpp:391
ClpModel::ClpModel
ClpModel(bool emptyMessages=false)
Default constructor.
ClpModel::columnLower_
double * columnLower_
Column Lower.
Definition ClpModel.hpp:1277
ClpModel::eventHandler
ClpEventHandler * eventHandler() const
Event handler.
Definition ClpModel.hpp:1003
ClpModel::dropNames
void dropNames()
Drops names - makes lengthnames 0 and names empty.
ClpNodeStuff
Definition ClpNode.hpp:188
ClpNonLinearCost
Definition ClpNonLinearCost.hpp:77
ClpPrimalColumnPivot
Primal Column Pivot Abstract Base Class.
Definition ClpPrimalColumnPivot.hpp:25
ClpSimplexProgress
For saving extra information to see if looping.
Definition ClpSolve.hpp:310
ClpSimplex::directionOut
int directionOut() const
Definition ClpSimplex.hpp:1235
ClpSimplex::alpha
double alpha() const
Alpha (pivot element) for use by classes e.g. steepestedge.
Definition ClpSimplex.hpp:1061
ClpSimplex::ClpSimplexUnitTest
friend void ClpSimplexUnitTest(const std::string &mpsDir)
A function that tests the methods in the ClpSimplex class.
ClpSimplex::infeasibilityRay
double * infeasibilityRay(bool fullRay=false) const
Infeasibility/unbounded ray (NULL returned if none/wrong) Up to user to use delete [] on these arrays...
ClpSimplex::forceFactorization
void forceFactorization(int value)
Force re-factorization early.
Definition ClpSimplex.hpp:1581
ClpSimplex::upperIn_
double upperIn_
Upper Bound on In variable.
Definition ClpSimplex.hpp:1788
ClpSimplex::setRowSetBounds
void setRowSetBounds(const int *indexFirst, const int *indexLast, const double *boundList)
Set the bounds on a number of rows simultaneously .
ClpSimplex::setColLower
void setColLower(int elementIndex, double elementValue)
Set a single column lower bound Use -DBL_MAX for -infinity.
Definition ClpSimplex.hpp:1685
ClpSimplex::initialSolve
int initialSolve(ClpSolve &options)
General solve algorithm which can do presolve.
ClpSimplex::unpackPacked
void unpackPacked(CoinIndexedVector *rowArray)
Unpacks one column of the matrix into indexed array as packed vector Uses sequenceIn_ Also applies sc...
ClpSimplex::returnModel
void returnModel(ClpSimplex &otherModel)
Return model - updates any scalars.
ClpSimplex::cleanup
int cleanup(int cleanupScaling)
When scaling is on it is possible that the scaled problem is feasible but the unscaled is not.
ClpSimplex::sumDualInfeasibilities_
double sumDualInfeasibilities_
Sum of dual infeasibilities.
Definition ClpSimplex.hpp:1804
ClpSimplex::pivot
int pivot()
Pivot in a variable and out a variable.
ClpSimplex::setAutomaticScaling
void setAutomaticScaling(bool onOff)
Definition ClpSimplex.hpp:1032
ClpSimplex::setValueOut
void setValueOut(double value)
Set value of out variable.
Definition ClpSimplex.hpp:1264
ClpSimplex::upper
double upper(int sequence)
Definition ClpSimplex.hpp:1330
ClpSimplex::valueIn
double valueIn() const
Value of In variable.
Definition ClpSimplex.hpp:1375
ClpSimplex::algorithm
int algorithm() const
Current (or last) algorithm.
Definition ClpSimplex.hpp:720
ClpSimplex::createRim1
void createRim1(bool initial)
Does rows and columns.
ClpSimplex::loadProblem
int loadProblem(CoinModel &modelObject, bool keepSolution=false)
This loads a model from a coinModel object - returns number of errors.
ClpSimplex::baseIteration_
int baseIteration_
Iteration when we entered dual or primal.
Definition ClpSimplex.hpp:1764
ClpSimplex::writeBasis
int writeBasis(const char *filename, bool writeValues=false, int formatType=0) const
Write the basis in MPS format to the specified file.
ClpSimplex::ClpSimplex
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.
ClpSimplex::deleteBaseModel
void deleteBaseModel()
Switch off base model.
ClpSimplex::alpha_
double alpha_
Alpha (pivot element).
Definition ClpSimplex.hpp:1780
ClpSimplex::valueOut
double valueOut() const
Value of Out variable.
Definition ClpSimplex.hpp:1249
ClpSimplex::setFactorizationFrequency
void setFactorizationFrequency(int value)
ClpSimplex::largestPrimalError
double largestPrimalError() const
Largest error on Ax-b.
Definition ClpSimplex.hpp:993
ClpSimplex::lastFlaggedIteration_
int lastFlaggedIteration_
So we know when to open up again.
Definition ClpSimplex.hpp:1913
ClpSimplex::writeLp
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.
ClpSimplex::initialDualSolve
int initialDualSolve()
Dual initial solve.
ClpSimplex::removeSuperBasicSlacks
void removeSuperBasicSlacks(int threshold=0)
Try simple crash like techniques to remove super basic slacks but only if > threshold.
ClpSimplex::setSumOfRelaxedPrimalInfeasibilities
void setSumOfRelaxedPrimalInfeasibilities(double value)
Definition ClpSimplex.hpp:777
ClpSimplex::setAlphaAccuracy
void setAlphaAccuracy(double value)
Definition ClpSimplex.hpp:966
ClpSimplex::solve
int solve(CoinStructuredModel *model)
Solve using structure of model and maybe in parallel.
ClpSimplex::rowArray_
CoinIndexedVector * rowArray_[6]
Useful row length arrays.
Definition ClpSimplex.hpp:1839
ClpSimplex::setColumnUpper
void setColumnUpper(int elementIndex, double elementValue)
Set a single column upper bound Use DBL_MAX for infinity.
ClpSimplex::sumOfRelaxedPrimalInfeasibilities_
double sumOfRelaxedPrimalInfeasibilities_
Sum of Primal infeasibilities using tolerance based on error in primals.
Definition ClpSimplex.hpp:1812
ClpSimplex::stopFastDual2
void stopFastDual2(ClpNodeStuff *stuff)
Stops Fast dual2.
ClpSimplex::rowActivityWork_
double * rowActivityWork_
Row activities - working copy.
Definition ClpSimplex.hpp:1863
ClpSimplex::fathom
int fathom(void *stuff)
Fathom - 1 if solution.
ClpSimplex::startFastDual2
int startFastDual2(ClpNodeStuff *stuff)
Starts Fast dual2.
ClpSimplex::dualRowPivot_
ClpDualRowPivot * dualRowPivot_
dual row pivot choice
Definition ClpSimplex.hpp:1875
ClpSimplex::rowObjectiveWork_
double * rowObjectiveWork_
Row objective - working copy.
Definition ClpSimplex.hpp:1835
ClpSimplex::setColumnSetBounds
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...
ClpSimplex::setColumnBounds
void setColumnBounds(int elementIndex, double lower, double upper)
Set a single column lower and upper bound.
ClpSimplex::cost
double cost(int sequence)
Definition ClpSimplex.hpp:1339
ClpSimplex::setPersistenceFlag
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...
ClpSimplex::~ClpSimplex
~ClpSimplex()
Destructor.
ClpSimplex::loadNonLinear
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...
ClpSimplex::setActive
void setActive(int iRow)
To say row active in primal pivot row choice.
Definition ClpSimplex.hpp:1523
ClpSimplex::getBInvARow
void getBInvARow(int row, double *z, double *slack=NULL)
Get a row of the tableau (slack part in slack if not NULL).
ClpSimplex::setDirectionIn
void setDirectionIn(int direction)
Set directionIn or Out.
Definition ClpSimplex.hpp:1240
ClpSimplex::setColumnLower
void setColumnLower(int elementIndex, double elementValue)
Set a single column lower bound Use -DBL_MAX for -infinity.
ClpSimplex::loadProblem
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...
ClpSimplex::pivotVariable
int * pivotVariable() const
Basic variables pivoting on which rows.
Definition ClpSimplex.hpp:1023
ClpSimplex::Status
Status
enums for status of various sorts.
Definition ClpSimplex.hpp:114
ClpSimplex::isFixed
@ isFixed
Definition ClpSimplex.hpp:120
ClpSimplex::atUpperBound
@ atUpperBound
Definition ClpSimplex.hpp:117
ClpSimplex::isFree
@ isFree
Definition ClpSimplex.hpp:115
ClpSimplex::basic
@ basic
Definition ClpSimplex.hpp:116
ClpSimplex::superBasic
@ superBasic
Definition ClpSimplex.hpp:119
ClpSimplex::atLowerBound
@ atLowerBound
Definition ClpSimplex.hpp:118
ClpSimplex::operator=
ClpSimplex & operator=(const ClpSimplex &rhs)
Assignment operator. This copies the data.
ClpSimplex::setObjCoeff
void setObjCoeff(int elementIndex, double elementValue)
Set an objective function coefficient.
Definition ClpSimplex.hpp:1654
ClpSimplex::setDualRowPivotAlgorithm
void setDualRowPivotAlgorithm(ClpDualRowPivot &choice)
Sets row pivot choice algorithm in dual.
ClpSimplex::setSparseFactorization
void setSparseFactorization(bool value)
ClpSimplex::reducedGradient
int reducedGradient(int phase=0)
Solves non-linear using reduced gradient.
ClpSimplex::zeroTolerance_
double zeroTolerance_
Zero tolerance.
Definition ClpSimplex.hpp:1754
ClpSimplex::clearPerturbed
void clearPerturbed(int iSequence)
Definition ClpSimplex.hpp:1540
ClpSimplex::setPerturbed
void setPerturbed(int iSequence)
To say perturbed.
Definition ClpSimplex.hpp:1536
ClpSimplex::numberTimesOptimal_
int numberTimesOptimal_
Number of times code has tentatively thought optimal.
Definition ClpSimplex.hpp:1885
ClpSimplex::reducedCostAddress
double & reducedCostAddress(int sequence)
Definition ClpSimplex.hpp:1317
ClpSimplex::getBasis
CoinWarmStartBasis * getBasis() const
Returns a basis (to be deleted by user).
ClpSimplex::infeasibilityCost_
double infeasibilityCost_
Weight assigned to being infeasible in primal.
Definition ClpSimplex.hpp:1808
ClpSimplex::primalFeasible
bool primalFeasible() const
If problem is primal feasible.
Definition ClpSimplex.hpp:666
ClpSimplex::computePrimals
void computePrimals(const double *rowActivities, const double *columnActivities)
Computes primals from scratch.
ClpSimplex::costAddress
double & costAddress(int sequence)
Return address of row or column cost.
Definition ClpSimplex.hpp:1344
ClpSimplex::defaultFactorizationFrequency
void defaultFactorizationFrequency()
If user left factorization frequency then compute.
ClpSimplex::gutsOfCopy
void gutsOfCopy(const ClpSimplex &rhs)
Does most of copying.
ClpSimplex::loadProblem
int loadProblem(CoinStructuredModel &modelObject, bool originalOrder=true, bool keepSolution=false)
This loads a model from a CoinStructuredModel object - returns number of errors.
ClpSimplex::alphaAccuracy
double alphaAccuracy() const
Initial value for alpha accuracy calculation (-1.0 off).
Definition ClpSimplex.hpp:962
ClpSimplex::baseIteration
int baseIteration() const
Iteration when we entered dual or primal.
Definition ClpSimplex.hpp:1611
ClpSimplex::upperOut_
double upperOut_
Upper Bound on Out variable.
Definition ClpSimplex.hpp:1796
ClpSimplex::primalTolerance_
double primalTolerance_
Current primal tolerance for algorithm.
Definition ClpSimplex.hpp:1802
ClpSimplex::getFakeBound
FakeBound getFakeBound(int sequence) const
Definition ClpSimplex.hpp:1476
ClpSimplex::setRowStatus
void setRowStatus(int sequence, Status newstatus)
Definition ClpSimplex.hpp:1480
ClpSimplex::getRowStatus
Status getRowStatus(int sequence) const
Definition ClpSimplex.hpp:1486
ClpSimplex::lower_
double * lower_
Working copy of lower bounds (Owner of arrays below).
Definition ClpSimplex.hpp:1821
ClpSimplex::swapFactorization
ClpFactorization * swapFactorization(ClpFactorization *factorization)
ClpSimplex::gutsOfSolution
int gutsOfSolution(double *givenDuals, const double *givenPrimals, bool valuesPass=false)
May change basis and then returns number changed.
ClpSimplex::generateCpp
void generateCpp(FILE *fp, bool defaultFactor=false)
Create C++ lines to get to current state.
ClpSimplex::sumPrimalInfeasibilities
double sumPrimalInfeasibilities() const
Sum of primal infeasibilities.
Definition ClpSimplex.hpp:764
ClpSimplex::bestPossibleImprovement_
double bestPossibleImprovement_
Best possible improvement using djs (primal) or obj change by flipping bounds to make dual feasible (...
Definition ClpSimplex.hpp:1752
ClpSimplex::setStatus
void setStatus(int sequence, Status newstatus)
Definition ClpSimplex.hpp:1198
ClpSimplex::zeroTolerance
double zeroTolerance() const
Get zero tolerance.
Definition ClpSimplex.hpp:1013
ClpSimplex::setPrimalColumnPivotAlgorithm
void setPrimalColumnPivotAlgorithm(ClpPrimalColumnPivot &choice)
Sets column pivot choice algorithm in primal.
ClpSimplex::lowerRegion
double * lowerRegion() const
Definition ClpSimplex.hpp:1182
ClpSimplex::getEmptyFactorization
ClpFactorization * getEmptyFactorization()
Gets clean and emptyish factorization.
ClpSimplex::numberRefinements
int numberRefinements() const
How many iterative refinements to do.
Definition ClpSimplex.hpp:1055
ClpSimplex::internalFactorize
int internalFactorize(int solveType)
Factorizes using current basis.
ClpSimplex::deleteRim
void deleteRim(int getRidOfFactorizationData=2)
releases above arrays and does solution scaling out.
ClpSimplex::currentDualTolerance
double currentDualTolerance() const
Current dual tolerance.
Definition ClpSimplex.hpp:1037
ClpSimplex::setSumPrimalInfeasibilities
void setSumPrimalInfeasibilities(double value)
Definition ClpSimplex.hpp:768
ClpSimplex::unmarkHotStart
void unmarkHotStart(void *saveStuff)
Delete the snapshot.
ClpSimplex::saveModel
int saveModel(const char *fileName)
Save model to file, returns 0 if success.
ClpSimplex::fastCrunch
ClpSimplex * fastCrunch(ClpNodeStuff *stuff, int mode)
Deals with crunch aspects mode 0 - in 1 - out with solution 2 - out without solution returns small mo...
ClpSimplex::savedSolution_
double * savedSolution_
Saved version of solution.
Definition ClpSimplex.hpp:1883
ClpSimplex::valueIn_
double valueIn_
Value of In variable.
Definition ClpSimplex.hpp:1786
ClpSimplex::outDuplicateRows
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).
ClpSimplex::vectorMode_
int vectorMode_
Vector mode - try and use vector instructions.
Definition ClpSimplex.hpp:1766
ClpSimplex::pivotRow
int pivotRow() const
Pivot Row for use by classes e.g. steepestedge.
Definition ClpSimplex.hpp:1080
ClpSimplex::acceptablePivot_
double acceptablePivot_
Acceptable pivot value just after factorization.
Definition ClpSimplex.hpp:1814
ClpSimplex::pivotVariable_
int * pivotVariable_
Basic variables pivoting on which rows.
Definition ClpSimplex.hpp:1879
ClpSimplex::valueOut_
double valueOut_
Value of Out variable.
Definition ClpSimplex.hpp:1794
ClpSimplex::numberChanged_
int numberChanged_
Can be used for count of changed costs (dual) or changed bounds (primal).
Definition ClpSimplex.hpp:1917
ClpSimplex::theta
double theta() const
Theta (pivot change).
Definition ClpSimplex.hpp:1365
ClpSimplex::largestDualError
double largestDualError() const
Largest error on basic duals.
Definition ClpSimplex.hpp:998
ClpSimplex::OsiClpSolverInterface
friend class OsiClpSolverInterface
Allow OsiClp certain perks.
Definition ClpSimplex.hpp:1972
ClpSimplex::numberRefinements_
int numberRefinements_
How many iterative refinements to do.
Definition ClpSimplex.hpp:1873
ClpSimplex::getBInvACol
void getBInvACol(int col, double *vec)
Get a column of the tableau.
ClpSimplex::baseModel
ClpSimplex * baseModel() const
See if we have base model.
Definition ClpSimplex.hpp:208
ClpSimplex::vectorMode
int vectorMode() const
Get vector mode.
Definition ClpSimplex.hpp:1428
ClpSimplex::setZeroTolerance
void setZeroTolerance(double value)
Set zero tolerance.
Definition ClpSimplex.hpp:1018
ClpSimplex::originalModel
void originalModel(ClpSimplex *miniModel)
This copies back stuff from miniModel and then deletes miniModel.
ClpSimplex::setColBounds
void setColBounds(int elementIndex, double newlower, double newupper)
Set a single column lower and upper bound.
Definition ClpSimplex.hpp:1697
ClpSimplex::sequenceOut_
int sequenceOut_
Sequence of Out variable.
Definition ClpSimplex.hpp:1847
ClpSimplex::lastGoodIteration_
int lastGoodIteration_
Last good iteration (immediately after a re-factorization).
Definition ClpSimplex.hpp:1853
ClpSimplex::minimumPrimalTolerance_
double minimumPrimalTolerance_
Minimum primal tolerance.
Definition ClpSimplex.hpp:1816
ClpSimplex::changeMade_
int changeMade_
If change has been made (first attempt at stopping looping).
Definition ClpSimplex.hpp:1889
ClpSimplex::progressFlag
int progressFlag() const
Progress flag - at present 0 bit says artificials out.
Definition ClpSimplex.hpp:1566
ClpSimplex::initialBarrierSolve
int initialBarrierSolve()
Barrier initial solve.
ClpSimplex::active
bool active(int iRow) const
Definition ClpSimplex.hpp:1531
ClpSimplex::checkBothSolutions
void checkBothSolutions()
This sets sum and number of infeasibilities (Dual and Primal).
ClpSimplex::perturbation_
int perturbation_
Perturbation: -50 to +50 - perturb by this power of ten (-6 sounds good) 100 - auto perturb if takes ...
Definition ClpSimplex.hpp:1902
ClpSimplex::finish
void finish(int startFinishOptions=0)
ClpSimplex::pivotRow_
int pivotRow_
Pivot Row.
Definition ClpSimplex.hpp:1851
ClpSimplex::OsiCLPSolverInterface
friend class OsiCLPSolverInterface
And OsiCLP.
Definition ClpSimplex.hpp:1974
ClpSimplex::readLp
int readLp(const char *filename, const double epsilon=1e-5)
Read file in LP format from file with name filename.
ClpSimplex::doubleCheck
double doubleCheck()
Double checks OK.
ClpSimplex::setNumberRefinements
void setNumberRefinements(int value)
ClpSimplex::miniPostsolve
void miniPostsolve(const ClpSimplex *presolvedModel, void *info)
After mini presolve.
ClpSimplex::directionOut_
int directionOut_
Direction of Out, 1 to upper bound, -1 to lower bound, 0 - superbasic.
Definition ClpSimplex.hpp:1849
ClpSimplex::setRowUpper
void setRowUpper(int elementIndex, double elementValue)
Set a single row upper bound Use DBL_MAX for infinity.
ClpSimplex::dualBound_
double dualBound_
Dual bound.
Definition ClpSimplex.hpp:1778
ClpSimplex::setDirectionOut
void setDirectionOut(int direction)
Definition ClpSimplex.hpp:1244
ClpSimplex::moveTowardsPrimalFeasible
double moveTowardsPrimalFeasible()
Try simple crash like techniques to get closer to primal feasibility returns final sum of infeasibili...
ClpSimplex::rowUpperWork_
double * rowUpperWork_
Row upper bounds - working copy.
Definition ClpSimplex.hpp:1829
ClpSimplex::setSumOfRelaxedDualInfeasibilities
void setSumOfRelaxedDualInfeasibilities(double value)
Definition ClpSimplex.hpp:745
ClpSimplex::initialDenseFactorization
bool initialDenseFactorization() const
ClpSimplex::dontFactorizePivots_
int dontFactorizePivots_
If may skip final factorize then allow up to this pivots (default 20).
Definition ClpSimplex.hpp:1930
ClpSimplex::fathomMany
int fathomMany(void *stuff)
Do up to N deep - returns -1 - no solution nNodes_ valid nodes >= if solution and that node gives sol...
ClpSimplex::flagged
bool flagged(int sequence) const
Definition ClpSimplex.hpp:1518
ClpSimplex::miniSolve
void miniSolve(char *rowType, char *columnType, int algorithm, int startUp)
mini presolve and solve
ClpSimplex::sparseFactorization
bool sparseFactorization() const
Sparsity on or off.
ClpSimplex::forceFactorization
int forceFactorization() const
Force re-factorization early value.
Definition ClpSimplex.hpp:1576
ClpSimplex::unpack
void unpack(CoinIndexedVector *rowArray) const
Unpacks one column of the matrix into indexed array Uses sequenceIn_ Also applies scaling if needed.
ClpSimplex::costRegion
double * costRegion(int section) const
Definition ClpSimplex.hpp:1166
ClpSimplex::setNonLinearCost
void setNonLinearCost(ClpNonLinearCost &nonLinearCost)
Set pointer to details of costs.
ClpSimplex::perturbation
int perturbation() const
Amount of print out: 0 - none 1 - just final 2 - just factorizations 3 - as 2 plus a bit more 4 - ver...
Definition ClpSimplex.hpp:714
ClpSimplex::sumPrimalInfeasibilities_
double sumPrimalInfeasibilities_
Sum of primal infeasibilities.
Definition ClpSimplex.hpp:1806
ClpSimplex::lowerRegion
double * lowerRegion(int section) const
Definition ClpSimplex.hpp:1152
ClpSimplex::dual
int dual(int ifValuesPass=0, int startFinishOptions=0)
Dual algorithm - see ClpSimplexDual.hpp for method.
ClpSimplex::reducedCostWork_
double * reducedCostWork_
Possible scaled reduced costs.
Definition ClpSimplex.hpp:1859
ClpSimplex::setLowerOut
void setLowerOut(double value)
Set lower of out variable.
Definition ClpSimplex.hpp:1279
ClpSimplex::setFactorization
void setFactorization(ClpFactorization &factorization)
Passes in factorization.
ClpSimplex::automaticScale_
int automaticScale_
Automatic scaling of objective and rhs and bounds.
Definition ClpSimplex.hpp:1943
ClpSimplex::columnArray_
CoinIndexedVector * columnArray_[6]
Useful column length arrays.
Definition ClpSimplex.hpp:1841
ClpSimplex::pivotResultPart2
int pivotResultPart2(int algorithm, int state)
Do actual pivot state is 0 if need tableau column, 1 if in rowArray_[1].
ClpSimplex::readBasis
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::sequenceIn
int sequenceIn() const
Return sequence In or Out.
Definition ClpSimplex.hpp:1213
ClpSimplex::lowerAddress
double & lowerAddress(int sequence)
Return address of row or column lower bound.
Definition ClpSimplex.hpp:1326
ClpSimplex::progressFlag_
int progressFlag_
Progress flag - at present 0 bit says artificials out, 1 free in.
Definition ClpSimplex.hpp:1919
ClpSimplex::markHotStart
void markHotStart(void *&saveStuff)
Create a hotstart point of the optimization process.
ClpSimplex::setEmptyFactorization
void setEmptyFactorization()
May delete or may make clean and emptyish factorization.
ClpSimplex::sequenceOut
int sequenceOut() const
Definition ClpSimplex.hpp:1217
ClpSimplex::moveInfo
void moveInfo(const ClpSimplex &rhs, bool justStatus=false)
Move status and solution across.
ClpSimplex::sumOfRelaxedPrimalInfeasibilities
double sumOfRelaxedPrimalInfeasibilities() const
Sum of relaxed primal infeasibilities.
Definition ClpSimplex.hpp:773
ClpSimplex::disasterHandler
ClpDisasterHandler * disasterHandler() const
Get disaster handler.
Definition ClpSimplex.hpp:982
ClpSimplex::createStatus
void createStatus()
Set up status array (can be used by OsiClp).
ClpSimplex::saveStatus_
unsigned char * saveStatus_
Saved status regions.
Definition ClpSimplex.hpp:1904
ClpSimplex::sequenceWithin
int sequenceWithin(int sequence) const
Returns sequence number within section.
Definition ClpSimplex.hpp:1299
ClpSimplex::columnActivityWork_
double * columnActivityWork_
Column activities - working copy.
Definition ClpSimplex.hpp:1865
ClpSimplex::setDualOut
void setDualOut(double value)
Set dual value of out variable.
Definition ClpSimplex.hpp:1274
ClpSimplex::getStatus
Status getStatus(int sequence) const
Definition ClpSimplex.hpp:1194
ClpSimplex::setCurrentPrimalTolerance
void setCurrentPrimalTolerance(double value)
Definition ClpSimplex.hpp:1050
ClpSimplex::ClpSimplex
ClpSimplex(ClpSimplex *wholeModel, int numberColumns, const int *whichColumns)
This constructor modifies original ClpSimplex and stores original stuff in created ClpSimplex.
ClpSimplex::primal
int primal(int ifValuesPass=0, int startFinishOptions=0)
Primal algorithm - see ClpSimplexPrimal.hpp for method.
ClpSimplex::automaticScaling
bool automaticScaling() const
If automatic scaling on.
Definition ClpSimplex.hpp:1028
ClpSimplex::allowedInfeasibility_
double allowedInfeasibility_
Definition ClpSimplex.hpp:1941
ClpSimplex::createRim5
void createRim5(bool initial)
Does rows and columns and objective.
ClpSimplex::scaleObjective
double scaleObjective(double value)
If input negative scales objective so maximum <= -value and returns scale factor used.
ClpSimplex::gutsOfDelete
void gutsOfDelete(int type)
Does most of deletion (0 = all, 1 = most, 2 most + factorization).
ClpSimplex::djRegion
double * djRegion(int section) const
Definition ClpSimplex.hpp:1145
ClpSimplex::setSumDualInfeasibilities
void setSumDualInfeasibilities(double value)
Definition ClpSimplex.hpp:736
ClpSimplex::setNumberDualInfeasibilities
void setNumberDualInfeasibilities(int value)
Definition ClpSimplex.hpp:754
ClpSimplex::numberDualInfeasibilities_
int numberDualInfeasibilities_
Number of dual infeasibilities.
Definition ClpSimplex.hpp:1867
ClpSimplex::barrier
int barrier(bool crossover=true)
Solves using barrier (assumes you have good cholesky factor code).
ClpSimplex::setCurrentDualTolerance
void setCurrentDualTolerance(double value)
Definition ClpSimplex.hpp:1041
ClpSimplex::clearPivoted
void clearPivoted(int sequence)
Definition ClpSimplex.hpp:1504
ClpSimplex::dualFeasible
bool dualFeasible() const
If problem is dual feasible.
Definition ClpSimplex.hpp:671
ClpSimplex::reducedCost
double reducedCost(int sequence)
Definition ClpSimplex.hpp:1313
ClpSimplex::numberPrimalInfeasibilities
int numberPrimalInfeasibilities() const
Number of primal infeasibilities.
Definition ClpSimplex.hpp:782
ClpSimplex::averageInfeasibility_
double averageInfeasibility_[CLP_INFEAS_SAVE]
Definition ClpSimplex.hpp:1819
ClpSimplex::largeValue_
double largeValue_
Large bound value (for complementarity etc).
Definition ClpSimplex.hpp:1770
ClpSimplex::directionIn_
int directionIn_
Direction of In, 1 going up, -1 going down, 0 not a clue.
Definition ClpSimplex.hpp:1845
ClpSimplex::solutionRegion
double * solutionRegion() const
Return region as single array.
Definition ClpSimplex.hpp:1174
ClpSimplex::rowLowerWork_
double * rowLowerWork_
Row lower bounds - working copy.
Definition ClpSimplex.hpp:1823
ClpSimplex::copyEnabledStuff
void copyEnabledStuff(const ClpSimplex *rhs)
Copy across enabled stuff from one solver to another.
ClpSimplex::initialPrimalSolve
int initialPrimalSolve()
Primal initial solve.
ClpSimplex::setInitialDenseFactorization
void setInitialDenseFactorization(bool onOff)
Normally the first factorization does sparse coding because the factorization could be singular.
ClpSimplex::numberDegeneratePivots_
int numberDegeneratePivots_
Number of degenerate pivots since last perturbed.
Definition ClpSimplex.hpp:1962
ClpSimplex::fastDual2
int fastDual2(ClpNodeStuff *stuff)
Like Fast dual.
ClpSimplex::setLargestDualError
void setLargestDualError(double value)
Largest error on basic duals.
Definition ClpSimplex.hpp:1008
ClpSimplex::readGMPL
int readGMPL(const char *filename, const char *dataName, bool keepNames=false)
Read GMPL files from the given filenames.
ClpSimplex::ClpSimplex
ClpSimplex(const ClpSimplex &rhs, int scalingMode=-1)
Copy constructor.
ClpSimplex::factorize
int factorize()
Factorizes using current basis. For external use.
ClpSimplex::upperRegion
double * upperRegion(int section) const
Definition ClpSimplex.hpp:1159
ClpSimplex::setSequenceOut
void setSequenceOut(int sequence)
Definition ClpSimplex.hpp:1226
ClpSimplex::columnPrimalSequence_
int columnPrimalSequence_
Sequence of worst (-1 if feasible).
Definition ClpSimplex.hpp:1756
ClpSimplex::goodAccuracy
bool goodAccuracy() const
Returns true if model looks OK.
Definition ClpSimplex.hpp:857
ClpSimplex::computeObjectiveValue
void computeObjectiveValue(bool useWorkingSolution=false)
Compute objective value from solution and put in objectiveValue_.
ClpSimplex::bestPossibleImprovement
double bestPossibleImprovement() const
Best possible improvement using djs (primal) or obj change by flipping bounds to make dual feasible (...
Definition ClpSimplex.hpp:1386
ClpSimplex::upperIn
double upperIn() const
Upper Bound on In variable.
Definition ClpSimplex.hpp:1380
ClpSimplex::isObjectiveLimitTestValid
bool isObjectiveLimitTestValid() const
Return true if the objective limit test can be relied upon.
ClpSimplex::rowPrimalSequence_
int rowPrimalSequence_
Sequence of worst (-1 if feasible).
Definition ClpSimplex.hpp:1758
ClpSimplex::primalColumnPivot_
ClpPrimalColumnPivot * primalColumnPivot_
primal column pivot choice
Definition ClpSimplex.hpp:1877
ClpSimplex::computeDuals
void computeDuals(double *givenDjs)
Computes duals from scratch.
ClpSimplex::valueIncomingDual
double valueIncomingDual() const
value of incoming variable (in Dual)
ClpSimplex::setAlgorithm
void setAlgorithm(int value)
Set algorithm.
Definition ClpSimplex.hpp:725
ClpSimplex::initialSolve
int initialSolve()
Default initial solve.
ClpSimplex::borrowModel
void borrowModel(ClpModel &otherModel)
Borrow model.
ClpSimplex::infeasibilityCost
double infeasibilityCost() const
Infeasibility cost.
Definition ClpSimplex.hpp:693
ClpSimplex::algorithm_
int algorithm_
Algorithm >0 == Primal, <0 == Dual.
Definition ClpSimplex.hpp:1891
ClpSimplex::solveBenders
int solveBenders(CoinStructuredModel *model, ClpSolve &options)
Solve using Benders decomposition and maybe in parallel.
ClpSimplex::setPivoted
void setPivoted(int sequence)
Definition ClpSimplex.hpp:1500
ClpSimplex::borrowModel
void borrowModel(ClpSimplex &otherModel)
ClpSimplex::spareIntArray_
int spareIntArray_[4]
Spare int array for passing information [0]!=0 switches on.
Definition ClpSimplex.hpp:1966
ClpSimplex::moreSpecialOptions
int moreSpecialOptions() const
Return more special options 1 bit - if presolve says infeasible in ClpSolve return 2 bit - if presolv...
Definition ClpSimplex.hpp:1423
ClpSimplex::lastBadIteration
int lastBadIteration() const
So we know when to be cautious.
Definition ClpSimplex.hpp:1556
ClpSimplex::setLastBadIteration
void setLastBadIteration(int value)
Set so we know when to be cautious.
Definition ClpSimplex.hpp:1561
ClpSimplex::factorization_
ClpFactorization * factorization_
factorization
Definition ClpSimplex.hpp:1881
ClpSimplex::saveData
ClpDataSave saveData()
Save data.
ClpSimplex::lowerIn
double lowerIn() const
Lower Bound on In variable.
Definition ClpSimplex.hpp:1370
ClpSimplex::numberExtraRows
int numberExtraRows() const
Number of extra rows.
Definition ClpSimplex.hpp:1600
ClpSimplex::dualOut
double dualOut() const
Dual value of Out variable.
Definition ClpSimplex.hpp:1269
ClpSimplex::getBasics
void getBasics(int *index)
Get basic indices (order of indices corresponds to the order of elements in a vector retured by getBI...
ClpSimplex::createRim4
void createRim4(bool initial)
Does objective.
ClpSimplex::numberDualInfeasibilitiesWithoutFree_
int numberDualInfeasibilitiesWithoutFree_
Number of dual infeasibilities (without free).
Definition ClpSimplex.hpp:1869
ClpSimplex::computeInternalObjectiveValue
double computeInternalObjectiveValue()
Compute minimization objective value from internal solution without perturbation.
ClpSimplex::getSolution
int getSolution()
Given an existing factorization computes and checks primal and dual solutions.
ClpSimplex::getColumnStatus
Status getColumnStatus(int sequence) const
Definition ClpSimplex.hpp:1496
ClpSimplex::maximumBasic_
int maximumBasic_
Maximum number of basic variables - can be more than number of rows if GUB.
Definition ClpSimplex.hpp:1928
ClpSimplex::djRegion
double * djRegion() const
Definition ClpSimplex.hpp:1178
ClpSimplex::solution_
double * solution_
Working copy of primal solution (Owner of arrays below).
Definition ClpSimplex.hpp:1861
ClpSimplex::incomingInfeasibility_
double incomingInfeasibility_
For advanced use.
Definition ClpSimplex.hpp:1940
ClpSimplex::upper_
double * upper_
Working copy of upper bounds (Owner of arrays below).
Definition ClpSimplex.hpp:1827
ClpSimplex::solutionRegion
double * solutionRegion(int section) const
Return row or column sections - not as much needed as it once was.
Definition ClpSimplex.hpp:1138
ClpSimplex::clearFlagged
void clearFlagged(int sequence)
Definition ClpSimplex.hpp:1514
ClpSimplex::baseModel_
ClpSimplex * baseModel_
A copy of model with certain state - normally without cuts.
Definition ClpSimplex.hpp:1949
ClpSimplex::lowerOut_
double lowerOut_
Lower Bound on Out variable.
Definition ClpSimplex.hpp:1792
ClpSimplex::modifyCoefficientsAndPivot
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.
ClpSimplex::allSlackBasis
void allSlackBasis(bool resetSolution=false)
Sets up all slack basis and resets solution to as it was after initial load or readMps.
ClpSimplex::getSolution
int getSolution(const double *rowActivities, const double *columnActivities)
Given an existing factorization computes and checks primal and dual solutions.
ClpSimplex::createRim
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),...
ClpSimplex::directionIn
int directionIn() const
Return direction In or Out.
Definition ClpSimplex.hpp:1231
ClpSimplex::primalPivotResult
int primalPivotResult()
Pivot in a variable and choose an outgoing one.
ClpSimplex::setRowLower
void setRowLower(int elementIndex, double elementValue)
Set a single row lower bound Use -DBL_MAX for -infinity.
ClpSimplex::tightenPrimalBounds
int tightenPrimalBounds(double factor=0.0, int doTight=0, bool tightIntegers=false)
Tightens primal bounds to make dual faster.
ClpSimplex::solutionAddress
double & solutionAddress(int sequence)
Return address of row or column values.
Definition ClpSimplex.hpp:1309
ClpSimplex::setTheta
void setTheta(double value)
Set theta of out variable.
Definition ClpSimplex.hpp:1289
ClpSimplex::factorization
ClpFactorization * factorization() const
factorization
Definition ClpSimplex.hpp:676
ClpSimplex::FakeBound
FakeBound
Definition ClpSimplex.hpp:123
ClpSimplex::upperFake
@ upperFake
Definition ClpSimplex.hpp:126
ClpSimplex::bothFake
@ bothFake
Definition ClpSimplex.hpp:127
ClpSimplex::noFake
@ noFake
Definition ClpSimplex.hpp:124
ClpSimplex::lowerFake
@ lowerFake
Definition ClpSimplex.hpp:125
ClpSimplex::pivoted
bool pivoted(int sequence) const
Definition ClpSimplex.hpp:1508
ClpSimplex::createPiecewiseLinearCosts
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...
ClpSimplex::moreSpecialOptions_
int moreSpecialOptions_
More special options - see set for details.
Definition ClpSimplex.hpp:1762
ClpSimplex::loadProblem
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).
ClpSimplex::solveFromHotStart
void solveFromHotStart(void *saveStuff)
Optimize starting from the hotstart.
ClpSimplex::upperRegion
double * upperRegion() const
Definition ClpSimplex.hpp:1186
ClpSimplex::cleanPrimalSolution
int cleanPrimalSolution(double exactMultiple)
Clean primal solution If you expect solution to only have exact multiples of "exactMultiple" then thi...
ClpSimplex::numberDualInfeasibilitiesWithoutFree
int numberDualInfeasibilitiesWithoutFree() const
Number of dual infeasibilities (without free).
Definition ClpSimplex.hpp:759
ClpSimplex::largeValue
double largeValue() const
Large bound value (for complementarity etc).
Definition ClpSimplex.hpp:987
ClpSimplex::nonlinearSLP
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 ...
ClpSimplex::primalRanging
int primalRanging(int numberCheck, const int *which, double *valueIncrease, int *sequenceIncrease, double *valueDecrease, int *sequenceDecrease)
Primal ranging.
ClpSimplex::unpackPacked
void unpackPacked(CoinIndexedVector *rowArray, int sequence)
Unpacks one column of the matrix into indexed array as packed vector Slack if sequence>= numberColumn...
ClpSimplex::theta_
double theta_
Theta (pivot change).
Definition ClpSimplex.hpp:1782
ClpSimplex::rowReducedCost_
double * rowReducedCost_
Reduced costs of slacks not same as duals (or - duals).
Definition ClpSimplex.hpp:1857
ClpSimplex::rowArray
CoinIndexedVector * rowArray(int index) const
Useful row length arrays (0,1,2,3,4,5).
Definition ClpSimplex.hpp:815
ClpSimplex::setUpperOut
void setUpperOut(double value)
Set upper of out variable.
Definition ClpSimplex.hpp:1284
ClpSimplex::numberExtraRows_
int numberExtraRows_
Number of extra rows.
Definition ClpSimplex.hpp:1925
ClpSimplex::setColSetBounds
void setColSetBounds(const int *indexFirst, const int *indexLast, const double *boundList)
Set the bounds on a number of columns simultaneously .
Definition ClpSimplex.hpp:1709
ClpSimplex::getBInvCol
void getBInvCol(int col, double *vec)
Get a column of the basis inverse.
ClpSimplex::dualRowPivot
ClpDualRowPivot * dualRowPivot() const
dual row pivot choice
Definition ClpSimplex.hpp:847
ClpSimplex::getBInvRow
void getBInvRow(int row, double *z)
Get a row of the basis inverse.
ClpSimplex::readMps
int readMps(const char *filename, bool keepNames=false, bool ignoreErrors=false)
Read an mps file from the given filename.
ClpSimplex::setPerturbation
void setPerturbation(int value)
ClpSimplex::objectiveWork_
double * objectiveWork_
Column objective - working copy.
Definition ClpSimplex.hpp:1837
ClpSimplex::cleanStatus
void cleanStatus()
Clean up status.
ClpSimplex::loadProblem
void loadProblem(const CoinPackedMatrix &matrix, const double *collb, const double *colub, const double *obj, const double *rowlb, const double *rowub, const double *rowObjective=NULL)
ClpSimplex::checkDualSolution
void checkDualSolution()
This sets largest infeasibility and most infeasible and sum and number of infeasibilities (Dual).
ClpSimplex::sequenceIn_
int sequenceIn_
Sequence of In variable.
Definition ClpSimplex.hpp:1843
ClpSimplex::cost_
double * cost_
Working copy of objective (Owner of arrays below).
Definition ClpSimplex.hpp:1833
ClpSimplex::dualTolerance_
double dualTolerance_
Current dual tolerance for algorithm.
Definition ClpSimplex.hpp:1800
ClpSimplex::copyFactorization
void copyFactorization(ClpFactorization &factorization)
Copies in factorization to existing one.
ClpSimplex::resize
void resize(int newNumberRows, int newNumberColumns)
Resizes rim part of model.
ClpSimplex::add
void add(double *array, int column, double multiplier) const
Adds multiple of a column into an array.
ClpSimplex::setObjectiveCoefficient
void setObjectiveCoefficient(int elementIndex, double elementValue)
Set an objective function coefficient.
ClpSimplex::setFakeBound
void setFakeBound(int sequence, FakeBound fakeBound)
Definition ClpSimplex.hpp:1470
ClpSimplex::miniPresolve
ClpSimplex * miniPresolve(char *rowType, char *columnType, void **info)
Mini presolve (faster) Char arrays must be numberRows and numberColumns long on entry second part mus...
ClpSimplex::numberFake_
int numberFake_
Can be used for count of fake bounds (dual) or fake costs (primal).
Definition ClpSimplex.hpp:1915
ClpSimplex::spareDoubleArray_
double spareDoubleArray_[4]
Spare double array for passing information [0]!=0 switches on.
Definition ClpSimplex.hpp:1968
ClpSimplex::setInfeasibilityCost
void setInfeasibilityCost(double value)
ClpSimplex::setToBaseModel
void setToBaseModel(ClpSimplex *model=NULL)
Reset to base model (just size and arrays needed) If model NULL use internal copy.
ClpSimplex::perturbed
bool perturbed(int iSequence) const
Definition ClpSimplex.hpp:1544
ClpSimplex::setValuesPassAction
void setValuesPassAction(double incomingInfeasibility, double allowedInfeasibility)
For advanced use.
ClpSimplex::upperOut
double upperOut() const
Upper of out variable.
Definition ClpSimplex.hpp:1259
ClpSimplex::sumDualInfeasibilities
double sumDualInfeasibilities() const
Sum of dual infeasibilities.
Definition ClpSimplex.hpp:732
ClpSimplex::setMoreSpecialOptions
void setMoreSpecialOptions(int value)
Set more special options 1 bit - if presolve says infeasible in ClpSolve return 2 bit - if presolved ...
Definition ClpSimplex.hpp:1458
ClpSimplex::clearActive
void clearActive(int iRow)
Definition ClpSimplex.hpp:1527
ClpSimplex::currentPrimalTolerance
double currentPrimalTolerance() const
Current primal tolerance.
Definition ClpSimplex.hpp:1046
ClpSimplex::costRegion
double * costRegion() const
Definition ClpSimplex.hpp:1190
ClpSimplex::dj_
double * dj_
Working copy of reduced costs (Owner of arrays below).
Definition ClpSimplex.hpp:1855
ClpSimplex::originalUpper
double originalUpper(int iSequence) const
Return original lower bound.
Definition ClpSimplex.hpp:1357
ClpSimplex::crash
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...
ClpSimplex::checkPrimalSolution
void checkPrimalSolution(const double *rowActivities=NULL, const double *columnActivies=NULL)
This sets largest infeasibility and most infeasible and sum and number of infeasibilities (Primal).
ClpSimplex::forceFactorization_
int forceFactorization_
Now for some reliability aids This forces re-factorization early.
Definition ClpSimplex.hpp:1894
ClpSimplex::dualIn
double dualIn() const
Reduced cost of last incoming for use by classes e.g. steepestedge.
Definition ClpSimplex.hpp:1070
ClpSimplex::largestDualError_
double largestDualError_
Largest error on basic duals.
Definition ClpSimplex.hpp:1774
ClpSimplex::setDisasterHandler
void setDisasterHandler(ClpDisasterHandler *handler)
Objective value.
Definition ClpSimplex.hpp:977
ClpSimplex::upperAddress
double & upperAddress(int sequence)
Return address of row or column upper bound.
Definition ClpSimplex.hpp:1335
ClpSimplex::setRowBounds
void setRowBounds(int elementIndex, double lower, double upper)
Set a single row lower and upper bound.
ClpSimplex::setVectorMode
void setVectorMode(int value)
Set vector mode.
Definition ClpSimplex.hpp:1463
ClpSimplex::disasterArea_
ClpDisasterHandler * disasterArea_
Disaster handler.
Definition ClpSimplex.hpp:1887
ClpSimplex::ClpSimplex
ClpSimplex(bool emptyMessages=false)
Default constructor.
ClpSimplex::columnArray
CoinIndexedVector * columnArray(int index) const
Useful column length arrays (0,1,2,3,4,5).
Definition ClpSimplex.hpp:820
ClpSimplex::setLargestPrimalError
void setLargestPrimalError(double value)
Largest error on Ax-b.
Definition ClpSimplex.hpp:1003
ClpSimplex::originalLower
double originalLower(int iSequence) const
Return original lower bound.
Definition ClpSimplex.hpp:1349
ClpSimplex::maximumBasic
int maximumBasic() const
Maximum number of basic variables - can be more than number of rows if GUB.
Definition ClpSimplex.hpp:1606
ClpSimplex::lowerOut
double lowerOut() const
Lower of out variable.
Definition ClpSimplex.hpp:1254
ClpSimplex::setAlpha
void setAlpha(double value)
Definition ClpSimplex.hpp:1065
ClpSimplex::setDualBound
void setDualBound(double value)
ClpSimplex::setFlagged
void setFlagged(int sequence)
To flag a variable (not inline to allow for column generation).
ClpSimplex::nonLinearCost
ClpNonLinearCost * nonLinearCost() const
Return pointer to details of costs.
Definition ClpSimplex.hpp:1391
ClpSimplex::primalColumnPivot
ClpPrimalColumnPivot * primalColumnPivot() const
primal column pivot choice
Definition ClpSimplex.hpp:852
ClpSimplex::dualOut_
double dualOut_
Infeasibility (dual) or ? (primal) of Out variable.
Definition ClpSimplex.hpp:1798
ClpSimplex::nonlinearSLP
int nonlinearSLP(int numberPasses, double deltaTolerance)
Solves nonlinear problem using SLP - may be used as crash for other algorithms when number of iterati...
ClpSimplex::checkUnscaledSolution
void checkUnscaledSolution()
Check unscaled primal solution but allow for rounding error.
ClpSimplex::startup
int startup(int ifValuesPass, int startFinishOptions=0)
Common bits of coding for dual and primal.
ClpSimplex::lowerIn_
double lowerIn_
Lower Bound on In variable.
Definition ClpSimplex.hpp:1784
ClpSimplex::setNumberPrimalInfeasibilities
void setNumberPrimalInfeasibilities(int value)
Definition ClpSimplex.hpp:786
ClpSimplex::sanityCheck
bool sanityCheck()
Sanity check on input rim data (after scaling) - returns true if okay.
ClpSimplex::setDualIn
void setDualIn(double value)
Set reduced cost of last incoming to force error.
Definition ClpSimplex.hpp:1075
ClpSimplex::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.
ClpSimplex::lastBadIteration_
int lastBadIteration_
So we know when to be cautious.
Definition ClpSimplex.hpp:1911
ClpSimplex::nonLinearCost_
ClpNonLinearCost * nonLinearCost_
Very wasteful way of dealing with infeasibilities in primal.
Definition ClpSimplex.hpp:1909
ClpSimplex::setColumnStatus
void setColumnStatus(int sequence, Status newstatus)
Definition ClpSimplex.hpp:1490
ClpSimplex::isColumn
int isColumn(int sequence) const
Returns 1 if sequence indicates column.
Definition ClpSimplex.hpp:1294
ClpSimplex::sumOfRelaxedDualInfeasibilities_
double sumOfRelaxedDualInfeasibilities_
Sum of Dual infeasibilities using tolerance based on error in duals.
Definition ClpSimplex.hpp:1810
ClpSimplex::cleanFactorization
int cleanFactorization(int ifValuesPass)
Get a clean factorization - i.e.
ClpSimplex::numberDualInfeasibilities
int numberDualInfeasibilities() const
Number of dual infeasibilities.
Definition ClpSimplex.hpp:750
ClpSimplex::progress_
ClpSimplexProgress progress_
For dealing with all issues of cycling etc.
Definition ClpSimplex.hpp:1951
ClpSimplex::setColUpper
void setColUpper(int elementIndex, double elementValue)
Set a single column upper bound Use DBL_MAX for infinity.
Definition ClpSimplex.hpp:1691
ClpSimplex::loadProblem
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.
ClpSimplex::ClpSimplex
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.
ClpSimplex::dualPivotResultPart1
int dualPivotResultPart1()
Pivot out a variable and choose an incoing one.
ClpSimplex::setPivotRow
void setPivotRow(int value)
Definition ClpSimplex.hpp:1084
ClpSimplex::primalToleranceToGetOptimal_
double primalToleranceToGetOptimal_
Primal tolerance needed to make dual feasible (<largeTolerance).
Definition ClpSimplex.hpp:1768
ClpSimplex::columnLowerWork_
double * columnLowerWork_
Column lower bounds - working copy.
Definition ClpSimplex.hpp:1825
ClpSimplex::dualBound
double dualBound() const
Dual bound.
Definition ClpSimplex.hpp:687
ClpSimplex::makeBaseModel
void makeBaseModel()
Save a copy of model with certain state - normally without cuts.
ClpSimplex::initialBarrierNoCrossSolve
int initialBarrierNoCrossSolve()
Barrier initial solve, not to be followed by crossover.
ClpSimplex::checkSolutionInternal
void checkSolutionInternal()
Just check solution (for internal use) - sets sum of infeasibilities etc.
ClpSimplex::numberPrimalInfeasibilities_
int numberPrimalInfeasibilities_
Number of primal infeasibilities.
Definition ClpSimplex.hpp:1871
ClpSimplex::progress
ClpSimplexProgress * progress()
For dealing with all issues of cycling etc.
Definition ClpSimplex.hpp:1571
ClpSimplex::setSequenceIn
void setSequenceIn(int sequence)
Set sequenceIn or Out.
Definition ClpSimplex.hpp:1222
ClpSimplex::restoreModel
int restoreModel(const char *fileName)
Restore model from file, returns 0 if success, deletes current model.
ClpSimplex::firstFree_
int firstFree_
First free/super-basic variable (-1 if none).
Definition ClpSimplex.hpp:1921
ClpSimplex::unpack
void unpack(CoinIndexedVector *rowArray, int sequence) const
Unpacks one column of the matrix into indexed array Slack if sequence>= numberColumns Also applies sc...
ClpSimplex::maximumPerturbationSize_
int maximumPerturbationSize_
Maximum perturbation array size (take out when code rewritten).
Definition ClpSimplex.hpp:1945
ClpSimplex::dualDebug
int dualDebug(int ifValuesPass=0, int startFinishOptions=0)
ClpSimplex::setLargeValue
void setLargeValue(double value)
ClpSimplex::statusOfProblem
bool statusOfProblem(bool initial=false)
Factorizes and returns true if optimal.
ClpSimplex::checkSolution
void checkSolution(int setToBounds=0)
Just check solution (for external use) - sets sum of infeasibilities etc.
ClpSimplex::solveDW
int solveDW(CoinStructuredModel *model, ClpSolve &options)
Solve using Dantzig-Wolfe decomposition and maybe in parallel.
ClpSimplex::ClpSimplex
ClpSimplex(const ClpModel &rhs, int scalingMode=-1)
Copy constructor from model.
ClpSimplex::passInEventHandler
void passInEventHandler(const ClpEventHandler *eventHandler)
Pass in Event handler (cloned and deleted at end).
ClpSimplex::solution
double solution(int sequence)
Return row or column values.
Definition ClpSimplex.hpp:1304
ClpSimplex::restoreData
void restoreData(ClpDataSave saved)
Restore data.
ClpSimplex::dualIn_
double dualIn_
Reduced cost of In variable.
Definition ClpSimplex.hpp:1790
ClpSimplex::housekeeping
int housekeeping(double objectiveChange)
This does basis housekeeping and does values for in/out variables.
ClpSimplex::lower
double lower(int sequence)
Definition ClpSimplex.hpp:1321
ClpSimplex::dualRanging
int dualRanging(int numberCheck, const int *which, double *costIncrease, int *sequenceIncrease, double *costDecrease, int *sequenceDecrease, double *valueIncrease=NULL, double *valueDecrease=NULL)
Dual ranging.
ClpSimplex::getbackSolution
void getbackSolution(const ClpSimplex &smallModel, const int *whichRow, const int *whichColumn)
Puts solution back into small model.
ClpSimplex::startPermanentArrays
bool startPermanentArrays()
Start or reset using maximumRows_ and Columns_ - true if change.
ClpSimplex::sumOfRelaxedDualInfeasibilities
double sumOfRelaxedDualInfeasibilities() const
Sum of relaxed dual infeasibilities.
Definition ClpSimplex.hpp:741
ClpSimplex::bestObjectiveValue_
double bestObjectiveValue_
"Best" objective value
Definition ClpSimplex.hpp:1760
ClpSimplex::rawObjectiveValue
double rawObjectiveValue() const
Raw objective value (so always minimize in primal).
Definition ClpSimplex.hpp:1586
ClpSimplex::perturbationArray_
double * perturbationArray_
Perturbation array (maximumPerturbationSize_).
Definition ClpSimplex.hpp:1947
ClpSimplex::factorizationFrequency
int factorizationFrequency() const
Factorization frequency.
ClpSimplex::largestPrimalError_
double largestPrimalError_
Largest error on Ax-b.
Definition ClpSimplex.hpp:1772
ClpSimplex::columnUpperWork_
double * columnUpperWork_
Column upper bounds - working copy.
Definition ClpSimplex.hpp:1831
ClpSimplex::alphaAccuracy_
double alphaAccuracy_
For computing whether to re-factorize.
Definition ClpSimplex.hpp:1776
ClpSolve
This is a very simple class to guide algorithms.
Definition ClpSolve.hpp:20
OsiClpSolverInterface
Clp Solver Interface.
Definition OsiClpSolverInterface.hpp:37
clpTempInfo
Definition ClpSimplex.hpp:2063
clpTempInfo::startColumn
int startColumn
Definition ClpSimplex.hpp:2090
clpTempInfo::status
const unsigned char *COIN_RESTRICT status
Definition ClpSimplex.hpp:2080
clpTempInfo::bestPossible
double bestPossible
Definition ClpSimplex.hpp:2065
clpTempInfo::start
const CoinBigIndex *COIN_RESTRICT start
Definition ClpSimplex.hpp:2085
clpTempInfo::pivotVariable
const int *COIN_RESTRICT pivotVariable
Definition ClpSimplex.hpp:2083
clpTempInfo::index
int *COIN_RESTRICT index
Definition ClpSimplex.hpp:2078
clpTempInfo::acceptablePivot
double acceptablePivot
Definition ClpSimplex.hpp:2066
clpTempInfo::numberColumns
int numberColumns
Definition ClpSimplex.hpp:2092
clpTempInfo::upper
const double *COIN_RESTRICT upper
Definition ClpSimplex.hpp:2076
clpTempInfo::numberToDo
int numberToDo
Definition ClpSimplex.hpp:2091
clpTempInfo::changeObj
double changeObj
Definition ClpSimplex.hpp:2071
clpTempInfo::cost
const double *COIN_RESTRICT cost
Definition ClpSimplex.hpp:2072
clpTempInfo::dualTolerance
double dualTolerance
Definition ClpSimplex.hpp:2068
clpTempInfo::row
const int *COIN_RESTRICT row
Definition ClpSimplex.hpp:2086
clpTempInfo::lower
const double *COIN_RESTRICT lower
Definition ClpSimplex.hpp:2075
clpTempInfo::element
const double *COIN_RESTRICT element
Definition ClpSimplex.hpp:2084
clpTempInfo::spare
double *COIN_RESTRICT spare
Definition ClpSimplex.hpp:2079
clpTempInfo::infeas
double *COIN_RESTRICT infeas
Definition ClpSimplex.hpp:2082
clpTempInfo::which
int *COIN_RESTRICT which
Definition ClpSimplex.hpp:2081
clpTempInfo::numberAdded
int numberAdded
Definition ClpSimplex.hpp:2087
clpTempInfo::tolerance
double tolerance
Definition ClpSimplex.hpp:2067
clpTempInfo::solution
double *COIN_RESTRICT solution
Definition ClpSimplex.hpp:2073
clpTempInfo::primalRatio
double primalRatio
Definition ClpSimplex.hpp:2070
clpTempInfo::work
double *COIN_RESTRICT work
Definition ClpSimplex.hpp:2077
clpTempInfo::numberInfeasibilities
int numberInfeasibilities
Definition ClpSimplex.hpp:2088
clpTempInfo::reducedCost
double *COIN_RESTRICT reducedCost
Definition ClpSimplex.hpp:2074
clpTempInfo::theta
double theta
Definition ClpSimplex.hpp:2069
clpTempInfo::numberRemaining
int numberRemaining
Definition ClpSimplex.hpp:2089
clpTempInfo::upperTheta
double upperTheta
Definition ClpSimplex.hpp:2064