- Main Page
- Namespaces
- Classes
- Files
- Directories

- Search for |

- File List
- File Members

# ClpModel.hpp

Go to the documentation of this file.

    00001 /* $Id: ClpModel.hpp 1753 2011-06-19 16:27:26Z stefan $ */
    00002 // Copyright (C) 2002, International Business Machines
    00003 // Corporation and others.  All Rights Reserved.
    00004 // This code is licensed under the terms of the Eclipse Public License (EPL).
    00005
    00006 #ifndef ClpModel_H
    00007 #define ClpModel_H
    00008
    00009 #include "ClpConfig.h"
    00010
    00011 #include <iostream>
    00012 #include <cassert>
    00013 #include <cmath>
    00014 #include <vector>
    00015 #include <string>
    00016 //#ifndef COIN_USE_CLP
    00017 //#define COIN_USE_CLP
    00018 //#endif
    00019 #include "ClpPackedMatrix.hpp"
    00020 #include "CoinMessageHandler.hpp"
    00021 #include "CoinHelperFunctions.hpp"
    00022 #include "CoinTypes.hpp"
    00023 #include "CoinFinite.hpp"
    00024 #include "ClpParameters.hpp"
    00025 #include "ClpObjective.hpp"
    00026 class ClpEventHandler;
    00036 class CoinBuild;
    00037 class CoinModel;
    00038 class ClpModel {
    00039
    00040 public:
    00041
    00047
    00048      ClpModel (bool emptyMessages = false  );
    00049
    00054      ClpModel(const ClpModel & rhs, int scalingMode = -1);
    00056      ClpModel & operator=(const ClpModel & rhs);
    00061      ClpModel (const ClpModel * wholeModel,
    00062                int numberRows, const int * whichRows,
    00063                int numberColumns, const int * whichColumns,
    00064                bool dropNames = true, bool dropIntegers = true);
    00066      ~ClpModel (  );
    00068
    00082      void loadProblem (  const ClpMatrixBase& matrix,
    00083                          const double* collb, const double* colub,
    00084                          const double* obj,
    00085                          const double* rowlb, const double* rowub,
    00086                          const double * rowObjective = NULL);
    00087      void loadProblem (  const CoinPackedMatrix& matrix,
    00088                          const double* collb, const double* colub,
    00089                          const double* obj,
    00090                          const double* rowlb, const double* rowub,
    00091                          const double * rowObjective = NULL);
    00092
    00095      void loadProblem (  const int numcols, const int numrows,
    00096                          const CoinBigIndex* start, const int* index,
    00097                          const double* value,
    00098                          const double* collb, const double* colub,
    00099                          const double* obj,
    00100                          const double* rowlb, const double* rowub,
    00101                          const double * rowObjective = NULL);
    00107      int loadProblem (  CoinModel & modelObject, bool tryPlusMinusOne = false);
    00109      void loadProblem (  const int numcols, const int numrows,
    00110                          const CoinBigIndex* start, const int* index,
    00111                          const double* value, const int * length,
    00112                          const double* collb, const double* colub,
    00113                          const double* obj,
    00114                          const double* rowlb, const double* rowub,
    00115                          const double * rowObjective = NULL);
    00117      void loadQuadraticObjective(const int numberColumns,
    00118                                  const CoinBigIndex * start,
    00119                                  const int * column, const double * element);
    00120      void loadQuadraticObjective (  const CoinPackedMatrix& matrix);
    00122      void deleteQuadraticObjective();
    00124      void setRowObjective(const double * rowObjective);
    00126      int readMps(const char *filename,
    00127                  bool keepNames = false,
    00128                  bool ignoreErrors = false);
    00130      int readGMPL(const char *filename, const char * dataName,
    00131                   bool keepNames = false);
    00133      void copyInIntegerInformation(const char * information);
    00135      void deleteIntegerInformation();
    00137      void setContinuous(int index);
    00139      void setInteger(int index);
    00141      bool isInteger(int index) const;
    00143      void resize (int newNumberRows, int newNumberColumns);
    00145      void deleteRows(int number, const int * which);
    00147      void addRow(int numberInRow, const int * columns,
    00148                  const double * elements, double rowLower = -COIN_DBL_MAX,
    00149                  double rowUpper = COIN_DBL_MAX);
    00151      void addRows(int number, const double * rowLower,
    00152                   const double * rowUpper,
    00153                   const CoinBigIndex * rowStarts, const int * columns,
    00154                   const double * elements);
    00156      void addRows(int number, const double * rowLower,
    00157                   const double * rowUpper,
    00158                   const CoinBigIndex * rowStarts, const int * rowLengths,
    00159                   const int * columns,
    00160                   const double * elements);
    00161 #ifndef CLP_NO_VECTOR
    00162      void addRows(int number, const double * rowLower,
    00163                   const double * rowUpper,
    00164                   const CoinPackedVectorBase * const * rows);
    00165 #endif
    00166
    00171      int addRows(const CoinBuild & buildObject, bool tryPlusMinusOne = false,
    00172                  bool checkDuplicates = true);
    00181      int addRows(CoinModel & modelObject, bool tryPlusMinusOne = false,
    00182                  bool checkDuplicates = true);
    00183
    00185      void deleteColumns(int number, const int * which);
    00187      void addColumn(int numberInColumn,
    00188                     const int * rows,
    00189                     const double * elements,
    00190                     double columnLower = 0.0,
    00191                     double  columnUpper = COIN_DBL_MAX,
    00192                     double  objective = 0.0);
    00194      void addColumns(int number, const double * columnLower,
    00195                      const double * columnUpper,
    00196                      const double * objective,
    00197                      const CoinBigIndex * columnStarts, const int * rows,
    00198                      const double * elements);
    00199      void addColumns(int number, const double * columnLower,
    00200                      const double * columnUpper,
    00201                      const double * objective,
    00202                      const CoinBigIndex * columnStarts, const int * columnLengths,
    00203                      const int * rows,
    00204                      const double * elements);
    00205 #ifndef CLP_NO_VECTOR
    00206      void addColumns(int number, const double * columnLower,
    00207                      const double * columnUpper,
    00208                      const double * objective,
    00209                      const CoinPackedVectorBase * const * columns);
    00210 #endif
    00211
    00216      int addColumns(const CoinBuild & buildObject, bool tryPlusMinusOne = false,
    00217                     bool checkDuplicates = true);
    00225      int addColumns(CoinModel & modelObject, bool tryPlusMinusOne = false,
    00226                     bool checkDuplicates = true);
    00228      inline void modifyCoefficient(int row, int column, double newElement,
    00229                                    bool keepZero = false) {
    00230           matrix_->modifyCoefficient(row, column, newElement, keepZero);
    00231      }
    00233      void chgRowLower(const double * rowLower);
    00235      void chgRowUpper(const double * rowUpper);
    00237      void chgColumnLower(const double * columnLower);
    00239      void chgColumnUpper(const double * columnUpper);
    00241      void chgObjCoefficients(const double * objIn);
    00245      void borrowModel(ClpModel & otherModel);
    00248      void returnModel(ClpModel & otherModel);
    00249
    00251      void createEmptyMatrix();
    00259      int cleanMatrix(double threshold = 1.0e-20);
    00261      void copy(const ClpMatrixBase * from, ClpMatrixBase * & to);
    00262 #ifndef CLP_NO_STD
    00264      void dropNames();
    00266      void copyNames(std::vector<std::string> & rowNames,
    00267                     std::vector<std::string> & columnNames);
    00269      void copyRowNames(const std::vector<std::string> & rowNames, int first, int last);
    00271      void copyColumnNames(const std::vector<std::string> & columnNames, int first, int last);
    00273      void copyRowNames(const char * const * rowNames, int first, int last);
    00275      void copyColumnNames(const char * const * columnNames, int first, int last);
    00277      void setRowName(int rowIndex, std::string & name) ;
    00279      void setColumnName(int colIndex, std::string & name) ;
    00280 #endif
    00281
    00288      int findNetwork(char * rotate, double fractionNeeded = 0.75);
    00291      CoinModel * createCoinModel() const;
    00292
    00305      int writeMps(const char *filename,
    00306                   int formatType = 0, int numberAcross = 2,
    00307                   double objSense = 0.0) const ;
    00309
    00311
    00312      inline int numberRows() const {
    00313           return numberRows_;
    00314      }
    00315      inline int getNumRows() const {
    00316           return numberRows_;
    00317      }
    00319      inline int getNumCols() const {
    00320           return numberColumns_;
    00321      }
    00322      inline int numberColumns() const {
    00323           return numberColumns_;
    00324      }
    00326      inline double primalTolerance() const {
    00327           return dblParam_[ClpPrimalTolerance];
    00328      }
    00329      void setPrimalTolerance( double value) ;
    00331      inline double dualTolerance() const  {
    00332           return dblParam_[ClpDualTolerance];
    00333      }
    00334      void setDualTolerance( double value) ;
    00336      inline double primalObjectiveLimit() const {
    00337           return dblParam_[ClpPrimalObjectiveLimit];
    00338      }
    00339      void setPrimalObjectiveLimit(double value);
    00341      inline double dualObjectiveLimit() const {
    00342           return dblParam_[ClpDualObjectiveLimit];
    00343      }
    00344      void setDualObjectiveLimit(double value);
    00346      inline double objectiveOffset() const {
    00347           return dblParam_[ClpObjOffset];
    00348      }
    00349      void setObjectiveOffset(double value);
    00351      inline double presolveTolerance() const {
    00352           return dblParam_[ClpPresolveTolerance];
    00353      }
    00354 #ifndef CLP_NO_STD
    00355      inline std::string problemName() const {
    00356           return strParam_[ClpProbName];
    00357      }
    00358 #endif
    00360      inline int numberIterations() const  {
    00361           return numberIterations_;
    00362      }
    00363      inline int getIterationCount() const {
    00364           return numberIterations_;
    00365      }
    00366      inline void setNumberIterations(int numberIterationsNew) {
    00367           numberIterations_ = numberIterationsNew;
    00368      }
    00370      inline int solveType() const {
    00371           return solveType_;
    00372      }
    00373      inline void setSolveType(int type) {
    00374           solveType_ = type;
    00375      }
    00377      inline int maximumIterations() const {
    00378           return intParam_[ClpMaxNumIteration];
    00379      }
    00380      void setMaximumIterations(int value);
    00382      inline double maximumSeconds() const {
    00383           return dblParam_[ClpMaxSeconds];
    00384      }
    00385      void setMaximumSeconds(double value);
    00387      bool hitMaximumIterations() const;
    00397      inline int status() const            {
    00398           return problemStatus_;
    00399      }
    00400      inline int problemStatus() const            {
    00401           return problemStatus_;
    00402      }
    00404      inline void setProblemStatus(int problemStatusNew) {
    00405           problemStatus_ = problemStatusNew;
    00406      }
    00421      inline int secondaryStatus() const            {
    00422           return secondaryStatus_;
    00423      }
    00424      inline void setSecondaryStatus(int newstatus) {
    00425           secondaryStatus_ = newstatus;
    00426      }
    00428      inline bool isAbandoned() const             {
    00429           return problemStatus_ == 4;
    00430      }
    00432      inline bool isProvenOptimal() const         {
    00433           return problemStatus_ == 0;
    00434      }
    00436      inline bool isProvenPrimalInfeasible() const {
    00437           return problemStatus_ == 1;
    00438      }
    00440      inline bool isProvenDualInfeasible() const  {
    00441           return problemStatus_ == 2;
    00442      }
    00444      bool isPrimalObjectiveLimitReached() const ;
    00446      bool isDualObjectiveLimitReached() const ;
    00448      inline bool isIterationLimitReached() const {
    00449           return problemStatus_ == 3;
    00450      }
    00452      inline double optimizationDirection() const {
    00453           return  optimizationDirection_;
    00454      }
    00455      inline double getObjSense() const    {
    00456           return optimizationDirection_;
    00457      }
    00458      void setOptimizationDirection(double value);
    00460      inline double * primalRowSolution() const    {
    00461           return rowActivity_;
    00462      }
    00463      inline const double * getRowActivity() const {
    00464           return rowActivity_;
    00465      }
    00467      inline double * primalColumnSolution() const {
    00468           return columnActivity_;
    00469      }
    00470      inline const double * getColSolution() const {
    00471           return columnActivity_;
    00472      }
    00473      inline void setColSolution(const double * input) {
    00474           memcpy(columnActivity_, input, numberColumns_ * sizeof(double));
    00475      }
    00477      inline double * dualRowSolution() const      {
    00478           return dual_;
    00479      }
    00480      inline const double * getRowPrice() const    {
    00481           return dual_;
    00482      }
    00484      inline double * dualColumnSolution() const   {
    00485           return reducedCost_;
    00486      }
    00487      inline const double * getReducedCost() const {
    00488           return reducedCost_;
    00489      }
    00491      inline double* rowLower() const              {
    00492           return rowLower_;
    00493      }
    00494      inline const double* getRowLower() const     {
    00495           return rowLower_;
    00496      }
    00498      inline double* rowUpper() const              {
    00499           return rowUpper_;
    00500      }
    00501      inline const double* getRowUpper() const     {
    00502           return rowUpper_;
    00503      }
    00504      //-------------------------------------------------------------------------
    00508      void setObjectiveCoefficient( int elementIndex, double elementValue );
    00510      inline void setObjCoeff( int elementIndex, double elementValue ) {
    00511           setObjectiveCoefficient( elementIndex, elementValue);
    00512      }
    00513
    00516      void setColumnLower( int elementIndex, double elementValue );
    00517
    00520      void setColumnUpper( int elementIndex, double elementValue );
    00521
    00523      void setColumnBounds( int elementIndex,
    00524                            double lower, double upper );
    00525
    00534      void setColumnSetBounds(const int* indexFirst,
    00535                              const int* indexLast,
    00536                              const double* boundList);
    00537
    00540      inline void setColLower( int elementIndex, double elementValue ) {
    00541           setColumnLower(elementIndex, elementValue);
    00542      }
    00545      inline void setColUpper( int elementIndex, double elementValue ) {
    00546           setColumnUpper(elementIndex, elementValue);
    00547      }
    00548
    00550      inline void setColBounds( int elementIndex,
    00551                                double lower, double upper ) {
    00552           setColumnBounds(elementIndex, lower, upper);
    00553      }
    00554
    00561      inline void setColSetBounds(const int* indexFirst,
    00562                                  const int* indexLast,
    00563                                  const double* boundList) {
    00564           setColumnSetBounds(indexFirst, indexLast, boundList);
    00565      }
    00566
    00569      void setRowLower( int elementIndex, double elementValue );
    00570
    00573      void setRowUpper( int elementIndex, double elementValue ) ;
    00574
    00576      void setRowBounds( int elementIndex,
    00577                         double lower, double upper ) ;
    00578
    00585      void setRowSetBounds(const int* indexFirst,
    00586                           const int* indexLast,
    00587                           const double* boundList);
    00588
    00590
    00591      inline const double * rowScale() const {
    00592           return rowScale_;
    00593      }
    00594      inline const double * columnScale() const {
    00595           return columnScale_;
    00596      }
    00597      inline const double * inverseRowScale() const {
    00598           return inverseRowScale_;
    00599      }
    00600      inline const double * inverseColumnScale() const {
    00601           return inverseColumnScale_;
    00602      }
    00603      inline double * mutableRowScale() const {
    00604           return rowScale_;
    00605      }
    00606      inline double * mutableColumnScale() const {
    00607           return columnScale_;
    00608      }
    00609      inline double * mutableInverseRowScale() const {
    00610           return inverseRowScale_;
    00611      }
    00612      inline double * mutableInverseColumnScale() const {
    00613           return inverseColumnScale_;
    00614      }
    00615      void setRowScale(double * scale) ;
    00616      void setColumnScale(double * scale);
    00618      inline double objectiveScale() const {
    00619           return objectiveScale_;
    00620      }
    00621      inline void setObjectiveScale(double value) {
    00622           objectiveScale_ = value;
    00623      }
    00625      inline double rhsScale() const {
    00626           return rhsScale_;
    00627      }
    00628      inline void setRhsScale(double value) {
    00629           rhsScale_ = value;
    00630      }
    00632      void scaling(int mode = 1);
    00635      void unscale();
    00637      inline int scalingFlag() const {
    00638           return scalingFlag_;
    00639      }
    00641      inline double * objective() const {
    00642           if (objective_) {
    00643                double offset;
    00644                return objective_->gradient(NULL, NULL, offset, false);
    00645           } else {
    00646                return NULL;
    00647           }
    00648      }
    00649      inline double * objective(const double * solution, double & offset, bool refresh = true) const {
    00650           offset = 0.0;
    00651           if (objective_) {
    00652                return objective_->gradient(NULL, solution, offset, refresh);
    00653           } else {
    00654                return NULL;
    00655           }
    00656      }
    00657      inline const double * getObjCoefficients() const {
    00658           if (objective_) {
    00659                double offset;
    00660                return objective_->gradient(NULL, NULL, offset, false);
    00661           } else {
    00662                return NULL;
    00663           }
    00664      }
    00666      inline double * rowObjective() const         {
    00667           return rowObjective_;
    00668      }
    00669      inline const double * getRowObjCoefficients() const {
    00670           return rowObjective_;
    00671      }
    00673      inline double * columnLower() const          {
    00674           return columnLower_;
    00675      }
    00676      inline const double * getColLower() const    {
    00677           return columnLower_;
    00678      }
    00680      inline double * columnUpper() const          {
    00681           return columnUpper_;
    00682      }
    00683      inline const double * getColUpper() const    {
    00684           return columnUpper_;
    00685      }
    00687      inline CoinPackedMatrix * matrix() const {
    00688           if ( matrix_ == NULL ) return NULL;
    00689           else return matrix_->getPackedMatrix();
    00690      }
    00692      inline int getNumElements() const {
    00693           return matrix_->getNumElements();
    00694      }
    00697      inline double getSmallElementValue() const {
    00698           return smallElement_;
    00699      }
    00700      inline void setSmallElementValue(double value) {
    00701           smallElement_ = value;
    00702      }
    00704      inline ClpMatrixBase * rowCopy() const       {
    00705           return rowCopy_;
    00706      }
    00708      void setNewRowCopy(ClpMatrixBase * newCopy);
    00710      inline ClpMatrixBase * clpMatrix() const     {
    00711           return matrix_;
    00712      }
    00714      inline ClpPackedMatrix * clpScaledMatrix() const     {
    00715           return scaledMatrix_;
    00716      }
    00718      inline void setClpScaledMatrix(ClpPackedMatrix * scaledMatrix) {
    00719           delete scaledMatrix_;
    00720           scaledMatrix_ = scaledMatrix;
    00721      }
    00727      void replaceMatrix(ClpMatrixBase * matrix, bool deleteCurrent = false);
    00733      inline void replaceMatrix(CoinPackedMatrix * newmatrix,
    00734                                bool deleteCurrent = false) {
    00735           replaceMatrix(new ClpPackedMatrix(newmatrix), deleteCurrent);
    00736      }
    00738      inline double objectiveValue() const {
    00739           return objectiveValue_ * optimizationDirection_ - dblParam_[ClpObjOffset];
    00740      }
    00741      inline void setObjectiveValue(double value) {
    00742           objectiveValue_ = (value + dblParam_[ClpObjOffset]) / optimizationDirection_;
    00743      }
    00744      inline double getObjValue() const {
    00745           return objectiveValue_ * optimizationDirection_ - dblParam_[ClpObjOffset];
    00746      }
    00748      inline char * integerInformation() const     {
    00749           return integerType_;
    00750      }
    00753      double * infeasibilityRay() const;
    00754      double * unboundedRay() const;
    00756      inline bool rayExists() const {
    00757          return (ray_!=NULL);
    00758      }
    00760      inline void deleteRay() {
    00761          delete [] ray_;
    00762          ray_=NULL;
    00763      }
    00765      inline bool statusExists() const {
    00766           return (status_ != NULL);
    00767      }
    00769      inline unsigned char *  statusArray() const {
    00770           return status_;
    00771      }
    00774      unsigned char *  statusCopy() const;
    00776      void copyinStatus(const unsigned char * statusArray);
    00777
    00779      inline void setUserPointer (void * pointer) {
    00780           userPointer_ = pointer;
    00781      }
    00782      inline void * getUserPointer () const {
    00783           return userPointer_;
    00784      }
    00786      inline void setTrustedUserPointer (ClpTrustedData * pointer) {
    00787           trustedUserPointer_ = pointer;
    00788      }
    00789      inline ClpTrustedData * getTrustedUserPointer () const {
    00790           return trustedUserPointer_;
    00791      }
    00793      inline int whatsChanged() const {
    00794           return whatsChanged_;
    00795      }
    00796      inline void setWhatsChanged(int value) {
    00797           whatsChanged_ = value;
    00798      }
    00800      inline int numberThreads() const {
    00801           return numberThreads_;
    00802      }
    00803      inline void setNumberThreads(int value) {
    00804           numberThreads_ = value;
    00805      }
    00807
    00809
    00810      void passInMessageHandler(CoinMessageHandler * handler);
    00812      CoinMessageHandler * pushMessageHandler(CoinMessageHandler * handler,
    00813                                              bool & oldDefault);
    00815      void popMessageHandler(CoinMessageHandler * oldHandler, bool oldDefault);
    00817      void newLanguage(CoinMessages::Language language);
    00818      inline void setLanguage(CoinMessages::Language language) {
    00819           newLanguage(language);
    00820      }
    00822      inline CoinMessageHandler * messageHandler() const       {
    00823           return handler_;
    00824      }
    00826      inline CoinMessages messages() const                     {
    00827           return messages_;
    00828      }
    00830      inline CoinMessages * messagesPointer()                  {
    00831           return & messages_;
    00832      }
    00834      inline CoinMessages coinMessages() const                  {
    00835           return coinMessages_;
    00836      }
    00838      inline CoinMessages * coinMessagesPointer()                  {
    00839           return & coinMessages_;
    00840      }
    00849      inline void setLogLevel(int value)    {
    00850           handler_->setLogLevel(value);
    00851      }
    00852      inline int logLevel() const           {
    00853           return handler_->logLevel();
    00854      }
    00856      inline bool defaultHandler() const {
    00857           return defaultHandler_;
    00858      }
    00860      void passInEventHandler(const ClpEventHandler * eventHandler);
    00862      inline ClpEventHandler * eventHandler() const {
    00863           return eventHandler_;
    00864      }
    00866      inline CoinThreadRandom * randomNumberGenerator() {
    00867           return &randomNumberGenerator_;
    00868      }
    00870      inline CoinThreadRandom & mutableRandomNumberGenerator() {
    00871           return randomNumberGenerator_;
    00872      }
    00874      inline void setRandomSeed(int value) {
    00875           randomNumberGenerator_.setSeed(value);
    00876      }
    00878      inline int lengthNames() const {
    00879           return lengthNames_;
    00880      }
    00881 #ifndef CLP_NO_STD
    00883      inline void setLengthNames(int value) {
    00884           lengthNames_ = value;
    00885      }
    00887      inline const std::vector<std::string> * rowNames() const {
    00888           return &rowNames_;
    00889      }
    00890      inline const std::string& rowName(int iRow) const {
    00891           return rowNames_[iRow];
    00892      }
    00894      std::string getRowName(int iRow) const;
    00896      inline const std::vector<std::string> * columnNames() const {
    00897           return &columnNames_;
    00898      }
    00899      inline const std::string& columnName(int iColumn) const {
    00900           return columnNames_[iColumn];
    00901      }
    00903      std::string getColumnName(int iColumn) const;
    00904 #endif
    00906      inline ClpObjective * objectiveAsObject() const {
    00907           return objective_;
    00908      }
    00909      void setObjective(ClpObjective * objective);
    00910      inline void setObjectivePointer(ClpObjective * newobjective) {
    00911           objective_ = newobjective;
    00912      }
    00915      int emptyProblem(int * infeasNumber = NULL, double * infeasSum = NULL, bool printMessage = true);
    00916
    00918
    00927      void times(double scalar,
    00928                 const double * x, double * y) const;
    00932      void transposeTimes(double scalar,
    00933                          const double * x, double * y) const ;
    00935
    00936
    00937      //---------------------------------------------------------------------------
    00955
    00956      bool setIntParam(ClpIntParam key, int value) ;
    00958      bool setDblParam(ClpDblParam key, double value) ;
    00959 #ifndef CLP_NO_STD
    00961      bool setStrParam(ClpStrParam key, const std::string & value);
    00962 #endif
    00963      // Get an integer parameter
    00964      inline bool getIntParam(ClpIntParam key, int& value) const {
    00965           if (key < ClpLastIntParam) {
    00966                value = intParam_[key];
    00967                return true;
    00968           } else {
    00969                return false;
    00970           }
    00971      }
    00972      // Get an double parameter
    00973      inline bool getDblParam(ClpDblParam key, double& value) const {
    00974           if (key < ClpLastDblParam) {
    00975                value = dblParam_[key];
    00976                return true;
    00977           } else {
    00978                return false;
    00979           }
    00980      }
    00981 #ifndef CLP_NO_STD
    00982      // Get a string parameter
    00983      inline bool getStrParam(ClpStrParam key, std::string& value) const {
    00984           if (key < ClpLastStrParam) {
    00985                value = strParam_[key];
    00986                return true;
    00987           } else {
    00988                return false;
    00989           }
    00990      }
    00991 #endif
    00993      void generateCpp( FILE * fp);
    00994
    01026      inline unsigned int specialOptions() const {
    01027           return specialOptions_;
    01028      }
    01029      void setSpecialOptions(unsigned int value);
    01030 #define COIN_CBC_USING_CLP 0x01000000
    01031      inline bool inCbcBranchAndBound() const {
    01032           return (specialOptions_ & COIN_CBC_USING_CLP) != 0;
    01033      }
    01035
    01038 protected:
    01040      void gutsOfDelete(int type);
    01044      void gutsOfCopy(const ClpModel & rhs, int trueCopy = 1);
    01046      void getRowBound(int iRow, double& lower, double& upper) const;
    01048      void gutsOfLoadModel ( int numberRows, int numberColumns,
    01049                             const double* collb, const double* colub,
    01050                             const double* obj,
    01051                             const double* rowlb, const double* rowub,
    01052                             const double * rowObjective = NULL);
    01054      void gutsOfScaling();
    01056      inline double rawObjectiveValue() const {
    01057           return objectiveValue_;
    01058      }
    01060      inline bool permanentArrays() const {
    01061           return (specialOptions_ & 65536) != 0;
    01062      }
    01064      void startPermanentArrays();
    01066      void stopPermanentArrays();
    01068      const char * const * rowNamesAsChar() const;
    01070      const char * const * columnNamesAsChar() const;
    01072      void deleteNamesAsChar(const char * const * names, int number) const;
    01074      void onStopped();
    01076
    01077
    01079 protected:
    01080
    01083
    01084      double optimizationDirection_;
    01086      double dblParam_[ClpLastDblParam];
    01088      double objectiveValue_;
    01090      double smallElement_;
    01092      double objectiveScale_;
    01094      double rhsScale_;
    01096      int numberRows_;
    01098      int numberColumns_;
    01100      double * rowActivity_;
    01102      double * columnActivity_;
    01104      double * dual_;
    01106      double * reducedCost_;
    01108      double* rowLower_;
    01110      double* rowUpper_;
    01112      ClpObjective * objective_;
    01114      double * rowObjective_;
    01116      double * columnLower_;
    01118      double * columnUpper_;
    01120      ClpMatrixBase * matrix_;
    01122      ClpMatrixBase * rowCopy_;
    01124      ClpPackedMatrix * scaledMatrix_;
    01126      double * ray_;
    01128      double * rowScale_;
    01130      double * columnScale_;
    01132      double * inverseRowScale_;
    01134      double * inverseColumnScale_;
    01137      int scalingFlag_;
    01145      unsigned char * status_;
    01147      char * integerType_;
    01149      void * userPointer_;
    01151      ClpTrustedData * trustedUserPointer_;
    01153      int intParam_[ClpLastIntParam];
    01155      int numberIterations_;
    01157      int solveType_;
    01174      unsigned int whatsChanged_;
    01176      int problemStatus_;
    01178      int secondaryStatus_;
    01180      int lengthNames_;
    01182      int numberThreads_;
    01186      unsigned int specialOptions_;
    01188      CoinMessageHandler * handler_;
    01190      bool defaultHandler_;
    01192      CoinThreadRandom randomNumberGenerator_;
    01194      ClpEventHandler * eventHandler_;
    01195 #ifndef CLP_NO_STD
    01197      std::vector<std::string> rowNames_;
    01199      std::vector<std::string> columnNames_;
    01200 #endif
    01202      CoinMessages messages_;
    01204      CoinMessages coinMessages_;
    01206      int maximumColumns_;
    01208      int maximumRows_;
    01210      int maximumInternalColumns_;
    01212      int maximumInternalRows_;
    01214      CoinPackedMatrix baseMatrix_;
    01216      CoinPackedMatrix baseRowCopy_;
    01218      double * savedRowScale_;
    01220      double * savedColumnScale_;
    01221 #ifndef CLP_NO_STD
    01223      std::string strParam_[ClpLastStrParam];
    01224 #endif
    01225
    01226 };
    01229 class ClpDataSave {
    01230
    01231 public:
    01235
    01236      ClpDataSave (  );
    01237
    01239      ClpDataSave(const ClpDataSave &);
    01241      ClpDataSave & operator=(const ClpDataSave & rhs);
    01243      ~ClpDataSave (  );
    01244
    01246
    01248 public:
    01249
    01252      double dualBound_;
    01253      double infeasibilityCost_;
    01254      double pivotTolerance_;
    01255      double zeroFactorizationTolerance_;
    01256      double zeroSimplexTolerance_;
    01257      double acceptablePivot_;
    01258      double objectiveScale_;
    01259      int sparseThreshold_;
    01260      int perturbation_;
    01261      int forceFactorization_;
    01262      int scalingFlag_;
    01263      unsigned int specialOptions_;
    01265 };
    01266
    01267 #endif