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

- File List
- File Members

# /home/coin/svn-release/Blis-0.94.1/Clp/src/ClpModel.hpp

Go to the documentation of this file.

    00001 /* $Id: ClpModel.hpp 2074 2014-12-10 09:43:54Z forrest $ */
    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 deleteRowsAndColumns(int numberRows, const int * whichRows,
    00188                                int numberColumns, const int * whichColumns);
    00190      void addColumn(int numberInColumn,
    00191                     const int * rows,
    00192                     const double * elements,
    00193                     double columnLower = 0.0,
    00194                     double  columnUpper = COIN_DBL_MAX,
    00195                     double  objective = 0.0);
    00197      void addColumns(int number, const double * columnLower,
    00198                      const double * columnUpper,
    00199                      const double * objective,
    00200                      const CoinBigIndex * columnStarts, const int * rows,
    00201                      const double * elements);
    00202      void addColumns(int number, const double * columnLower,
    00203                      const double * columnUpper,
    00204                      const double * objective,
    00205                      const CoinBigIndex * columnStarts, const int * columnLengths,
    00206                      const int * rows,
    00207                      const double * elements);
    00208 #ifndef CLP_NO_VECTOR
    00209      void addColumns(int number, const double * columnLower,
    00210                      const double * columnUpper,
    00211                      const double * objective,
    00212                      const CoinPackedVectorBase * const * columns);
    00213 #endif
    00214
    00219      int addColumns(const CoinBuild & buildObject, bool tryPlusMinusOne = false,
    00220                     bool checkDuplicates = true);
    00228      int addColumns(CoinModel & modelObject, bool tryPlusMinusOne = false,
    00229                     bool checkDuplicates = true);
    00231      inline void modifyCoefficient(int row, int column, double newElement,
    00232                                    bool keepZero = false) {
    00233           matrix_->modifyCoefficient(row, column, newElement, keepZero);
    00234      }
    00236      void chgRowLower(const double * rowLower);
    00238      void chgRowUpper(const double * rowUpper);
    00240      void chgColumnLower(const double * columnLower);
    00242      void chgColumnUpper(const double * columnUpper);
    00244      void chgObjCoefficients(const double * objIn);
    00248      void borrowModel(ClpModel & otherModel);
    00251      void returnModel(ClpModel & otherModel);
    00252
    00254      void createEmptyMatrix();
    00262      int cleanMatrix(double threshold = 1.0e-20);
    00264      void copy(const ClpMatrixBase * from, ClpMatrixBase * & to);
    00265 #ifndef CLP_NO_STD
    00267      void dropNames();
    00269      void copyNames(const std::vector<std::string> & rowNames,
    00270                     const std::vector<std::string> & columnNames);
    00272      void copyRowNames(const std::vector<std::string> & rowNames, int first, int last);
    00274      void copyColumnNames(const std::vector<std::string> & columnNames, int first, int last);
    00276      void copyRowNames(const char * const * rowNames, int first, int last);
    00278      void copyColumnNames(const char * const * columnNames, int first, int last);
    00280      void setRowName(int rowIndex, std::string & name) ;
    00282      void setColumnName(int colIndex, std::string & name) ;
    00283 #endif
    00284
    00291      int findNetwork(char * rotate, double fractionNeeded = 0.75);
    00294      CoinModel * createCoinModel() const;
    00295
    00308      int writeMps(const char *filename,
    00309                   int formatType = 0, int numberAcross = 2,
    00310                   double objSense = 0.0) const ;
    00312
    00314
    00315      inline int numberRows() const {
    00316           return numberRows_;
    00317      }
    00318      inline int getNumRows() const {
    00319           return numberRows_;
    00320      }
    00322      inline int getNumCols() const {
    00323           return numberColumns_;
    00324      }
    00325      inline int numberColumns() const {
    00326           return numberColumns_;
    00327      }
    00329      inline double primalTolerance() const {
    00330           return dblParam_[ClpPrimalTolerance];
    00331      }
    00332      void setPrimalTolerance( double value) ;
    00334      inline double dualTolerance() const  {
    00335           return dblParam_[ClpDualTolerance];
    00336      }
    00337      void setDualTolerance( double value) ;
    00339      inline double primalObjectiveLimit() const {
    00340           return dblParam_[ClpPrimalObjectiveLimit];
    00341      }
    00342      void setPrimalObjectiveLimit(double value);
    00344      inline double dualObjectiveLimit() const {
    00345           return dblParam_[ClpDualObjectiveLimit];
    00346      }
    00347      void setDualObjectiveLimit(double value);
    00349      inline double objectiveOffset() const {
    00350           return dblParam_[ClpObjOffset];
    00351      }
    00352      void setObjectiveOffset(double value);
    00354      inline double presolveTolerance() const {
    00355           return dblParam_[ClpPresolveTolerance];
    00356      }
    00357 #ifndef CLP_NO_STD
    00358      inline const std::string & problemName() const {
    00359           return strParam_[ClpProbName];
    00360      }
    00361 #endif
    00363      inline int numberIterations() const  {
    00364           return numberIterations_;
    00365      }
    00366      inline int getIterationCount() const {
    00367           return numberIterations_;
    00368      }
    00369      inline void setNumberIterations(int numberIterationsNew) {
    00370           numberIterations_ = numberIterationsNew;
    00371      }
    00373      inline int solveType() const {
    00374           return solveType_;
    00375      }
    00376      inline void setSolveType(int type) {
    00377           solveType_ = type;
    00378      }
    00380      inline int maximumIterations() const {
    00381           return intParam_[ClpMaxNumIteration];
    00382      }
    00383      void setMaximumIterations(int value);
    00385      inline double maximumSeconds() const {
    00386           return dblParam_[ClpMaxSeconds];
    00387      }
    00388      void setMaximumSeconds(double value);
    00389      void setMaximumWallSeconds(double value);
    00391      bool hitMaximumIterations() const;
    00401      inline int status() const            {
    00402           return problemStatus_;
    00403      }
    00404      inline int problemStatus() const            {
    00405           return problemStatus_;
    00406      }
    00408      inline void setProblemStatus(int problemStatusNew) {
    00409           problemStatus_ = problemStatusNew;
    00410      }
    00426      inline int secondaryStatus() const            {
    00427           return secondaryStatus_;
    00428      }
    00429      inline void setSecondaryStatus(int newstatus) {
    00430           secondaryStatus_ = newstatus;
    00431      }
    00433      inline bool isAbandoned() const             {
    00434           return problemStatus_ == 4;
    00435      }
    00437      inline bool isProvenOptimal() const         {
    00438           return problemStatus_ == 0;
    00439      }
    00441      inline bool isProvenPrimalInfeasible() const {
    00442           return problemStatus_ == 1;
    00443      }
    00445      inline bool isProvenDualInfeasible() const  {
    00446           return problemStatus_ == 2;
    00447      }
    00449      bool isPrimalObjectiveLimitReached() const ;
    00451      bool isDualObjectiveLimitReached() const ;
    00453      inline bool isIterationLimitReached() const {
    00454           return problemStatus_ == 3;
    00455      }
    00457      inline double optimizationDirection() const {
    00458           return  optimizationDirection_;
    00459      }
    00460      inline double getObjSense() const    {
    00461           return optimizationDirection_;
    00462      }
    00463      void setOptimizationDirection(double value);
    00465      inline double * primalRowSolution() const    {
    00466           return rowActivity_;
    00467      }
    00468      inline const double * getRowActivity() const {
    00469           return rowActivity_;
    00470      }
    00472      inline double * primalColumnSolution() const {
    00473           return columnActivity_;
    00474      }
    00475      inline const double * getColSolution() const {
    00476           return columnActivity_;
    00477      }
    00478      inline void setColSolution(const double * input) {
    00479           memcpy(columnActivity_, input, numberColumns_ * sizeof(double));
    00480      }
    00482      inline double * dualRowSolution() const      {
    00483           return dual_;
    00484      }
    00485      inline const double * getRowPrice() const    {
    00486           return dual_;
    00487      }
    00489      inline double * dualColumnSolution() const   {
    00490           return reducedCost_;
    00491      }
    00492      inline const double * getReducedCost() const {
    00493           return reducedCost_;
    00494      }
    00496      inline double* rowLower() const              {
    00497           return rowLower_;
    00498      }
    00499      inline const double* getRowLower() const     {
    00500           return rowLower_;
    00501      }
    00503      inline double* rowUpper() const              {
    00504           return rowUpper_;
    00505      }
    00506      inline const double* getRowUpper() const     {
    00507           return rowUpper_;
    00508      }
    00509      //-------------------------------------------------------------------------
    00513      void setObjectiveCoefficient( int elementIndex, double elementValue );
    00515      inline void setObjCoeff( int elementIndex, double elementValue ) {
    00516           setObjectiveCoefficient( elementIndex, elementValue);
    00517      }
    00518
    00521      void setColumnLower( int elementIndex, double elementValue );
    00522
    00525      void setColumnUpper( int elementIndex, double elementValue );
    00526
    00528      void setColumnBounds( int elementIndex,
    00529                            double lower, double upper );
    00530
    00539      void setColumnSetBounds(const int* indexFirst,
    00540                              const int* indexLast,
    00541                              const double* boundList);
    00542
    00545      inline void setColLower( int elementIndex, double elementValue ) {
    00546           setColumnLower(elementIndex, elementValue);
    00547      }
    00550      inline void setColUpper( int elementIndex, double elementValue ) {
    00551           setColumnUpper(elementIndex, elementValue);
    00552      }
    00553
    00555      inline void setColBounds( int elementIndex,
    00556                                double lower, double upper ) {
    00557           setColumnBounds(elementIndex, lower, upper);
    00558      }
    00559
    00566      inline void setColSetBounds(const int* indexFirst,
    00567                                  const int* indexLast,
    00568                                  const double* boundList) {
    00569           setColumnSetBounds(indexFirst, indexLast, boundList);
    00570      }
    00571
    00574      void setRowLower( int elementIndex, double elementValue );
    00575
    00578      void setRowUpper( int elementIndex, double elementValue ) ;
    00579
    00581      void setRowBounds( int elementIndex,
    00582                         double lower, double upper ) ;
    00583
    00590      void setRowSetBounds(const int* indexFirst,
    00591                           const int* indexLast,
    00592                           const double* boundList);
    00593
    00595
    00596      inline const double * rowScale() const {
    00597           return rowScale_;
    00598      }
    00599      inline const double * columnScale() const {
    00600           return columnScale_;
    00601      }
    00602      inline const double * inverseRowScale() const {
    00603           return inverseRowScale_;
    00604      }
    00605      inline const double * inverseColumnScale() const {
    00606           return inverseColumnScale_;
    00607      }
    00608      inline double * mutableRowScale() const {
    00609           return rowScale_;
    00610      }
    00611      inline double * mutableColumnScale() const {
    00612           return columnScale_;
    00613      }
    00614      inline double * mutableInverseRowScale() const {
    00615           return inverseRowScale_;
    00616      }
    00617      inline double * mutableInverseColumnScale() const {
    00618           return inverseColumnScale_;
    00619      }
    00620      inline double * swapRowScale(double * newScale) {
    00621           double * oldScale = rowScale_;
    00622           rowScale_ = newScale;
    00623           return oldScale;
    00624      }
    00625      void setRowScale(double * scale) ;
    00626      void setColumnScale(double * scale);
    00628      inline double objectiveScale() const {
    00629           return objectiveScale_;
    00630      }
    00631      inline void setObjectiveScale(double value) {
    00632           objectiveScale_ = value;
    00633      }
    00635      inline double rhsScale() const {
    00636           return rhsScale_;
    00637      }
    00638      inline void setRhsScale(double value) {
    00639           rhsScale_ = value;
    00640      }
    00642      void scaling(int mode = 1);
    00645      void unscale();
    00647      inline int scalingFlag() const {
    00648           return scalingFlag_;
    00649      }
    00651      inline double * objective() const {
    00652           if (objective_) {
    00653                double offset;
    00654                return objective_->gradient(NULL, NULL, offset, false);
    00655           } else {
    00656                return NULL;
    00657           }
    00658      }
    00659      inline double * objective(const double * solution, double & offset, bool refresh = true) const {
    00660           offset = 0.0;
    00661           if (objective_) {
    00662                return objective_->gradient(NULL, solution, offset, refresh);
    00663           } else {
    00664                return NULL;
    00665           }
    00666      }
    00667      inline const double * getObjCoefficients() const {
    00668           if (objective_) {
    00669                double offset;
    00670                return objective_->gradient(NULL, NULL, offset, false);
    00671           } else {
    00672                return NULL;
    00673           }
    00674      }
    00676      inline double * rowObjective() const         {
    00677           return rowObjective_;
    00678      }
    00679      inline const double * getRowObjCoefficients() const {
    00680           return rowObjective_;
    00681      }
    00683      inline double * columnLower() const          {
    00684           return columnLower_;
    00685      }
    00686      inline const double * getColLower() const    {
    00687           return columnLower_;
    00688      }
    00690      inline double * columnUpper() const          {
    00691           return columnUpper_;
    00692      }
    00693      inline const double * getColUpper() const    {
    00694           return columnUpper_;
    00695      }
    00697      inline CoinPackedMatrix * matrix() const {
    00698           if ( matrix_ == NULL ) return NULL;
    00699           else return matrix_->getPackedMatrix();
    00700      }
    00702      inline int getNumElements() const {
    00703           return matrix_->getNumElements();
    00704      }
    00707      inline double getSmallElementValue() const {
    00708           return smallElement_;
    00709      }
    00710      inline void setSmallElementValue(double value) {
    00711           smallElement_ = value;
    00712      }
    00714      inline ClpMatrixBase * rowCopy() const       {
    00715           return rowCopy_;
    00716      }
    00718      void setNewRowCopy(ClpMatrixBase * newCopy);
    00720      inline ClpMatrixBase * clpMatrix() const     {
    00721           return matrix_;
    00722      }
    00724      inline ClpPackedMatrix * clpScaledMatrix() const     {
    00725           return scaledMatrix_;
    00726      }
    00728      inline void setClpScaledMatrix(ClpPackedMatrix * scaledMatrix) {
    00729           delete scaledMatrix_;
    00730           scaledMatrix_ = scaledMatrix;
    00731      }
    00733      inline ClpPackedMatrix * swapScaledMatrix(ClpPackedMatrix * scaledMatrix) {
    00734           ClpPackedMatrix * oldMatrix = scaledMatrix_;
    00735           scaledMatrix_ = scaledMatrix;
    00736           return oldMatrix;
    00737      }
    00743      void replaceMatrix(ClpMatrixBase * matrix, bool deleteCurrent = false);
    00749      inline void replaceMatrix(CoinPackedMatrix * newmatrix,
    00750                                bool deleteCurrent = false) {
    00751           replaceMatrix(new ClpPackedMatrix(newmatrix), deleteCurrent);
    00752      }
    00754      inline double objectiveValue() const {
    00755           return objectiveValue_ * optimizationDirection_ - dblParam_[ClpObjOffset];
    00756      }
    00757      inline void setObjectiveValue(double value) {
    00758           objectiveValue_ = (value + dblParam_[ClpObjOffset]) / optimizationDirection_;
    00759      }
    00760      inline double getObjValue() const {
    00761           return objectiveValue_ * optimizationDirection_ - dblParam_[ClpObjOffset];
    00762      }
    00764      inline char * integerInformation() const     {
    00765           return integerType_;
    00766      }
    00769      double * infeasibilityRay(bool fullRay=false) const;
    00770      double * unboundedRay() const;
    00772      inline double * ray() const
    00773      { return ray_;}
    00775      inline bool rayExists() const {
    00776          return (ray_!=NULL);
    00777      }
    00779      inline void deleteRay() {
    00780          delete [] ray_;
    00781          ray_=NULL;
    00782      }
    00784          inline const double * internalRay() const {
    00785                  return ray_;
    00786          }
    00788      inline bool statusExists() const {
    00789           return (status_ != NULL);
    00790      }
    00792      inline unsigned char *  statusArray() const {
    00793           return status_;
    00794      }
    00797      unsigned char *  statusCopy() const;
    00799      void copyinStatus(const unsigned char * statusArray);
    00800
    00802      inline void setUserPointer (void * pointer) {
    00803           userPointer_ = pointer;
    00804      }
    00805      inline void * getUserPointer () const {
    00806           return userPointer_;
    00807      }
    00809      inline void setTrustedUserPointer (ClpTrustedData * pointer) {
    00810           trustedUserPointer_ = pointer;
    00811      }
    00812      inline ClpTrustedData * getTrustedUserPointer () const {
    00813           return trustedUserPointer_;
    00814      }
    00816      inline int whatsChanged() const {
    00817           return whatsChanged_;
    00818      }
    00819      inline void setWhatsChanged(int value) {
    00820           whatsChanged_ = value;
    00821      }
    00823      inline int numberThreads() const {
    00824           return numberThreads_;
    00825      }
    00826      inline void setNumberThreads(int value) {
    00827           numberThreads_ = value;
    00828      }
    00830
    00832
    00833      void passInMessageHandler(CoinMessageHandler * handler);
    00835      CoinMessageHandler * pushMessageHandler(CoinMessageHandler * handler,
    00836                                              bool & oldDefault);
    00838      void popMessageHandler(CoinMessageHandler * oldHandler, bool oldDefault);
    00840      void newLanguage(CoinMessages::Language language);
    00841      inline void setLanguage(CoinMessages::Language language) {
    00842           newLanguage(language);
    00843      }
    00845      void setDefaultMessageHandler();
    00847      inline CoinMessageHandler * messageHandler() const       {
    00848           return handler_;
    00849      }
    00851      inline CoinMessages messages() const                     {
    00852           return messages_;
    00853      }
    00855      inline CoinMessages * messagesPointer()                  {
    00856           return & messages_;
    00857      }
    00859      inline CoinMessages coinMessages() const                  {
    00860           return coinMessages_;
    00861      }
    00863      inline CoinMessages * coinMessagesPointer()                  {
    00864           return & coinMessages_;
    00865      }
    00874      inline void setLogLevel(int value)    {
    00875           handler_->setLogLevel(value);
    00876      }
    00877      inline int logLevel() const           {
    00878           return handler_->logLevel();
    00879      }
    00881      inline bool defaultHandler() const {
    00882           return defaultHandler_;
    00883      }
    00885      void passInEventHandler(const ClpEventHandler * eventHandler);
    00887      inline ClpEventHandler * eventHandler() const {
    00888           return eventHandler_;
    00889      }
    00891      inline CoinThreadRandom * randomNumberGenerator() {
    00892           return &randomNumberGenerator_;
    00893      }
    00895      inline CoinThreadRandom & mutableRandomNumberGenerator() {
    00896           return randomNumberGenerator_;
    00897      }
    00899      inline void setRandomSeed(int value) {
    00900           randomNumberGenerator_.setSeed(value);
    00901      }
    00903      inline int lengthNames() const {
    00904           return lengthNames_;
    00905      }
    00906 #ifndef CLP_NO_STD
    00908      inline void setLengthNames(int value) {
    00909           lengthNames_ = value;
    00910      }
    00912      inline const std::vector<std::string> * rowNames() const {
    00913           return &rowNames_;
    00914      }
    00915      inline const std::string& rowName(int iRow) const {
    00916           return rowNames_[iRow];
    00917      }
    00919      std::string getRowName(int iRow) const;
    00921      inline const std::vector<std::string> * columnNames() const {
    00922           return &columnNames_;
    00923      }
    00924      inline const std::string& columnName(int iColumn) const {
    00925           return columnNames_[iColumn];
    00926      }
    00928      std::string getColumnName(int iColumn) const;
    00929 #endif
    00931      inline ClpObjective * objectiveAsObject() const {
    00932           return objective_;
    00933      }
    00934      void setObjective(ClpObjective * objective);
    00935      inline void setObjectivePointer(ClpObjective * newobjective) {
    00936           objective_ = newobjective;
    00937      }
    00940      int emptyProblem(int * infeasNumber = NULL, double * infeasSum = NULL, bool printMessage = true);
    00941
    00943
    00952      void times(double scalar,
    00953                 const double * x, double * y) const;
    00957      void transposeTimes(double scalar,
    00958                          const double * x, double * y) const ;
    00960
    00961
    00962      //---------------------------------------------------------------------------
    00980
    00981      bool setIntParam(ClpIntParam key, int value) ;
    00983      bool setDblParam(ClpDblParam key, double value) ;
    00984 #ifndef CLP_NO_STD
    00986      bool setStrParam(ClpStrParam key, const std::string & value);
    00987 #endif
    00988      // Get an integer parameter
    00989      inline bool getIntParam(ClpIntParam key, int& value) const {
    00990           if (key < ClpLastIntParam) {
    00991                value = intParam_[key];
    00992                return true;
    00993           } else {
    00994                return false;
    00995           }
    00996      }
    00997      // Get an double parameter
    00998      inline bool getDblParam(ClpDblParam key, double& value) const {
    00999           if (key < ClpLastDblParam) {
    01000                value = dblParam_[key];
    01001                return true;
    01002           } else {
    01003                return false;
    01004           }
    01005      }
    01006 #ifndef CLP_NO_STD
    01007      // Get a string parameter
    01008      inline bool getStrParam(ClpStrParam key, std::string& value) const {
    01009           if (key < ClpLastStrParam) {
    01010                value = strParam_[key];
    01011                return true;
    01012           } else {
    01013                return false;
    01014           }
    01015      }
    01016 #endif
    01018      void generateCpp( FILE * fp);
    01019
    01054      inline unsigned int specialOptions() const {
    01055           return specialOptions_;
    01056      }
    01057      void setSpecialOptions(unsigned int value);
    01058 #define COIN_CBC_USING_CLP 0x01000000
    01059      inline bool inCbcBranchAndBound() const {
    01060           return (specialOptions_ & COIN_CBC_USING_CLP) != 0;
    01061      }
    01063
    01066 protected:
    01068      void gutsOfDelete(int type);
    01072      void gutsOfCopy(const ClpModel & rhs, int trueCopy = 1);
    01074      void getRowBound(int iRow, double& lower, double& upper) const;
    01076      void gutsOfLoadModel ( int numberRows, int numberColumns,
    01077                             const double* collb, const double* colub,
    01078                             const double* obj,
    01079                             const double* rowlb, const double* rowub,
    01080                             const double * rowObjective = NULL);
    01082      void gutsOfScaling();
    01084      inline double rawObjectiveValue() const {
    01085           return objectiveValue_;
    01086      }
    01088      inline bool permanentArrays() const {
    01089           return (specialOptions_ & 65536) != 0;
    01090      }
    01092      void startPermanentArrays();
    01094      void stopPermanentArrays();
    01096      const char * const * rowNamesAsChar() const;
    01098      const char * const * columnNamesAsChar() const;
    01100      void deleteNamesAsChar(const char * const * names, int number) const;
    01102      void onStopped();
    01104
    01105
    01107 protected:
    01108
    01111
    01112      double optimizationDirection_;
    01114      double dblParam_[ClpLastDblParam];
    01116      double objectiveValue_;
    01118      double smallElement_;
    01120      double objectiveScale_;
    01122      double rhsScale_;
    01124      int numberRows_;
    01126      int numberColumns_;
    01128      double * rowActivity_;
    01130      double * columnActivity_;
    01132      double * dual_;
    01134      double * reducedCost_;
    01136      double* rowLower_;
    01138      double* rowUpper_;
    01140      ClpObjective * objective_;
    01142      double * rowObjective_;
    01144      double * columnLower_;
    01146      double * columnUpper_;
    01148      ClpMatrixBase * matrix_;
    01150      ClpMatrixBase * rowCopy_;
    01152      ClpPackedMatrix * scaledMatrix_;
    01154      double * ray_;
    01156      double * rowScale_;
    01158      double * columnScale_;
    01160      double * inverseRowScale_;
    01162      double * inverseColumnScale_;
    01165      int scalingFlag_;
    01173      unsigned char * status_;
    01175      char * integerType_;
    01177      void * userPointer_;
    01179      ClpTrustedData * trustedUserPointer_;
    01181      int intParam_[ClpLastIntParam];
    01183      int numberIterations_;
    01185      int solveType_;
    01202 #define ROW_COLUMN_COUNTS_SAME 1
    01203 #define MATRIX_SAME 2
    01204 #define MATRIX_JUST_ROWS_ADDED 4
    01205 #define MATRIX_JUST_COLUMNS_ADDED 8
    01206 #define ROW_LOWER_SAME 16
    01207 #define ROW_UPPER_SAME 32
    01208 #define OBJECTIVE_SAME 64
    01209 #define COLUMN_LOWER_SAME 128
    01210 #define COLUMN_UPPER_SAME 256
    01211 #define BASIS_SAME 512
    01212 #define ALL_SAME 65339
    01213 #define ALL_SAME_EXCEPT_COLUMN_BOUNDS 65337
    01214      unsigned int whatsChanged_;
    01216      int problemStatus_;
    01218      int secondaryStatus_;
    01220      int lengthNames_;
    01222      int numberThreads_;
    01226      unsigned int specialOptions_;
    01228      CoinMessageHandler * handler_;
    01230      bool defaultHandler_;
    01232      CoinThreadRandom randomNumberGenerator_;
    01234      ClpEventHandler * eventHandler_;
    01235 #ifndef CLP_NO_STD
    01237      std::vector<std::string> rowNames_;
    01239      std::vector<std::string> columnNames_;
    01240 #endif
    01242      CoinMessages messages_;
    01244      CoinMessages coinMessages_;
    01246      int maximumColumns_;
    01248      int maximumRows_;
    01250      int maximumInternalColumns_;
    01252      int maximumInternalRows_;
    01254      CoinPackedMatrix baseMatrix_;
    01256      CoinPackedMatrix baseRowCopy_;
    01258      double * savedRowScale_;
    01260      double * savedColumnScale_;
    01261 #ifndef CLP_NO_STD
    01263      std::string strParam_[ClpLastStrParam];
    01264 #endif
    01265
    01266 };
    01269 class ClpDataSave {
    01270
    01271 public:
    01275
    01276      ClpDataSave (  );
    01277
    01279      ClpDataSave(const ClpDataSave &);
    01281      ClpDataSave & operator=(const ClpDataSave & rhs);
    01283      ~ClpDataSave (  );
    01284
    01286
    01288 public:
    01289
    01292      double dualBound_;
    01293      double infeasibilityCost_;
    01294      double pivotTolerance_;
    01295      double zeroFactorizationTolerance_;
    01296      double zeroSimplexTolerance_;
    01297      double acceptablePivot_;
    01298      double objectiveScale_;
    01299      int sparseThreshold_;
    01300      int perturbation_;
    01301      int forceFactorization_;
    01302      int scalingFlag_;
    01303      unsigned int specialOptions_;
    01305 };
    01306
    01307 #endif