- Main Page
- Modules
- Namespaces
- Classes
- Files
- Related Pages

- File List
- File Members

# /home/coin/SVN-release/Alps-1.2.1/Clp/src/ClpModel.hpp

Go to the documentation of this file.

    00001 /* $Id: ClpModel.hpp 1600 2010-09-01 13:55:33Z forrest $ */
    00002 // Copyright (C) 2002, International Business Machines
    00003 // Corporation and others.  All Rights Reserved.
    00004 #ifndef ClpModel_H
    00005 #define ClpModel_H
    00006
    00007 #include "ClpConfig.h"
    00008
    00009 #include <iostream>
    00010 #include <cassert>
    00011 #include <cmath>
    00012 #include <vector>
    00013 #include <string>
    00014 //#ifndef COIN_USE_CLP
    00015 //#define COIN_USE_CLP
    00016 //#endif
    00017 #include "ClpPackedMatrix.hpp"
    00018 #include "CoinMessageHandler.hpp"
    00019 #include "CoinHelperFunctions.hpp"
    00020 #include "CoinFinite.hpp"
    00021 #include "ClpParameters.hpp"
    00022 #include "ClpObjective.hpp"
    00023 class ClpEventHandler;
    00033 class CoinBuild;
    00034 class CoinModel;
    00035 class ClpModel {
    00036
    00037 public:
    00038
    00044
    00045      ClpModel (bool emptyMessages = false  );
    00046
    00051      ClpModel(const ClpModel & rhs, int scalingMode = -1);
    00053      ClpModel & operator=(const ClpModel & rhs);
    00058      ClpModel (const ClpModel * wholeModel,
    00059                int numberRows, const int * whichRows,
    00060                int numberColumns, const int * whichColumns,
    00061                bool dropNames = true, bool dropIntegers = true);
    00063      ~ClpModel (  );
    00065
    00079      void loadProblem (  const ClpMatrixBase& matrix,
    00080                          const double* collb, const double* colub,
    00081                          const double* obj,
    00082                          const double* rowlb, const double* rowub,
    00083                          const double * rowObjective = NULL);
    00084      void loadProblem (  const CoinPackedMatrix& matrix,
    00085                          const double* collb, const double* colub,
    00086                          const double* obj,
    00087                          const double* rowlb, const double* rowub,
    00088                          const double * rowObjective = NULL);
    00089
    00092      void loadProblem (  const int numcols, const int numrows,
    00093                          const CoinBigIndex* start, const int* index,
    00094                          const double* value,
    00095                          const double* collb, const double* colub,
    00096                          const double* obj,
    00097                          const double* rowlb, const double* rowub,
    00098                          const double * rowObjective = NULL);
    00104      int loadProblem (  CoinModel & modelObject, bool tryPlusMinusOne = false);
    00106      void loadProblem (  const int numcols, const int numrows,
    00107                          const CoinBigIndex* start, const int* index,
    00108                          const double* value, const int * length,
    00109                          const double* collb, const double* colub,
    00110                          const double* obj,
    00111                          const double* rowlb, const double* rowub,
    00112                          const double * rowObjective = NULL);
    00114      void loadQuadraticObjective(const int numberColumns,
    00115                                  const CoinBigIndex * start,
    00116                                  const int * column, const double * element);
    00117      void loadQuadraticObjective (  const CoinPackedMatrix& matrix);
    00119      void deleteQuadraticObjective();
    00121      void setRowObjective(const double * rowObjective);
    00123      int readMps(const char *filename,
    00124                  bool keepNames = false,
    00125                  bool ignoreErrors = false);
    00127      int readGMPL(const char *filename, const char * dataName,
    00128                   bool keepNames = false);
    00130      void copyInIntegerInformation(const char * information);
    00132      void deleteIntegerInformation();
    00134      void setContinuous(int index);
    00136      void setInteger(int index);
    00138      bool isInteger(int index) const;
    00140      void resize (int newNumberRows, int newNumberColumns);
    00142      void deleteRows(int number, const int * which);
    00144      void addRow(int numberInRow, const int * columns,
    00145                  const double * elements, double rowLower = -COIN_DBL_MAX,
    00146                  double rowUpper = COIN_DBL_MAX);
    00148      void addRows(int number, const double * rowLower,
    00149                   const double * rowUpper,
    00150                   const CoinBigIndex * rowStarts, const int * columns,
    00151                   const double * elements);
    00153      void addRows(int number, const double * rowLower,
    00154                   const double * rowUpper,
    00155                   const CoinBigIndex * rowStarts, const int * rowLengths,
    00156                   const int * columns,
    00157                   const double * elements);
    00158 #ifndef CLP_NO_VECTOR
    00159      void addRows(int number, const double * rowLower,
    00160                   const double * rowUpper,
    00161                   const CoinPackedVectorBase * const * rows);
    00162 #endif
    00163
    00168      int addRows(const CoinBuild & buildObject, bool tryPlusMinusOne = false,
    00169                  bool checkDuplicates = true);
    00178      int addRows(CoinModel & modelObject, bool tryPlusMinusOne = false,
    00179                  bool checkDuplicates = true);
    00180
    00182      void deleteColumns(int number, const int * which);
    00184      void addColumn(int numberInColumn,
    00185                     const int * rows,
    00186                     const double * elements,
    00187                     double columnLower = 0.0,
    00188                     double  columnUpper = COIN_DBL_MAX,
    00189                     double  objective = 0.0);
    00191      void addColumns(int number, const double * columnLower,
    00192                      const double * columnUpper,
    00193                      const double * objective,
    00194                      const CoinBigIndex * columnStarts, const int * rows,
    00195                      const double * elements);
    00196      void addColumns(int number, const double * columnLower,
    00197                      const double * columnUpper,
    00198                      const double * objective,
    00199                      const CoinBigIndex * columnStarts, const int * columnLengths,
    00200                      const int * rows,
    00201                      const double * elements);
    00202 #ifndef CLP_NO_VECTOR
    00203      void addColumns(int number, const double * columnLower,
    00204                      const double * columnUpper,
    00205                      const double * objective,
    00206                      const CoinPackedVectorBase * const * columns);
    00207 #endif
    00208
    00213      int addColumns(const CoinBuild & buildObject, bool tryPlusMinusOne = false,
    00214                     bool checkDuplicates = true);
    00222      int addColumns(CoinModel & modelObject, bool tryPlusMinusOne = false,
    00223                     bool checkDuplicates = true);
    00225      inline void modifyCoefficient(int row, int column, double newElement,
    00226                                    bool keepZero = false) {
    00227           matrix_->modifyCoefficient(row, column, newElement, keepZero);
    00228      }
    00230      void chgRowLower(const double * rowLower);
    00232      void chgRowUpper(const double * rowUpper);
    00234      void chgColumnLower(const double * columnLower);
    00236      void chgColumnUpper(const double * columnUpper);
    00238      void chgObjCoefficients(const double * objIn);
    00242      void borrowModel(ClpModel & otherModel);
    00245      void returnModel(ClpModel & otherModel);
    00246
    00248      void createEmptyMatrix();
    00256      int cleanMatrix(double threshold = 1.0e-20);
    00258      void copy(const ClpMatrixBase * from, ClpMatrixBase * & to);
    00259 #ifndef CLP_NO_STD
    00261      void dropNames();
    00263      void copyNames(std::vector<std::string> & rowNames,
    00264                     std::vector<std::string> & columnNames);
    00266      void copyRowNames(const std::vector<std::string> & rowNames, int first, int last);
    00268      void copyColumnNames(const std::vector<std::string> & columnNames, int first, int last);
    00270      void copyRowNames(const char * const * rowNames, int first, int last);
    00272      void copyColumnNames(const char * const * columnNames, int first, int last);
    00274      void setRowName(int rowIndex, std::string & name) ;
    00276      void setColumnName(int colIndex, std::string & name) ;
    00277 #endif
    00278
    00285      int findNetwork(char * rotate, double fractionNeeded = 0.75);
    00288      CoinModel * createCoinModel() const;
    00289
    00302      int writeMps(const char *filename,
    00303                   int formatType = 0, int numberAcross = 2,
    00304                   double objSense = 0.0) const ;
    00306
    00308
    00309      inline int numberRows() const {
    00310           return numberRows_;
    00311      }
    00312      inline int getNumRows() const {
    00313           return numberRows_;
    00314      }
    00316      inline int getNumCols() const {
    00317           return numberColumns_;
    00318      }
    00319      inline int numberColumns() const {
    00320           return numberColumns_;
    00321      }
    00323      inline double primalTolerance() const {
    00324           return dblParam_[ClpPrimalTolerance];
    00325      }
    00326      void setPrimalTolerance( double value) ;
    00328      inline double dualTolerance() const  {
    00329           return dblParam_[ClpDualTolerance];
    00330      }
    00331      void setDualTolerance( double value) ;
    00333      inline double primalObjectiveLimit() const {
    00334           return dblParam_[ClpPrimalObjectiveLimit];
    00335      }
    00336      void setPrimalObjectiveLimit(double value);
    00338      inline double dualObjectiveLimit() const {
    00339           return dblParam_[ClpDualObjectiveLimit];
    00340      }
    00341      void setDualObjectiveLimit(double value);
    00343      inline double objectiveOffset() const {
    00344           return dblParam_[ClpObjOffset];
    00345      }
    00346      void setObjectiveOffset(double value);
    00348      inline double presolveTolerance() const {
    00349           return dblParam_[ClpPresolveTolerance];
    00350      }
    00351 #ifndef CLP_NO_STD
    00352      inline std::string problemName() const {
    00353           return strParam_[ClpProbName];
    00354      }
    00355 #endif
    00357      inline int numberIterations() const  {
    00358           return numberIterations_;
    00359      }
    00360      inline int getIterationCount() const {
    00361           return numberIterations_;
    00362      }
    00363      inline void setNumberIterations(int numberIterationsNew) {
    00364           numberIterations_ = numberIterationsNew;
    00365      }
    00367      inline int solveType() const {
    00368           return solveType_;
    00369      }
    00370      inline void setSolveType(int type) {
    00371           solveType_ = type;
    00372      }
    00374      inline int maximumIterations() const {
    00375           return intParam_[ClpMaxNumIteration];
    00376      }
    00377      void setMaximumIterations(int value);
    00379      inline double maximumSeconds() const {
    00380           return dblParam_[ClpMaxSeconds];
    00381      }
    00382      void setMaximumSeconds(double value);
    00384      bool hitMaximumIterations() const;
    00394      inline int status() const            {
    00395           return problemStatus_;
    00396      }
    00397      inline int problemStatus() const            {
    00398           return problemStatus_;
    00399      }
    00401      inline void setProblemStatus(int problemStatusNew) {
    00402           problemStatus_ = problemStatusNew;
    00403      }
    00418      inline int secondaryStatus() const            {
    00419           return secondaryStatus_;
    00420      }
    00421      inline void setSecondaryStatus(int newstatus) {
    00422           secondaryStatus_ = newstatus;
    00423      }
    00425      inline bool isAbandoned() const             {
    00426           return problemStatus_ == 4;
    00427      }
    00429      inline bool isProvenOptimal() const         {
    00430           return problemStatus_ == 0;
    00431      }
    00433      inline bool isProvenPrimalInfeasible() const {
    00434           return problemStatus_ == 1;
    00435      }
    00437      inline bool isProvenDualInfeasible() const  {
    00438           return problemStatus_ == 2;
    00439      }
    00441      bool isPrimalObjectiveLimitReached() const ;
    00443      bool isDualObjectiveLimitReached() const ;
    00445      inline bool isIterationLimitReached() const {
    00446           return problemStatus_ == 3;
    00447      }
    00449      inline double optimizationDirection() const {
    00450           return  optimizationDirection_;
    00451      }
    00452      inline double getObjSense() const    {
    00453           return optimizationDirection_;
    00454      }
    00455      void setOptimizationDirection(double value);
    00457      inline double * primalRowSolution() const    {
    00458           return rowActivity_;
    00459      }
    00460      inline const double * getRowActivity() const {
    00461           return rowActivity_;
    00462      }
    00464      inline double * primalColumnSolution() const {
    00465           return columnActivity_;
    00466      }
    00467      inline const double * getColSolution() const {
    00468           return columnActivity_;
    00469      }
    00470      inline void setColSolution(const double * input) {
    00471           memcpy(columnActivity_, input, numberColumns_ * sizeof(double));
    00472      }
    00474      inline double * dualRowSolution() const      {
    00475           return dual_;
    00476      }
    00477      inline const double * getRowPrice() const    {
    00478           return dual_;
    00479      }
    00481      inline double * dualColumnSolution() const   {
    00482           return reducedCost_;
    00483      }
    00484      inline const double * getReducedCost() const {
    00485           return reducedCost_;
    00486      }
    00488      inline double* rowLower() const              {
    00489           return rowLower_;
    00490      }
    00491      inline const double* getRowLower() const     {
    00492           return rowLower_;
    00493      }
    00495      inline double* rowUpper() const              {
    00496           return rowUpper_;
    00497      }
    00498      inline const double* getRowUpper() const     {
    00499           return rowUpper_;
    00500      }
    00501      //-------------------------------------------------------------------------
    00505      void setObjectiveCoefficient( int elementIndex, double elementValue );
    00507      inline void setObjCoeff( int elementIndex, double elementValue ) {
    00508           setObjectiveCoefficient( elementIndex, elementValue);
    00509      }
    00510
    00513      void setColumnLower( int elementIndex, double elementValue );
    00514
    00517      void setColumnUpper( int elementIndex, double elementValue );
    00518
    00520      void setColumnBounds( int elementIndex,
    00521                            double lower, double upper );
    00522
    00531      void setColumnSetBounds(const int* indexFirst,
    00532                              const int* indexLast,
    00533                              const double* boundList);
    00534
    00537      inline void setColLower( int elementIndex, double elementValue ) {
    00538           setColumnLower(elementIndex, elementValue);
    00539      }
    00542      inline void setColUpper( int elementIndex, double elementValue ) {
    00543           setColumnUpper(elementIndex, elementValue);
    00544      }
    00545
    00547      inline void setColBounds( int elementIndex,
    00548                                double lower, double upper ) {
    00549           setColumnBounds(elementIndex, lower, upper);
    00550      }
    00551
    00558      inline void setColSetBounds(const int* indexFirst,
    00559                                  const int* indexLast,
    00560                                  const double* boundList) {
    00561           setColumnSetBounds(indexFirst, indexLast, boundList);
    00562      }
    00563
    00566      void setRowLower( int elementIndex, double elementValue );
    00567
    00570      void setRowUpper( int elementIndex, double elementValue ) ;
    00571
    00573      void setRowBounds( int elementIndex,
    00574                         double lower, double upper ) ;
    00575
    00582      void setRowSetBounds(const int* indexFirst,
    00583                           const int* indexLast,
    00584                           const double* boundList);
    00585
    00587
    00588      inline const double * rowScale() const {
    00589           return rowScale_;
    00590      }
    00591      inline const double * columnScale() const {
    00592           return columnScale_;
    00593      }
    00594      inline const double * inverseRowScale() const {
    00595           return inverseRowScale_;
    00596      }
    00597      inline const double * inverseColumnScale() const {
    00598           return inverseColumnScale_;
    00599      }
    00600      inline double * mutableRowScale() const {
    00601           return rowScale_;
    00602      }
    00603      inline double * mutableColumnScale() const {
    00604           return columnScale_;
    00605      }
    00606      inline double * mutableInverseRowScale() const {
    00607           return inverseRowScale_;
    00608      }
    00609      inline double * mutableInverseColumnScale() const {
    00610           return inverseColumnScale_;
    00611      }
    00612      void setRowScale(double * scale) ;
    00613      void setColumnScale(double * scale);
    00615      inline double objectiveScale() const {
    00616           return objectiveScale_;
    00617      }
    00618      inline void setObjectiveScale(double value) {
    00619           objectiveScale_ = value;
    00620      }
    00622      inline double rhsScale() const {
    00623           return rhsScale_;
    00624      }
    00625      inline void setRhsScale(double value) {
    00626           rhsScale_ = value;
    00627      }
    00629      void scaling(int mode = 1);
    00632      void unscale();
    00634      inline int scalingFlag() const {
    00635           return scalingFlag_;
    00636      }
    00638      inline double * objective() const {
    00639           if (objective_) {
    00640                double offset;
    00641                return objective_->gradient(NULL, NULL, offset, false);
    00642           } else {
    00643                return NULL;
    00644           }
    00645      }
    00646      inline double * objective(const double * solution, double & offset, bool refresh = true) const {
    00647           offset = 0.0;
    00648           if (objective_) {
    00649                return objective_->gradient(NULL, solution, offset, refresh);
    00650           } else {
    00651                return NULL;
    00652           }
    00653      }
    00654      inline const double * getObjCoefficients() const {
    00655           if (objective_) {
    00656                double offset;
    00657                return objective_->gradient(NULL, NULL, offset, false);
    00658           } else {
    00659                return NULL;
    00660           }
    00661      }
    00663      inline double * rowObjective() const         {
    00664           return rowObjective_;
    00665      }
    00666      inline const double * getRowObjCoefficients() const {
    00667           return rowObjective_;
    00668      }
    00670      inline double * columnLower() const          {
    00671           return columnLower_;
    00672      }
    00673      inline const double * getColLower() const    {
    00674           return columnLower_;
    00675      }
    00677      inline double * columnUpper() const          {
    00678           return columnUpper_;
    00679      }
    00680      inline const double * getColUpper() const    {
    00681           return columnUpper_;
    00682      }
    00684      inline CoinPackedMatrix * matrix() const {
    00685           if ( matrix_ == NULL ) return NULL;
    00686           else return matrix_->getPackedMatrix();
    00687      }
    00689      inline int getNumElements() const {
    00690           return matrix_->getNumElements();
    00691      }
    00694      inline double getSmallElementValue() const {
    00695           return smallElement_;
    00696      }
    00697      inline void setSmallElementValue(double value) {
    00698           smallElement_ = value;
    00699      }
    00701      inline ClpMatrixBase * rowCopy() const       {
    00702           return rowCopy_;
    00703      }
    00705      void setNewRowCopy(ClpMatrixBase * newCopy);
    00707      inline ClpMatrixBase * clpMatrix() const     {
    00708           return matrix_;
    00709      }
    00711      inline ClpPackedMatrix * clpScaledMatrix() const     {
    00712           return scaledMatrix_;
    00713      }
    00715      inline void setClpScaledMatrix(ClpPackedMatrix * scaledMatrix) {
    00716           delete scaledMatrix_;
    00717           scaledMatrix_ = scaledMatrix;
    00718      }
    00724      void replaceMatrix(ClpMatrixBase * matrix, bool deleteCurrent = false);
    00730      inline void replaceMatrix(CoinPackedMatrix * newmatrix,
    00731                                bool deleteCurrent = false) {
    00732           replaceMatrix(new ClpPackedMatrix(newmatrix), deleteCurrent);
    00733      }
    00735      inline double objectiveValue() const {
    00736           return objectiveValue_ * optimizationDirection_ - dblParam_[ClpObjOffset];
    00737      }
    00738      inline void setObjectiveValue(double value) {
    00739           objectiveValue_ = (value + dblParam_[ClpObjOffset]) / optimizationDirection_;
    00740      }
    00741      inline double getObjValue() const {
    00742           return objectiveValue_ * optimizationDirection_ - dblParam_[ClpObjOffset];
    00743      }
    00745      inline char * integerInformation() const     {
    00746           return integerType_;
    00747      }
    00750      double * infeasibilityRay() const;
    00751      double * unboundedRay() const;
    00753      inline bool rayExists() const {
    00754          return (ray_!=NULL);
    00755      }
    00757      inline void deleteRay() {
    00758          delete [] ray_;
    00759          ray_=NULL;
    00760      }
    00762      inline bool statusExists() const {
    00763           return (status_ != NULL);
    00764      }
    00766      inline unsigned char *  statusArray() const {
    00767           return status_;
    00768      }
    00771      unsigned char *  statusCopy() const;
    00773      void copyinStatus(const unsigned char * statusArray);
    00774
    00776      inline void setUserPointer (void * pointer) {
    00777           userPointer_ = pointer;
    00778      }
    00779      inline void * getUserPointer () const {
    00780           return userPointer_;
    00781      }
    00783      inline void setTrustedUserPointer (ClpTrustedData * pointer) {
    00784           trustedUserPointer_ = pointer;
    00785      }
    00786      inline ClpTrustedData * getTrustedUserPointer () const {
    00787           return trustedUserPointer_;
    00788      }
    00790      inline int whatsChanged() const {
    00791           return whatsChanged_;
    00792      }
    00793      inline void setWhatsChanged(int value) {
    00794           whatsChanged_ = value;
    00795      }
    00797      inline int numberThreads() const {
    00798           return numberThreads_;
    00799      }
    00800      inline void setNumberThreads(int value) {
    00801           numberThreads_ = value;
    00802      }
    00804
    00806
    00807      void passInMessageHandler(CoinMessageHandler * handler);
    00809      CoinMessageHandler * pushMessageHandler(CoinMessageHandler * handler,
    00810                                              bool & oldDefault);
    00812      void popMessageHandler(CoinMessageHandler * oldHandler, bool oldDefault);
    00814      void newLanguage(CoinMessages::Language language);
    00815      inline void setLanguage(CoinMessages::Language language) {
    00816           newLanguage(language);
    00817      }
    00819      inline CoinMessageHandler * messageHandler() const       {
    00820           return handler_;
    00821      }
    00823      inline CoinMessages messages() const                     {
    00824           return messages_;
    00825      }
    00827      inline CoinMessages * messagesPointer()                  {
    00828           return & messages_;
    00829      }
    00831      inline CoinMessages coinMessages() const                  {
    00832           return coinMessages_;
    00833      }
    00835      inline CoinMessages * coinMessagesPointer()                  {
    00836           return & coinMessages_;
    00837      }
    00846      inline void setLogLevel(int value)    {
    00847           handler_->setLogLevel(value);
    00848      }
    00849      inline int logLevel() const           {
    00850           return handler_->logLevel();
    00851      }
    00853      inline bool defaultHandler() const {
    00854           return defaultHandler_;
    00855      }
    00857      void passInEventHandler(const ClpEventHandler * eventHandler);
    00859      inline ClpEventHandler * eventHandler() const {
    00860           return eventHandler_;
    00861      }
    00863      inline CoinThreadRandom * randomNumberGenerator() {
    00864           return &randomNumberGenerator_;
    00865      }
    00867      inline CoinThreadRandom & mutableRandomNumberGenerator() {
    00868           return randomNumberGenerator_;
    00869      }
    00871      inline void setRandomSeed(int value) {
    00872           randomNumberGenerator_.setSeed(value);
    00873      }
    00875      inline int lengthNames() const {
    00876           return lengthNames_;
    00877      }
    00878 #ifndef CLP_NO_STD
    00880      inline void setLengthNames(int value) {
    00881           lengthNames_ = value;
    00882      }
    00884      inline const std::vector<std::string> * rowNames() const {
    00885           return &rowNames_;
    00886      }
    00887      inline const std::string& rowName(int iRow) const {
    00888           return rowNames_[iRow];
    00889      }
    00891      std::string getRowName(int iRow) const;
    00893      inline const std::vector<std::string> * columnNames() const {
    00894           return &columnNames_;
    00895      }
    00896      inline const std::string& columnName(int iColumn) const {
    00897           return columnNames_[iColumn];
    00898      }
    00900      std::string getColumnName(int iColumn) const;
    00901 #endif
    00903      inline ClpObjective * objectiveAsObject() const {
    00904           return objective_;
    00905      }
    00906      void setObjective(ClpObjective * objective);
    00907      inline void setObjectivePointer(ClpObjective * newobjective) {
    00908           objective_ = newobjective;
    00909      }
    00912      int emptyProblem(int * infeasNumber = NULL, double * infeasSum = NULL, bool printMessage = true);
    00913
    00915
    00924      void times(double scalar,
    00925                 const double * x, double * y) const;
    00929      void transposeTimes(double scalar,
    00930                          const double * x, double * y) const ;
    00932
    00933
    00934      //---------------------------------------------------------------------------
    00952
    00953      bool setIntParam(ClpIntParam key, int value) ;
    00955      bool setDblParam(ClpDblParam key, double value) ;
    00956 #ifndef CLP_NO_STD
    00958      bool setStrParam(ClpStrParam key, const std::string & value);
    00959 #endif
    00960      // Get an integer parameter
    00961      inline bool getIntParam(ClpIntParam key, int& value) const {
    00962           if (key < ClpLastIntParam) {
    00963                value = intParam_[key];
    00964                return true;
    00965           } else {
    00966                return false;
    00967           }
    00968      }
    00969      // Get an double parameter
    00970      inline bool getDblParam(ClpDblParam key, double& value) const {
    00971           if (key < ClpLastDblParam) {
    00972                value = dblParam_[key];
    00973                return true;
    00974           } else {
    00975                return false;
    00976           }
    00977      }
    00978 #ifndef CLP_NO_STD
    00979      // Get a string parameter
    00980      inline bool getStrParam(ClpStrParam key, std::string& value) const {
    00981           if (key < ClpLastStrParam) {
    00982                value = strParam_[key];
    00983                return true;
    00984           } else {
    00985                return false;
    00986           }
    00987      }
    00988 #endif
    00990      void generateCpp( FILE * fp);
    00991
    01023      inline unsigned int specialOptions() const {
    01024           return specialOptions_;
    01025      }
    01026      void setSpecialOptions(unsigned int value);
    01027 #define COIN_CBC_USING_CLP 0x01000000
    01028      inline bool inCbcBranchAndBound() const {
    01029           return (specialOptions_ & COIN_CBC_USING_CLP) != 0;
    01030      }
    01032
    01035 protected:
    01037      void gutsOfDelete(int type);
    01041      void gutsOfCopy(const ClpModel & rhs, int trueCopy = 1);
    01043      void getRowBound(int iRow, double& lower, double& upper) const;
    01045      void gutsOfLoadModel ( int numberRows, int numberColumns,
    01046                             const double* collb, const double* colub,
    01047                             const double* obj,
    01048                             const double* rowlb, const double* rowub,
    01049                             const double * rowObjective = NULL);
    01051      void gutsOfScaling();
    01053      inline double rawObjectiveValue() const {
    01054           return objectiveValue_;
    01055      }
    01057      inline bool permanentArrays() const {
    01058           return (specialOptions_ & 65536) != 0;
    01059      }
    01061      void startPermanentArrays();
    01063      void stopPermanentArrays();
    01065      const char * const * rowNamesAsChar() const;
    01067      const char * const * columnNamesAsChar() const;
    01069      void deleteNamesAsChar(const char * const * names, int number) const;
    01071      void onStopped();
    01073
    01074
    01076 protected:
    01077
    01080
    01081      double optimizationDirection_;
    01083      double dblParam_[ClpLastDblParam];
    01085      double objectiveValue_;
    01087      double smallElement_;
    01089      double objectiveScale_;
    01091      double rhsScale_;
    01093      int numberRows_;
    01095      int numberColumns_;
    01097      double * rowActivity_;
    01099      double * columnActivity_;
    01101      double * dual_;
    01103      double * reducedCost_;
    01105      double* rowLower_;
    01107      double* rowUpper_;
    01109      ClpObjective * objective_;
    01111      double * rowObjective_;
    01113      double * columnLower_;
    01115      double * columnUpper_;
    01117      ClpMatrixBase * matrix_;
    01119      ClpMatrixBase * rowCopy_;
    01121      ClpPackedMatrix * scaledMatrix_;
    01123      double * ray_;
    01125      double * rowScale_;
    01127      double * columnScale_;
    01129      double * inverseRowScale_;
    01131      double * inverseColumnScale_;
    01134      int scalingFlag_;
    01142      unsigned char * status_;
    01144      char * integerType_;
    01146      void * userPointer_;
    01148      ClpTrustedData * trustedUserPointer_;
    01150      int intParam_[ClpLastIntParam];
    01152      int numberIterations_;
    01154      int solveType_;
    01171      unsigned int whatsChanged_;
    01173      int problemStatus_;
    01175      int secondaryStatus_;
    01177      int lengthNames_;
    01179      int numberThreads_;
    01183      unsigned int specialOptions_;
    01185      CoinMessageHandler * handler_;
    01187      bool defaultHandler_;
    01189      CoinThreadRandom randomNumberGenerator_;
    01191      ClpEventHandler * eventHandler_;
    01192 #ifndef CLP_NO_STD
    01194      std::vector<std::string> rowNames_;
    01196      std::vector<std::string> columnNames_;
    01197 #endif
    01199      CoinMessages messages_;
    01201      CoinMessages coinMessages_;
    01203      int maximumColumns_;
    01205      int maximumRows_;
    01207      int maximumInternalColumns_;
    01209      int maximumInternalRows_;
    01211      CoinPackedMatrix baseMatrix_;
    01213      CoinPackedMatrix baseRowCopy_;
    01215      double * savedRowScale_;
    01217      double * savedColumnScale_;
    01218 #ifndef CLP_NO_STD
    01220      std::string strParam_[ClpLastStrParam];
    01221 #endif
    01222
    01223 };
    01226 class ClpDataSave {
    01227
    01228 public:
    01232
    01233      ClpDataSave (  );
    01234
    01236      ClpDataSave(const ClpDataSave &);
    01238      ClpDataSave & operator=(const ClpDataSave & rhs);
    01240      ~ClpDataSave (  );
    01241
    01243
    01245 public:
    01246
    01249      double dualBound_;
    01250      double infeasibilityCost_;
    01251      double pivotTolerance_;
    01252      double zeroFactorizationTolerance_;
    01253      double zeroSimplexTolerance_;
    01254      double acceptablePivot_;
    01255      double objectiveScale_;
    01256      int sparseThreshold_;
    01257      int perturbation_;
    01258      int forceFactorization_;
    01259      int scalingFlag_;
    01260      unsigned int specialOptions_;
    01262 };
    01263
    01264 #endif