// Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. #ifndef ClpModel_H #define ClpModel_H #include "ClpConfig.h" #include #include #include #include #include //#ifndef COIN_USE_CLP //#define COIN_USE_CLP //#endif #include "ClpPackedMatrix.hpp" #include "CoinMessageHandler.hpp" #include "CoinHelperFunctions.hpp" #include "ClpParameters.hpp" #include "ClpObjective.hpp" class ClpEventHandler; // Plus infinity #ifndef COIN_DBL_MAX #define COIN_DBL_MAX DBL_MAX #endif /** This is the base class for Linear and quadratic Models This knows nothing about the algorithm, but it seems to have a reasonable amount of information I would welcome suggestions for what should be in this and how it relates to OsiSolverInterface. Some methods look very similar. */ class CoinBuild; class CoinModel; class ClpModel { public: /**@name Constructors and destructor Note - copy methods copy ALL data so can chew up memory until other copy is freed */ //@{ /// Default constructor ClpModel (bool emptyMessages=false ); /** Copy constructor. May scale depending on mode -1 leave mode as is 0 -off, 1 equilibrium, 2 geometric, 3, auto, 4 auto-but-as-initialSolve-in-bab */ ClpModel(const ClpModel & rhs, int scalingMode=-1); /// Assignment operator. This copies the data ClpModel & operator=(const ClpModel & rhs); /** Subproblem constructor. A subset of whole model is created from the row and column lists given. The new order is given by list order and duplicates are allowed. Name and integer information can be dropped */ ClpModel (const ClpModel * wholeModel, int numberRows, const int * whichRows, int numberColumns, const int * whichColumns, bool dropNames=true, bool dropIntegers=true); /// Destructor ~ClpModel ( ); //@} /**@name Load model - loads some stuff and initializes others */ //@{ /** Loads a problem (the constraints on the rows are given by lower and upper bounds). If a pointer is 0 then the following values are the default:
  • colub: all columns have upper bound infinity
  • collb: all columns have lower bound 0
  • rowub: all rows have upper bound infinity
  • rowlb: all rows have lower bound -infinity
  • obj: all variables have 0 objective coefficient
*/ 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); /** Just like the other loadProblem() method except that the matrix is given in a standard column major ordered format (without gaps). */ 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); /** This loads a model from a coinModel object - returns number of errors. modelObject not const as may be changed as part of process If tryPlusMinusOne then will try adding as +-1 matrix */ int loadProblem ( CoinModel & modelObject,bool tryPlusMinusOne=false); /// This one is for after presolve to save memory 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); /** Load up quadratic objective. This is stored as a CoinPackedMatrix */ void loadQuadraticObjective(const int numberColumns, const CoinBigIndex * start, const int * column, const double * element); void loadQuadraticObjective ( const CoinPackedMatrix& matrix); /// Get rid of quadratic objective void deleteQuadraticObjective(); /// This just loads up a row objective void setRowObjective(const double * rowObjective); /// Read an mps file from the given filename int readMps(const char *filename, bool keepNames=false, bool ignoreErrors = false); /// Read GMPL files from the given filenames int readGMPL(const char *filename,const char * dataName, bool keepNames=false); /// Copy in integer informations void copyInIntegerInformation(const char * information); /// Drop integer informations void deleteIntegerInformation(); /** Set the index-th variable to be a continuous variable */ void setContinuous(int index); /** Set the index-th variable to be an integer variable */ void setInteger(int index); /** Return true if the index-th variable is an integer variable */ bool isInteger(int index) const; /// Resizes rim part of model void resize (int newNumberRows, int newNumberColumns); /// Deletes rows void deleteRows(int number, const int * which); /// Add one row void addRow(int numberInRow, const int * columns, const double * elements, double rowLower=-COIN_DBL_MAX, double rowUpper=COIN_DBL_MAX); /// Add rows void addRows(int number, const double * rowLower, const double * rowUpper, const CoinBigIndex * rowStarts, const int * columns, const double * elements); /// Add rows void addRows(int number, const double * rowLower, const double * rowUpper, const CoinBigIndex * rowStarts, const int * rowLengths, const int * columns, const double * elements); #ifndef CLP_NO_VECTOR void addRows(int number, const double * rowLower, const double * rowUpper, const CoinPackedVectorBase * const * rows); #endif /** Add rows from a build object. If tryPlusMinusOne then will try adding as +-1 matrix if no matrix exists. Returns number of errors e.g. duplicates */ int addRows(const CoinBuild & buildObject,bool tryPlusMinusOne=false, bool checkDuplicates=true); /** Add rows from a model object. returns -1 if object in bad state (i.e. has column information) otherwise number of errors. modelObject non const as can be regularized as part of build If tryPlusMinusOne then will try adding as +-1 matrix if no matrix exists. */ int addRows(CoinModel & modelObject,bool tryPlusMinusOne=false, bool checkDuplicates=true); /// Deletes columns void deleteColumns(int number, const int * which); /// Add one column void addColumn(int numberInColumn, const int * rows, const double * elements, double columnLower=0.0, double columnUpper=COIN_DBL_MAX, double objective=0.0); /// Add columns void addColumns(int number, const double * columnLower, const double * columnUpper, const double * objective, const CoinBigIndex * columnStarts, const int * rows, const double * elements); void addColumns(int number, const double * columnLower, const double * columnUpper, const double * objective, const CoinBigIndex * columnStarts, const int * columnLengths, const int * rows, const double * elements); #ifndef CLP_NO_VECTOR void addColumns(int number, const double * columnLower, const double * columnUpper, const double * objective, const CoinPackedVectorBase * const * columns); #endif /** Add columns from a build object If tryPlusMinusOne then will try adding as +-1 matrix if no matrix exists. Returns number of errors e.g. duplicates */ int addColumns(const CoinBuild & buildObject,bool tryPlusMinusOne=false, bool checkDuplicates=true); /** Add columns from a model object. returns -1 if object in bad state (i.e. has row information) otherwise number of errors modelObject non const as can be regularized as part of build If tryPlusMinusOne then will try adding as +-1 matrix if no matrix exists. */ int addColumns(CoinModel & modelObject,bool tryPlusMinusOne=false, bool checkDuplicates=true); /// Modify one element of a matrix inline void modifyCoefficient(int row, int column, double newElement, bool keepZero=false) {matrix_->modifyCoefficient(row,column,newElement,keepZero);} /** Change row lower bounds */ void chgRowLower(const double * rowLower); /** Change row upper bounds */ void chgRowUpper(const double * rowUpper); /** Change column lower bounds */ void chgColumnLower(const double * columnLower); /** Change column upper bounds */ void chgColumnUpper(const double * columnUpper); /** Change objective coefficients */ void chgObjCoefficients(const double * objIn); /** Borrow model. This is so we don't have to copy large amounts of data around. It assumes a derived class wants to overwrite an empty model with a real one - while it does an algorithm */ void borrowModel(ClpModel & otherModel); /** Return model - nulls all arrays so can be deleted safely also updates any scalars */ void returnModel(ClpModel & otherModel); /// Create empty ClpPackedMatrix void createEmptyMatrix(); /** Really clean up matrix (if ClpPackedMatrix). a) eliminate all duplicate AND small elements in matrix b) remove all gaps and set extraGap_ and extraMajor_ to 0.0 c) reallocate arrays and make max lengths equal to lengths d) orders elements returns number of elements eliminated or -1 if not ClpPackedMatrix */ int cleanMatrix(double threshold=1.0e-20); /// Copy contents - resizing if necessary - otherwise re-use memory void copy(const ClpMatrixBase * from, ClpMatrixBase * & to); #ifndef CLP_NO_STD /// Drops names - makes lengthnames 0 and names empty void dropNames(); /// Copies in names void copyNames(std::vector & rowNames, std::vector & columnNames); /// Copies in Row names - modifies names first .. last-1 void copyRowNames(const std::vector & rowNames,int first, int last); /// Copies in Column names - modifies names first .. last-1 void copyColumnNames(const std::vector & columnNames, int first, int last); /// Copies in Row names - modifies names first .. last-1 void copyRowNames(const char * const * rowNames,int first, int last); /// Copies in Column names - modifies names first .. last-1 void copyColumnNames(const char * const * columnNames, int first, int last); /// Set name of row void setRowName(int rowIndex, std::string & name) ; /// Set name of col void setColumnName(int colIndex, std::string & name) ; #endif /** Find a network subset. rotate array should be numberRows. On output -1 not in network 0 in network as is 1 in network with signs swapped Returns number of network rows */ int findNetwork(char * rotate, double fractionNeeded=0.75); /** This creates a coinModel object */ CoinModel * createCoinModel() const; /** Write the problem in MPS format to the specified file. Row and column names may be null. formatType is
  • 0 - normal
  • 1 - extra accuracy
  • 2 - IEEE hex
Returns non-zero on I/O error */ int writeMps(const char *filename, int formatType=0,int numberAcross=2, double objSense=0.0) const ; //@} /**@name gets and sets */ //@{ /// Number of rows inline int numberRows() const { return numberRows_; } inline int getNumRows() const { return numberRows_; } /// Number of columns inline int getNumCols() const { return numberColumns_; } inline int numberColumns() const { return numberColumns_; } /// Primal tolerance to use inline double primalTolerance() const { return dblParam_[ClpPrimalTolerance]; } void setPrimalTolerance( double value) ; /// Dual tolerance to use inline double dualTolerance() const { return dblParam_[ClpDualTolerance]; } void setDualTolerance( double value) ; /// Primal objective limit inline double primalObjectiveLimit() const { return dblParam_[ClpPrimalObjectiveLimit];} void setPrimalObjectiveLimit(double value); /// Dual objective limit inline double dualObjectiveLimit() const { return dblParam_[ClpDualObjectiveLimit];} void setDualObjectiveLimit(double value); /// Objective offset inline double objectiveOffset() const { return dblParam_[ClpObjOffset];} void setObjectiveOffset(double value); /// Presolve tolerance to use inline double presolveTolerance() const { return dblParam_[ClpPresolveTolerance];} #ifndef CLP_NO_STD inline std::string problemName() const { return strParam_[ClpProbName]; } #endif /// Number of iterations inline int numberIterations() const { return numberIterations_; } inline int getIterationCount() const { return numberIterations_; } inline void setNumberIterations(int numberIterations) { numberIterations_ = numberIterations;} /** Solve type - 1 simplex, 2 simplex interface, 3 Interior.*/ inline int solveType() const { return solveType_;} inline void setSolveType(int type) { solveType_=type;} /// Maximum number of iterations inline int maximumIterations() const { return intParam_[ClpMaxNumIteration]; } void setMaximumIterations(int value); /// Maximum time in seconds (from when set called) inline double maximumSeconds() const { return dblParam_[ClpMaxSeconds]; } void setMaximumSeconds(double value); /// Returns true if hit maximum iterations (or time) bool hitMaximumIterations() const; /** Status of problem: -1 - unknown e.g. before solve or if postSolve says not optimal 0 - optimal 1 - primal infeasible 2 - dual infeasible 3 - stopped on iterations or time 4 - stopped due to errors 5 - stopped by event handler (virtual int ClpEventHandler::event()) */ inline int status() const { return problemStatus_; } inline int problemStatus() const { return problemStatus_; } /// Set problem status inline void setProblemStatus(int problemStatus) { problemStatus_ = problemStatus;} /** Secondary status of problem - may get extended 0 - none 1 - primal infeasible because dual limit reached OR probably primal infeasible but can't prove it (main status 4) 2 - scaled problem optimal - unscaled problem has primal infeasibilities 3 - scaled problem optimal - unscaled problem has dual infeasibilities 4 - scaled problem optimal - unscaled problem has primal and dual infeasibilities 5 - giving up in primal with flagged variables 6 - failed due to empty problem check 7 - postSolve says not optimal 8 - failed due to bad element check 9 - status was 3 and stopped on time 100 up - translation of enum from ClpEventHandler */ inline int secondaryStatus() const { return secondaryStatus_; } inline void setSecondaryStatus(int status) { secondaryStatus_ = status;} /// Are there a numerical difficulties? inline bool isAbandoned() const { return problemStatus_==4; } /// Is optimality proven? inline bool isProvenOptimal() const { return problemStatus_==0; } /// Is primal infeasiblity proven? inline bool isProvenPrimalInfeasible() const { return problemStatus_==1; } /// Is dual infeasiblity proven? inline bool isProvenDualInfeasible() const { return problemStatus_==2; } /// Is the given primal objective limit reached? bool isPrimalObjectiveLimitReached() const ; /// Is the given dual objective limit reached? bool isDualObjectiveLimitReached() const ; /// Iteration limit reached? inline bool isIterationLimitReached() const { return problemStatus_==3; } /// Direction of optimization (1 - minimize, -1 - maximize, 0 - ignore inline double optimizationDirection() const { return optimizationDirection_; } inline double getObjSense() const { return optimizationDirection_; } void setOptimizationDirection(double value); /// Primal row solution inline double * primalRowSolution() const { return rowActivity_; } inline const double * getRowActivity() const { return rowActivity_; } /// Primal column solution inline double * primalColumnSolution() const { return columnActivity_; } inline const double * getColSolution() const { return columnActivity_; } inline void setColSolution(const double * input) { memcpy(columnActivity_,input,numberColumns_*sizeof(double));} /// Dual row solution inline double * dualRowSolution() const { return dual_; } inline const double * getRowPrice() const { return dual_; } /// Reduced costs inline double * dualColumnSolution() const { return reducedCost_; } inline const double * getReducedCost() const { return reducedCost_; } /// Row lower inline double* rowLower() const { return rowLower_; } inline const double* getRowLower() const { return rowLower_; } /// Row upper inline double* rowUpper() const { return rowUpper_; } inline const double* getRowUpper() const { return rowUpper_; } //------------------------------------------------------------------------- /**@name Changing bounds on variables and constraints */ //@{ /** Set an objective function coefficient */ void setObjectiveCoefficient( int elementIndex, double elementValue ); /** Set an objective function coefficient */ inline void setObjCoeff( int elementIndex, double elementValue ) { setObjectiveCoefficient( elementIndex, elementValue);} /** Set a single column lower bound
Use -DBL_MAX for -infinity. */ void setColumnLower( int elementIndex, double elementValue ); /** Set a single column upper bound
Use DBL_MAX for infinity. */ void setColumnUpper( int elementIndex, double elementValue ); /** Set a single column lower and upper bound */ void setColumnBounds( int elementIndex, double lower, double upper ); /** Set the bounds on a number of columns simultaneously
The default implementation just invokes setColLower() and setColUpper() over and over again. @param indexFirst,indexLast pointers to the beginning and after the end of the array of the indices of the variables whose either bound changes @param boundList the new lower/upper bound pairs for the variables */ void setColumnSetBounds(const int* indexFirst, const int* indexLast, const double* boundList); /** Set a single column lower bound
Use -DBL_MAX for -infinity. */ inline void setColLower( int elementIndex, double elementValue ) { setColumnLower(elementIndex, elementValue);} /** Set a single column upper bound
Use DBL_MAX for infinity. */ inline void setColUpper( int elementIndex, double elementValue ) { setColumnUpper(elementIndex, elementValue);} /** Set a single column lower and upper bound */ inline void setColBounds( int elementIndex, double lower, double upper ) { setColumnBounds(elementIndex, lower, upper);} /** Set the bounds on a number of columns simultaneously
@param indexFirst,indexLast pointers to the beginning and after the end of the array of the indices of the variables whose either bound changes @param boundList the new lower/upper bound pairs for the variables */ inline void setColSetBounds(const int* indexFirst, const int* indexLast, const double* boundList) { setColumnSetBounds(indexFirst, indexLast, boundList);} /** Set a single row lower bound
Use -DBL_MAX for -infinity. */ void setRowLower( int elementIndex, double elementValue ); /** Set a single row upper bound
Use DBL_MAX for infinity. */ void setRowUpper( int elementIndex, double elementValue ) ; /** Set a single row lower and upper bound */ void setRowBounds( int elementIndex, double lower, double upper ) ; /** Set the bounds on a number of rows simultaneously
@param indexFirst,indexLast pointers to the beginning and after the end of the array of the indices of the constraints whose either bound changes @param boundList the new lower/upper bound pairs for the constraints */ void setRowSetBounds(const int* indexFirst, const int* indexLast, const double* boundList); //@} /// Scaling inline const double * rowScale() const {return rowScale_;} inline const double * columnScale() const {return columnScale_;} inline const double * inverseRowScale() const {return inverseRowScale_;} inline const double * inverseColumnScale() const {return inverseColumnScale_;} inline double * mutableRowScale() const {return rowScale_;} inline double * mutableColumnScale() const {return columnScale_;} inline double * mutableInverseRowScale() const {return inverseRowScale_;} inline double * mutableInverseColumnScale() const {return inverseColumnScale_;} void setRowScale(double * scale) ; void setColumnScale(double * scale); /// Scaling of objective inline double objectiveScale() const { return objectiveScale_;} inline void setObjectiveScale(double value) { objectiveScale_ = value;} /// Scaling of rhs and bounds inline double rhsScale() const { return rhsScale_;} inline void setRhsScale(double value) { rhsScale_ = value;} /// Sets or unsets scaling, 0 -off, 1 equilibrium, 2 geometric, 3 auto, 4 auto-but-as-initialSolve-in-bab void scaling(int mode=1); /** If we constructed a "really" scaled model then this reverses the operation. Quantities may not be exactly as they were before due to rounding errors */ void unscale(); /// Gets scalingFlag inline int scalingFlag() const {return scalingFlag_;} /// Objective inline double * objective() const { if (objective_) { double offset; return objective_->gradient(NULL,NULL,offset,false); } else { return NULL; } } inline double * objective(const double * solution, double & offset,bool refresh=true) const { offset=0.0; if (objective_) { return objective_->gradient(NULL,solution,offset,refresh); } else { return NULL; } } inline const double * getObjCoefficients() const { if (objective_) { double offset; return objective_->gradient(NULL,NULL,offset,false); } else { return NULL; } } /// Row Objective inline double * rowObjective() const { return rowObjective_; } inline const double * getRowObjCoefficients() const { return rowObjective_; } /// Column Lower inline double * columnLower() const { return columnLower_; } inline const double * getColLower() const { return columnLower_; } /// Column Upper inline double * columnUpper() const { return columnUpper_; } inline const double * getColUpper() const { return columnUpper_; } /// Matrix (if not ClpPackedmatrix be careful about memory leak inline CoinPackedMatrix * matrix() const { if ( matrix_ == NULL ) return NULL; else return matrix_->getPackedMatrix(); } /// Number of elements in matrix inline int getNumElements() const { return matrix_->getNumElements();} /** Small element value - elements less than this set to zero, default is 1.0e-20 */ inline double getSmallElementValue() const { return smallElement_;} inline void setSmallElementValue(double value) { smallElement_=value;} /// Row Matrix inline ClpMatrixBase * rowCopy() const { return rowCopy_; } /// Clp Matrix inline ClpMatrixBase * clpMatrix() const { return matrix_; } /// Scaled ClpPackedMatrix inline ClpPackedMatrix * clpScaledMatrix() const { return scaledMatrix_; } /// Sets pointer to scaled ClpPackedMatrix inline void setClpScaledMatrix(ClpPackedMatrix * scaledMatrix) { delete scaledMatrix_; scaledMatrix_=scaledMatrix; } /** Replace Clp Matrix (current is not deleted unless told to and new is used) So up to user to delete current. This was used where matrices were being rotated. ClpModel takes ownership. */ void replaceMatrix(ClpMatrixBase * matrix,bool deleteCurrent=false); /** Replace Clp Matrix (current is not deleted unless told to and new is used) So up to user to delete current. This was used where matrices were being rotated. This version changes CoinPackedMatrix to ClpPackedMatrix. ClpModel takes ownership. */ inline void replaceMatrix(CoinPackedMatrix * matrix, bool deleteCurrent=false) { replaceMatrix(new ClpPackedMatrix(matrix),deleteCurrent);} /// Objective value inline double objectiveValue() const { return objectiveValue_*optimizationDirection_ - dblParam_[ClpObjOffset]; } inline void setObjectiveValue(double value) { objectiveValue_ = (value+ dblParam_[ClpObjOffset])/optimizationDirection_; } inline double getObjValue() const { return objectiveValue_*optimizationDirection_ - dblParam_[ClpObjOffset]; } /// Integer information inline char * integerInformation() const { return integerType_; } /** Infeasibility/unbounded ray (NULL returned if none/wrong) Up to user to use delete [] on these arrays. */ double * infeasibilityRay() const; double * unboundedRay() const; /// See if status (i.e. basis) array exists (partly for OsiClp) inline bool statusExists() const { return (status_!=NULL);} /// Return address of status (i.e. basis) array (char[numberRows+numberColumns]) inline unsigned char * statusArray() const { return status_;} /** Return copy of status (i.e. basis) array (char[numberRows+numberColumns]), use delete [] */ unsigned char * statusCopy() const; /// Copy in status (basis) vector void copyinStatus(const unsigned char * statusArray); /// User pointer for whatever reason inline void setUserPointer (void * pointer) { userPointer_=pointer;} inline void * getUserPointer () const { return userPointer_;} /// What has changed in model (only for masochistic users) inline int whatsChanged() const { return whatsChanged_;} inline void setWhatsChanged(int value) { whatsChanged_ = value;} /// Number of threads (not really being used) inline int numberThreads() const { return numberThreads_;} inline void setNumberThreads(int value) { numberThreads_ = value;} //@} /**@name Message handling */ //@{ /// Pass in Message handler (not deleted at end) void passInMessageHandler(CoinMessageHandler * handler); /// Pass in Message handler (not deleted at end) and return current CoinMessageHandler * pushMessageHandler(CoinMessageHandler * handler, bool & oldDefault); /// back to previous message handler void popMessageHandler(CoinMessageHandler * oldHandler,bool oldDefault); /// Set language void newLanguage(CoinMessages::Language language); inline void setLanguage(CoinMessages::Language language) { newLanguage(language); } /// Return handler inline CoinMessageHandler * messageHandler() const { return handler_; } /// Return messages inline CoinMessages messages() const { return messages_; } /// Return pointer to messages inline CoinMessages * messagesPointer() { return & messages_; } /// Return Coin messages inline CoinMessages coinMessages() const { return coinMessages_; } /// Return pointer to Coin messages inline CoinMessages * coinMessagesPointer() { return & coinMessages_; } /** Amount of print out: 0 - none 1 - just final 2 - just factorizations 3 - as 2 plus a bit more 4 - verbose above that 8,16,32 etc just for selective debug */ inline void setLogLevel(int value) { handler_->setLogLevel(value); } inline int logLevel() const { return handler_->logLevel(); } /// Return true if default handler inline bool defaultHandler() const { return defaultHandler_;} /// Pass in Event handler (cloned and deleted at end) void passInEventHandler(const ClpEventHandler * eventHandler); /// Event handler inline ClpEventHandler * eventHandler() const { return eventHandler_;} /// Thread specific random number generator inline CoinThreadRandom * randomNumberGenerator() { return &randomNumberGenerator_;} /// Thread specific random number generator inline CoinThreadRandom & mutableRandomNumberGenerator() { return randomNumberGenerator_;} /// Set seed for thread specific random number generator inline void setRandomSeed(int value) { randomNumberGenerator_.setSeed(value);} /// length of names (0 means no names0 inline int lengthNames() const { return lengthNames_; } #ifndef CLP_NO_STD /// length of names (0 means no names0 inline void setLengthNames(int value) { lengthNames_=value; } /// Row names inline const std::vector * rowNames() const { return &rowNames_; } inline const std::string& rowName(int iRow) const { return rowNames_[iRow]; } /// Return name or Rnnnnnnn std::string getRowName(int iRow) const; /// Column names inline const std::vector * columnNames() const { return &columnNames_; } inline const std::string& columnName(int iColumn) const { return columnNames_[iColumn]; } /// Return name or Cnnnnnnn std::string getColumnName(int iColumn) const; #endif /// Objective methods inline ClpObjective * objectiveAsObject() const { return objective_;} void setObjective(ClpObjective * objective); inline void setObjectivePointer(ClpObjective * objective) { objective_ = objective;} /** Solve a problem with no elements - return status and dual and primal infeasibilites */ int emptyProblem(int * infeasNumber=NULL, double * infeasSum=NULL,bool printMessage=true); //@} /**@name Matrix times vector methods They can be faster if scalar is +- 1 These are covers so user need not worry about scaling Also for simplex I am not using basic/non-basic split */ //@{ /** Return y + A * x * scalar in y. @pre x must be of size numColumns() @pre y must be of size numRows() */ void times(double scalar, const double * x, double * y) const; /** Return y + x * scalar * A in y. @pre x must be of size numRows() @pre y must be of size numColumns() */ void transposeTimes(double scalar, const double * x, double * y) const ; //@} //--------------------------------------------------------------------------- /**@name Parameter set/get methods The set methods return true if the parameter was set to the given value, false otherwise. There can be various reasons for failure: the given parameter is not applicable for the solver (e.g., refactorization frequency for the volume algorithm), the parameter is not yet implemented for the solver or simply the value of the parameter is out of the range the solver accepts. If a parameter setting call returns false check the details of your solver. The get methods return true if the given parameter is applicable for the solver and is implemented. In this case the value of the parameter is returned in the second argument. Otherwise they return false. ** once it has been decided where solver sits this may be redone */ //@{ /// Set an integer parameter bool setIntParam(ClpIntParam key, int value) ; /// Set an double parameter bool setDblParam(ClpDblParam key, double value) ; #ifndef CLP_NO_STD /// Set an string parameter bool setStrParam(ClpStrParam key, const std::string & value); #endif // Get an integer parameter inline bool getIntParam(ClpIntParam key, int& value) const { if (key rowNames_; /// Column names std::vector columnNames_; #endif /// Messages CoinMessages messages_; /// Coin messages CoinMessages coinMessages_; /// Maximum number of columns in model int maximumColumns_; /// Maximum number of rows in model int maximumRows_; /// Maximum number of columns (internal arrays) in model int maximumInternalColumns_; /// Maximum number of rows (internal arrays) in model int maximumInternalRows_; /// Base packed matrix CoinPackedMatrix baseMatrix_; /// Base row copy CoinPackedMatrix baseRowCopy_; /// Saved row scale factors for matrix double * savedRowScale_; /// Saved column scale factors double * savedColumnScale_; #ifndef CLP_NO_STD /// Array of string parameters std::string strParam_[ClpLastStrParam]; #endif //@} }; /** This is a tiny class where data can be saved round calls. */ class ClpDataSave { public: /**@name Constructors and destructor */ //@{ /// Default constructor ClpDataSave ( ); /// Copy constructor. ClpDataSave(const ClpDataSave &); /// Assignment operator. This copies the data ClpDataSave & operator=(const ClpDataSave & rhs); /// Destructor ~ClpDataSave ( ); //@} ////////////////// data ////////////////// public: /**@name data - with same names as in other classes*/ //@{ double dualBound_; double infeasibilityCost_; double pivotTolerance_; double acceptablePivot_; double objectiveScale_; int sparseThreshold_; int perturbation_; int forceFactorization_; int scalingFlag_; unsigned int specialOptions_; //@} }; #endif