Ignore:
Timestamp:
Jan 6, 2019 2:43:06 PM (4 months ago)
Author:
unxusr
Message:

formatting

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Clp/src/ClpInterior.hpp

    r1665 r2385  
    2626/// ******** DATA to be moved into protected section of ClpInterior
    2727typedef struct {
    28      double atolmin;
    29      double r3norm;
    30      double LSdamp;
    31      double* deltay;
     28  double atolmin;
     29  double r3norm;
     30  double LSdamp;
     31  double *deltay;
    3232} Info;
    3333/// ******** DATA to be moved into protected section of ClpInterior
    3434
    3535typedef struct {
    36      double atolold;
    37      double atolnew;
    38      double r3ratio;
    39      int  istop;
    40      int  itncg;
     36  double atolold;
     37  double atolnew;
     38  double r3ratio;
     39  int istop;
     40  int itncg;
    4141} Outfo;
    4242/// ******** DATA to be moved into protected section of ClpInterior
    4343
    4444typedef struct {
    45      double gamma;
    46      double delta;
    47      int MaxIter;
    48      double FeaTol;
    49      double OptTol;
    50      double StepTol;
    51      double x0min;
    52      double z0min;
    53      double mu0;
    54      int   LSmethod;  // 1=Cholesky    2=QR    3=LSQR
    55      int   LSproblem; // See below
    56      int LSQRMaxIter;
    57      double LSQRatol1; // Initial  atol
    58      double LSQRatol2; // Smallest atol (unless atol1 is smaller)
    59      double LSQRconlim;
    60      int wait;
     45  double gamma;
     46  double delta;
     47  int MaxIter;
     48  double FeaTol;
     49  double OptTol;
     50  double StepTol;
     51  double x0min;
     52  double z0min;
     53  double mu0;
     54  int LSmethod; // 1=Cholesky    2=QR    3=LSQR
     55  int LSproblem; // See below
     56  int LSQRMaxIter;
     57  double LSQRatol1; // Initial  atol
     58  double LSQRatol2; // Smallest atol (unless atol1 is smaller)
     59  double LSQRconlim;
     60  int wait;
    6161} Options;
    6262class Lsqr;
     
    7171
    7272class ClpInterior : public ClpModel {
    73      friend void ClpInteriorUnitTest(const std::string & mpsDir,
    74                                      const std::string & netlibDir);
     73  friend void ClpInteriorUnitTest(const std::string &mpsDir,
     74    const std::string &netlibDir);
    7575
    7676public:
    77 
    78      /**@name Constructors and destructor and copy */
    79      //@{
    80      /// Default constructor
    81      ClpInterior (  );
    82 
    83      /// Copy constructor.
    84      ClpInterior(const ClpInterior &);
    85      /// Copy constructor from model.
    86      ClpInterior(const ClpModel &);
    87      /** Subproblem constructor.  A subset of whole model is created from the
     77  /**@name Constructors and destructor and copy */
     78  //@{
     79  /// Default constructor
     80  ClpInterior();
     81
     82  /// Copy constructor.
     83  ClpInterior(const ClpInterior &);
     84  /// Copy constructor from model.
     85  ClpInterior(const ClpModel &);
     86  /** Subproblem constructor.  A subset of whole model is created from the
    8887         row and column lists given.  The new order is given by list order and
    8988         duplicates are allowed.  Name and integer information can be dropped
    9089     */
    91      ClpInterior (const ClpModel * wholeModel,
    92                   int numberRows, const int * whichRows,
    93                   int numberColumns, const int * whichColumns,
    94                   bool dropNames = true, bool dropIntegers = true);
    95      /// Assignment operator. This copies the data
    96      ClpInterior & operator=(const ClpInterior & rhs);
    97      /// Destructor
    98      ~ClpInterior (  );
    99      // Ones below are just ClpModel with some changes
    100      /** Loads a problem (the constraints on the
     90  ClpInterior(const ClpModel *wholeModel,
     91    int numberRows, const int *whichRows,
     92    int numberColumns, const int *whichColumns,
     93    bool dropNames = true, bool dropIntegers = true);
     94  /// Assignment operator. This copies the data
     95  ClpInterior &operator=(const ClpInterior &rhs);
     96  /// Destructor
     97  ~ClpInterior();
     98  // Ones below are just ClpModel with some changes
     99  /** Loads a problem (the constraints on the
    101100           rows are given by lower and upper bounds). If a pointer is 0 then the
    102101           following values are the default:
     
    109108           </ul>
    110109       */
    111      void loadProblem (  const ClpMatrixBase& matrix,
    112                          const double* collb, const double* colub,
    113                          const double* obj,
    114                          const double* rowlb, const double* rowub,
    115                          const double * rowObjective = NULL);
    116      void loadProblem (  const CoinPackedMatrix& matrix,
    117                          const double* collb, const double* colub,
    118                          const double* obj,
    119                          const double* rowlb, const double* rowub,
    120                          const double * rowObjective = NULL);
    121 
    122      /** Just like the other loadProblem() method except that the matrix is
     110  void loadProblem(const ClpMatrixBase &matrix,
     111    const double *collb, const double *colub,
     112    const double *obj,
     113    const double *rowlb, const double *rowub,
     114    const double *rowObjective = NULL);
     115  void loadProblem(const CoinPackedMatrix &matrix,
     116    const double *collb, const double *colub,
     117    const double *obj,
     118    const double *rowlb, const double *rowub,
     119    const double *rowObjective = NULL);
     120
     121  /** Just like the other loadProblem() method except that the matrix is
    123122       given in a standard column major ordered format (without gaps). */
    124      void loadProblem (  const int numcols, const int numrows,
    125                          const CoinBigIndex* start, const int* index,
    126                          const double* value,
    127                          const double* collb, const double* colub,
    128                          const double* obj,
    129                          const double* rowlb, const double* rowub,
    130                          const double * rowObjective = NULL);
    131      /// This one is for after presolve to save memory
    132      void loadProblem (  const int numcols, const int numrows,
    133                          const CoinBigIndex* start, const int* index,
    134                          const double* value, const int * length,
    135                          const double* collb, const double* colub,
    136                          const double* obj,
    137                          const double* rowlb, const double* rowub,
    138                          const double * rowObjective = NULL);
    139      /// Read an mps file from the given filename
    140      int readMps(const char *filename,
    141                  bool keepNames = false,
    142                  bool ignoreErrors = false);
    143      /** Borrow model.  This is so we dont have to copy large amounts
     123  void loadProblem(const int numcols, const int numrows,
     124    const CoinBigIndex *start, const int *index,
     125    const double *value,
     126    const double *collb, const double *colub,
     127    const double *obj,
     128    const double *rowlb, const double *rowub,
     129    const double *rowObjective = NULL);
     130  /// This one is for after presolve to save memory
     131  void loadProblem(const int numcols, const int numrows,
     132    const CoinBigIndex *start, const int *index,
     133    const double *value, const int *length,
     134    const double *collb, const double *colub,
     135    const double *obj,
     136    const double *rowlb, const double *rowub,
     137    const double *rowObjective = NULL);
     138  /// Read an mps file from the given filename
     139  int readMps(const char *filename,
     140    bool keepNames = false,
     141    bool ignoreErrors = false);
     142  /** Borrow model.  This is so we dont have to copy large amounts
    144143         of data around.  It assumes a derived class wants to overwrite
    145144         an empty model with a real one - while it does an algorithm.
    146145         This is same as ClpModel one. */
    147      void borrowModel(ClpModel & otherModel);
    148      /** Return model - updates any scalars */
    149      void returnModel(ClpModel & otherModel);
    150      //@}
    151 
    152      /**@name Functions most useful to user */
    153      //@{
    154      /** Pdco algorithm - see ClpPdco.hpp for method */
    155      int pdco();
    156      // ** Temporary version
    157      int  pdco( ClpPdcoBase * stuff, Options &options, Info &info, Outfo &outfo);
    158      /// Primal-Dual Predictor-Corrector barrier
    159      int primalDual();
    160      //@}
    161 
    162      /**@name most useful gets and sets */
    163      //@{
    164      /// If problem is primal feasible
    165      inline bool primalFeasible() const {
    166           return (sumPrimalInfeasibilities_ <= 1.0e-5);
    167      }
    168      /// If problem is dual feasible
    169      inline bool dualFeasible() const {
    170           return (sumDualInfeasibilities_ <= 1.0e-5);
    171      }
    172      /// Current (or last) algorithm
    173      inline int algorithm() const {
    174           return algorithm_;
    175      }
    176      /// Set algorithm
    177      inline void setAlgorithm(int value) {
    178           algorithm_ = value;
    179      }
    180      /// Sum of dual infeasibilities
    181      inline CoinWorkDouble sumDualInfeasibilities() const {
    182           return sumDualInfeasibilities_;
    183      }
    184      /// Sum of primal infeasibilities
    185      inline CoinWorkDouble sumPrimalInfeasibilities() const {
    186           return sumPrimalInfeasibilities_;
    187      }
    188      /// dualObjective.
    189      inline CoinWorkDouble dualObjective() const {
    190           return dualObjective_;
    191      }
    192      /// primalObjective.
    193      inline CoinWorkDouble primalObjective() const {
    194           return primalObjective_;
    195      }
    196      /// diagonalNorm
    197      inline CoinWorkDouble diagonalNorm() const {
    198           return diagonalNorm_;
    199      }
    200      /// linearPerturbation
    201      inline CoinWorkDouble linearPerturbation() const {
    202           return linearPerturbation_;
    203      }
    204      inline void setLinearPerturbation(CoinWorkDouble value) {
    205           linearPerturbation_ = value;
    206      }
    207      /// projectionTolerance
    208      inline CoinWorkDouble projectionTolerance() const {
    209           return projectionTolerance_;
    210      }
    211      inline void setProjectionTolerance(CoinWorkDouble value) {
    212           projectionTolerance_ = value;
    213      }
    214      /// diagonalPerturbation
    215      inline CoinWorkDouble diagonalPerturbation() const {
    216           return diagonalPerturbation_;
    217      }
    218      inline void setDiagonalPerturbation(CoinWorkDouble value) {
    219           diagonalPerturbation_ = value;
    220      }
    221      /// gamma
    222      inline CoinWorkDouble gamma() const {
    223           return gamma_;
    224      }
    225      inline void setGamma(CoinWorkDouble value) {
    226           gamma_ = value;
    227      }
    228      /// delta
    229      inline CoinWorkDouble delta() const {
    230           return delta_;
    231      }
    232      inline void setDelta(CoinWorkDouble value) {
    233           delta_ = value;
    234      }
    235      /// ComplementarityGap
    236      inline CoinWorkDouble complementarityGap() const {
    237           return complementarityGap_;
    238      }
    239      //@}
    240 
    241      /**@name most useful gets and sets */
    242      //@{
    243      /// Largest error on Ax-b
    244      inline CoinWorkDouble largestPrimalError() const {
    245           return largestPrimalError_;
    246      }
    247      /// Largest error on basic duals
    248      inline CoinWorkDouble largestDualError() const {
    249           return largestDualError_;
    250      }
    251      /// Maximum iterations
    252      inline int maximumBarrierIterations() const {
    253           return maximumBarrierIterations_;
    254      }
    255      inline void setMaximumBarrierIterations(int value) {
    256           maximumBarrierIterations_ = value;
    257      }
    258      /// Set cholesky (and delete present one)
    259      void setCholesky(ClpCholeskyBase * cholesky);
    260      /// Return number fixed to see if worth presolving
    261      int numberFixed() const;
    262      /** fix variables interior says should be.  If reallyFix false then just
     146  void borrowModel(ClpModel &otherModel);
     147  /** Return model - updates any scalars */
     148  void returnModel(ClpModel &otherModel);
     149  //@}
     150
     151  /**@name Functions most useful to user */
     152  //@{
     153  /** Pdco algorithm - see ClpPdco.hpp for method */
     154  int pdco();
     155  // ** Temporary version
     156  int pdco(ClpPdcoBase *stuff, Options &options, Info &info, Outfo &outfo);
     157  /// Primal-Dual Predictor-Corrector barrier
     158  int primalDual();
     159  //@}
     160
     161  /**@name most useful gets and sets */
     162  //@{
     163  /// If problem is primal feasible
     164  inline bool primalFeasible() const
     165  {
     166    return (sumPrimalInfeasibilities_ <= 1.0e-5);
     167  }
     168  /// If problem is dual feasible
     169  inline bool dualFeasible() const
     170  {
     171    return (sumDualInfeasibilities_ <= 1.0e-5);
     172  }
     173  /// Current (or last) algorithm
     174  inline int algorithm() const
     175  {
     176    return algorithm_;
     177  }
     178  /// Set algorithm
     179  inline void setAlgorithm(int value)
     180  {
     181    algorithm_ = value;
     182  }
     183  /// Sum of dual infeasibilities
     184  inline CoinWorkDouble sumDualInfeasibilities() const
     185  {
     186    return sumDualInfeasibilities_;
     187  }
     188  /// Sum of primal infeasibilities
     189  inline CoinWorkDouble sumPrimalInfeasibilities() const
     190  {
     191    return sumPrimalInfeasibilities_;
     192  }
     193  /// dualObjective.
     194  inline CoinWorkDouble dualObjective() const
     195  {
     196    return dualObjective_;
     197  }
     198  /// primalObjective.
     199  inline CoinWorkDouble primalObjective() const
     200  {
     201    return primalObjective_;
     202  }
     203  /// diagonalNorm
     204  inline CoinWorkDouble diagonalNorm() const
     205  {
     206    return diagonalNorm_;
     207  }
     208  /// linearPerturbation
     209  inline CoinWorkDouble linearPerturbation() const
     210  {
     211    return linearPerturbation_;
     212  }
     213  inline void setLinearPerturbation(CoinWorkDouble value)
     214  {
     215    linearPerturbation_ = value;
     216  }
     217  /// projectionTolerance
     218  inline CoinWorkDouble projectionTolerance() const
     219  {
     220    return projectionTolerance_;
     221  }
     222  inline void setProjectionTolerance(CoinWorkDouble value)
     223  {
     224    projectionTolerance_ = value;
     225  }
     226  /// diagonalPerturbation
     227  inline CoinWorkDouble diagonalPerturbation() const
     228  {
     229    return diagonalPerturbation_;
     230  }
     231  inline void setDiagonalPerturbation(CoinWorkDouble value)
     232  {
     233    diagonalPerturbation_ = value;
     234  }
     235  /// gamma
     236  inline CoinWorkDouble gamma() const
     237  {
     238    return gamma_;
     239  }
     240  inline void setGamma(CoinWorkDouble value)
     241  {
     242    gamma_ = value;
     243  }
     244  /// delta
     245  inline CoinWorkDouble delta() const
     246  {
     247    return delta_;
     248  }
     249  inline void setDelta(CoinWorkDouble value)
     250  {
     251    delta_ = value;
     252  }
     253  /// ComplementarityGap
     254  inline CoinWorkDouble complementarityGap() const
     255  {
     256    return complementarityGap_;
     257  }
     258  //@}
     259
     260  /**@name most useful gets and sets */
     261  //@{
     262  /// Largest error on Ax-b
     263  inline CoinWorkDouble largestPrimalError() const
     264  {
     265    return largestPrimalError_;
     266  }
     267  /// Largest error on basic duals
     268  inline CoinWorkDouble largestDualError() const
     269  {
     270    return largestDualError_;
     271  }
     272  /// Maximum iterations
     273  inline int maximumBarrierIterations() const
     274  {
     275    return maximumBarrierIterations_;
     276  }
     277  inline void setMaximumBarrierIterations(int value)
     278  {
     279    maximumBarrierIterations_ = value;
     280  }
     281  /// Set cholesky (and delete present one)
     282  void setCholesky(ClpCholeskyBase *cholesky);
     283  /// Return number fixed to see if worth presolving
     284  int numberFixed() const;
     285  /** fix variables interior says should be.  If reallyFix false then just
    263286         set values to exact bounds */
    264      void fixFixed(bool reallyFix = true);
    265      /// Primal erturbation vector
    266      inline CoinWorkDouble * primalR() const {
    267           return primalR_;
    268      }
    269      /// Dual erturbation vector
    270      inline CoinWorkDouble * dualR() const {
    271           return dualR_;
    272      }
    273      //@}
     287  void fixFixed(bool reallyFix = true);
     288  /// Primal erturbation vector
     289  inline CoinWorkDouble *primalR() const
     290  {
     291    return primalR_;
     292  }
     293  /// Dual erturbation vector
     294  inline CoinWorkDouble *dualR() const
     295  {
     296    return dualR_;
     297  }
     298  //@}
    274299
    275300protected:
    276      /**@name protected methods */
    277      //@{
    278      /// Does most of deletion
    279      void gutsOfDelete();
    280      /// Does most of copying
    281      void gutsOfCopy(const ClpInterior & rhs);
    282      /// Returns true if data looks okay, false if not
    283      bool createWorkingData();
    284      void deleteWorkingData();
    285      /// Sanity check on input rim data
    286      bool sanityCheck();
    287      ///  This does housekeeping
    288      int housekeeping();
    289      //@}
     301  /**@name protected methods */
     302  //@{
     303  /// Does most of deletion
     304  void gutsOfDelete();
     305  /// Does most of copying
     306  void gutsOfCopy(const ClpInterior &rhs);
     307  /// Returns true if data looks okay, false if not
     308  bool createWorkingData();
     309  void deleteWorkingData();
     310  /// Sanity check on input rim data
     311  bool sanityCheck();
     312  ///  This does housekeeping
     313  int housekeeping();
     314  //@}
    290315public:
    291      /**@name public methods */
    292      //@{
    293      /// Raw objective value (so always minimize)
    294      inline CoinWorkDouble rawObjectiveValue() const {
    295           return objectiveValue_;
    296      }
    297      /// Returns 1 if sequence indicates column
    298      inline int isColumn(int sequence) const {
    299           return sequence < numberColumns_ ? 1 : 0;
    300      }
    301      /// Returns sequence number within section
    302      inline int sequenceWithin(int sequence) const {
    303           return sequence < numberColumns_ ? sequence : sequence - numberColumns_;
    304      }
    305      /// Checks solution
    306      void checkSolution();
    307      /** Modifies djs to allow for quadratic.
     316  /**@name public methods */
     317  //@{
     318  /// Raw objective value (so always minimize)
     319  inline CoinWorkDouble rawObjectiveValue() const
     320  {
     321    return objectiveValue_;
     322  }
     323  /// Returns 1 if sequence indicates column
     324  inline int isColumn(int sequence) const
     325  {
     326    return sequence < numberColumns_ ? 1 : 0;
     327  }
     328  /// Returns sequence number within section
     329  inline int sequenceWithin(int sequence) const
     330  {
     331    return sequence < numberColumns_ ? sequence : sequence - numberColumns_;
     332  }
     333  /// Checks solution
     334  void checkSolution();
     335  /** Modifies djs to allow for quadratic.
    308336         returns quadratic offset */
    309      CoinWorkDouble quadraticDjs(CoinWorkDouble * djRegion, const CoinWorkDouble * solution,
    310                                  CoinWorkDouble scaleFactor);
    311 
    312      /// To say a variable is fixed
    313      inline void setFixed( int sequence) {
    314           status_[sequence] = static_cast<unsigned char>(status_[sequence] | 1) ;
    315      }
    316      inline void clearFixed( int sequence) {
    317           status_[sequence] = static_cast<unsigned char>(status_[sequence] & ~1) ;
    318      }
    319      inline bool fixed(int sequence) const {
    320           return ((status_[sequence] & 1) != 0);
    321      }
    322 
    323      /// To flag a variable
    324      inline void setFlagged( int sequence) {
    325           status_[sequence] = static_cast<unsigned char>(status_[sequence] | 2) ;
    326      }
    327      inline void clearFlagged( int sequence) {
    328           status_[sequence] = static_cast<unsigned char>(status_[sequence] & ~2) ;
    329      }
    330      inline bool flagged(int sequence) const {
    331           return ((status_[sequence] & 2) != 0);
    332      }
    333 
    334      /// To say a variable is fixed OR free
    335      inline void setFixedOrFree( int sequence) {
    336           status_[sequence] = static_cast<unsigned char>(status_[sequence] | 4) ;
    337      }
    338      inline void clearFixedOrFree( int sequence) {
    339           status_[sequence] = static_cast<unsigned char>(status_[sequence] & ~4) ;
    340      }
    341      inline bool fixedOrFree(int sequence) const {
    342           return ((status_[sequence] & 4) != 0);
    343      }
    344 
    345      /// To say a variable has lower bound
    346      inline void setLowerBound( int sequence) {
    347           status_[sequence] = static_cast<unsigned char>(status_[sequence] | 8) ;
    348      }
    349      inline void clearLowerBound( int sequence) {
    350           status_[sequence] = static_cast<unsigned char>(status_[sequence] & ~8) ;
    351      }
    352      inline bool lowerBound(int sequence) const {
    353           return ((status_[sequence] & 8) != 0);
    354      }
    355 
    356      /// To say a variable has upper bound
    357      inline void setUpperBound( int sequence) {
    358           status_[sequence] = static_cast<unsigned char>(status_[sequence] | 16) ;
    359      }
    360      inline void clearUpperBound( int sequence) {
    361           status_[sequence] = static_cast<unsigned char>(status_[sequence] & ~16) ;
    362      }
    363      inline bool upperBound(int sequence) const {
    364           return ((status_[sequence] & 16) != 0);
    365      }
    366 
    367      /// To say a variable has fake lower bound
    368      inline void setFakeLower( int sequence) {
    369           status_[sequence] = static_cast<unsigned char>(status_[sequence] | 32) ;
    370      }
    371      inline void clearFakeLower( int sequence) {
    372           status_[sequence] = static_cast<unsigned char>(status_[sequence] & ~32) ;
    373      }
    374      inline bool fakeLower(int sequence) const {
    375           return ((status_[sequence] & 32) != 0);
    376      }
    377 
    378      /// To say a variable has fake upper bound
    379      inline void setFakeUpper( int sequence) {
    380           status_[sequence] = static_cast<unsigned char>(status_[sequence] | 64) ;
    381      }
    382      inline void clearFakeUpper( int sequence) {
    383           status_[sequence] = static_cast<unsigned char>(status_[sequence] & ~64) ;
    384      }
    385      inline bool fakeUpper(int sequence) const {
    386           return ((status_[sequence] & 64) != 0);
    387      }
    388      //@}
    389 
    390 ////////////////// data //////////////////
     337  CoinWorkDouble quadraticDjs(CoinWorkDouble *djRegion, const CoinWorkDouble *solution,
     338    CoinWorkDouble scaleFactor);
     339
     340  /// To say a variable is fixed
     341  inline void setFixed(int sequence)
     342  {
     343    status_[sequence] = static_cast< unsigned char >(status_[sequence] | 1);
     344  }
     345  inline void clearFixed(int sequence)
     346  {
     347    status_[sequence] = static_cast< unsigned char >(status_[sequence] & ~1);
     348  }
     349  inline bool fixed(int sequence) const
     350  {
     351    return ((status_[sequence] & 1) != 0);
     352  }
     353
     354  /// To flag a variable
     355  inline void setFlagged(int sequence)
     356  {
     357    status_[sequence] = static_cast< unsigned char >(status_[sequence] | 2);
     358  }
     359  inline void clearFlagged(int sequence)
     360  {
     361    status_[sequence] = static_cast< unsigned char >(status_[sequence] & ~2);
     362  }
     363  inline bool flagged(int sequence) const
     364  {
     365    return ((status_[sequence] & 2) != 0);
     366  }
     367
     368  /// To say a variable is fixed OR free
     369  inline void setFixedOrFree(int sequence)
     370  {
     371    status_[sequence] = static_cast< unsigned char >(status_[sequence] | 4);
     372  }
     373  inline void clearFixedOrFree(int sequence)
     374  {
     375    status_[sequence] = static_cast< unsigned char >(status_[sequence] & ~4);
     376  }
     377  inline bool fixedOrFree(int sequence) const
     378  {
     379    return ((status_[sequence] & 4) != 0);
     380  }
     381
     382  /// To say a variable has lower bound
     383  inline void setLowerBound(int sequence)
     384  {
     385    status_[sequence] = static_cast< unsigned char >(status_[sequence] | 8);
     386  }
     387  inline void clearLowerBound(int sequence)
     388  {
     389    status_[sequence] = static_cast< unsigned char >(status_[sequence] & ~8);
     390  }
     391  inline bool lowerBound(int sequence) const
     392  {
     393    return ((status_[sequence] & 8) != 0);
     394  }
     395
     396  /// To say a variable has upper bound
     397  inline void setUpperBound(int sequence)
     398  {
     399    status_[sequence] = static_cast< unsigned char >(status_[sequence] | 16);
     400  }
     401  inline void clearUpperBound(int sequence)
     402  {
     403    status_[sequence] = static_cast< unsigned char >(status_[sequence] & ~16);
     404  }
     405  inline bool upperBound(int sequence) const
     406  {
     407    return ((status_[sequence] & 16) != 0);
     408  }
     409
     410  /// To say a variable has fake lower bound
     411  inline void setFakeLower(int sequence)
     412  {
     413    status_[sequence] = static_cast< unsigned char >(status_[sequence] | 32);
     414  }
     415  inline void clearFakeLower(int sequence)
     416  {
     417    status_[sequence] = static_cast< unsigned char >(status_[sequence] & ~32);
     418  }
     419  inline bool fakeLower(int sequence) const
     420  {
     421    return ((status_[sequence] & 32) != 0);
     422  }
     423
     424  /// To say a variable has fake upper bound
     425  inline void setFakeUpper(int sequence)
     426  {
     427    status_[sequence] = static_cast< unsigned char >(status_[sequence] | 64);
     428  }
     429  inline void clearFakeUpper(int sequence)
     430  {
     431    status_[sequence] = static_cast< unsigned char >(status_[sequence] & ~64);
     432  }
     433  inline bool fakeUpper(int sequence) const
     434  {
     435    return ((status_[sequence] & 64) != 0);
     436  }
     437  //@}
     438
     439  ////////////////// data //////////////////
    391440protected:
    392 
    393      /**@name data.  Many arrays have a row part and a column part.
     441  /**@name data.  Many arrays have a row part and a column part.
    394442      There is a single array with both - columns then rows and
    395443      then normally two arrays pointing to rows and columns.  The
    396444      single array is the owner of memory
    397445     */
    398      //@{
    399      /// Largest error on Ax-b
    400      CoinWorkDouble largestPrimalError_;
    401      /// Largest error on basic duals
    402      CoinWorkDouble largestDualError_;
    403      /// Sum of dual infeasibilities
    404      CoinWorkDouble sumDualInfeasibilities_;
    405      /// Sum of primal infeasibilities
    406      CoinWorkDouble sumPrimalInfeasibilities_;
    407      /// Worst complementarity
    408      CoinWorkDouble worstComplementarity_;
    409      ///
     446  //@{
     447  /// Largest error on Ax-b
     448  CoinWorkDouble largestPrimalError_;
     449  /// Largest error on basic duals
     450  CoinWorkDouble largestDualError_;
     451  /// Sum of dual infeasibilities
     452  CoinWorkDouble sumDualInfeasibilities_;
     453  /// Sum of primal infeasibilities
     454  CoinWorkDouble sumPrimalInfeasibilities_;
     455  /// Worst complementarity
     456  CoinWorkDouble worstComplementarity_;
     457  ///
    410458public:
    411      CoinWorkDouble xsize_;
    412      CoinWorkDouble zsize_;
     459  CoinWorkDouble xsize_;
     460  CoinWorkDouble zsize_;
     461
    413462protected:
    414      /// Working copy of lower bounds (Owner of arrays below)
    415      CoinWorkDouble * lower_;
    416      /// Row lower bounds - working copy
    417      CoinWorkDouble * rowLowerWork_;
    418      /// Column lower bounds - working copy
    419      CoinWorkDouble * columnLowerWork_;
    420      /// Working copy of upper bounds (Owner of arrays below)
    421      CoinWorkDouble * upper_;
    422      /// Row upper bounds - working copy
    423      CoinWorkDouble * rowUpperWork_;
    424      /// Column upper bounds - working copy
    425      CoinWorkDouble * columnUpperWork_;
    426      /// Working copy of objective
    427      CoinWorkDouble * cost_;
     463  /// Working copy of lower bounds (Owner of arrays below)
     464  CoinWorkDouble *lower_;
     465  /// Row lower bounds - working copy
     466  CoinWorkDouble *rowLowerWork_;
     467  /// Column lower bounds - working copy
     468  CoinWorkDouble *columnLowerWork_;
     469  /// Working copy of upper bounds (Owner of arrays below)
     470  CoinWorkDouble *upper_;
     471  /// Row upper bounds - working copy
     472  CoinWorkDouble *rowUpperWork_;
     473  /// Column upper bounds - working copy
     474  CoinWorkDouble *columnUpperWork_;
     475  /// Working copy of objective
     476  CoinWorkDouble *cost_;
     477
    428478public:
    429      /// Rhs
    430      CoinWorkDouble * rhs_;
    431      CoinWorkDouble * x_;
    432      CoinWorkDouble * y_;
    433      CoinWorkDouble * dj_;
     479  /// Rhs
     480  CoinWorkDouble *rhs_;
     481  CoinWorkDouble *x_;
     482  CoinWorkDouble *y_;
     483  CoinWorkDouble *dj_;
     484
    434485protected:
    435      /// Pointer to Lsqr object
    436      ClpLsqr * lsqrObject_;
    437      /// Pointer to stuff
    438      ClpPdcoBase * pdcoStuff_;
    439      /// Below here is standard barrier stuff
    440      /// mu.
    441      CoinWorkDouble mu_;
    442      /// objectiveNorm.
    443      CoinWorkDouble objectiveNorm_;
    444      /// rhsNorm.
    445      CoinWorkDouble rhsNorm_;
    446      /// solutionNorm.
    447      CoinWorkDouble solutionNorm_;
    448      /// dualObjective.
    449      CoinWorkDouble dualObjective_;
    450      /// primalObjective.
    451      CoinWorkDouble primalObjective_;
    452      /// diagonalNorm.
    453      CoinWorkDouble diagonalNorm_;
    454      /// stepLength
    455      CoinWorkDouble stepLength_;
    456      /// linearPerturbation
    457      CoinWorkDouble linearPerturbation_;
    458      /// diagonalPerturbation
    459      CoinWorkDouble diagonalPerturbation_;
    460      // gamma from Saunders and Tomlin regularized
    461      CoinWorkDouble gamma_;
    462      // delta from Saunders and Tomlin regularized
    463      CoinWorkDouble delta_;
    464      /// targetGap
    465      CoinWorkDouble targetGap_;
    466      /// projectionTolerance
    467      CoinWorkDouble projectionTolerance_;
    468      /// maximumRHSError.  maximum Ax
    469      CoinWorkDouble maximumRHSError_;
    470      /// maximumBoundInfeasibility.
    471      CoinWorkDouble maximumBoundInfeasibility_;
    472      /// maximumDualError.
    473      CoinWorkDouble maximumDualError_;
    474      /// diagonalScaleFactor.
    475      CoinWorkDouble diagonalScaleFactor_;
    476      /// scaleFactor.  For scaling objective
    477      CoinWorkDouble scaleFactor_;
    478      /// actualPrimalStep
    479      CoinWorkDouble actualPrimalStep_;
    480      /// actualDualStep
    481      CoinWorkDouble actualDualStep_;
    482      /// smallestInfeasibility
    483      CoinWorkDouble smallestInfeasibility_;
    484      /// historyInfeasibility.
     486  /// Pointer to Lsqr object
     487  ClpLsqr *lsqrObject_;
     488  /// Pointer to stuff
     489  ClpPdcoBase *pdcoStuff_;
     490  /// Below here is standard barrier stuff
     491  /// mu.
     492  CoinWorkDouble mu_;
     493  /// objectiveNorm.
     494  CoinWorkDouble objectiveNorm_;
     495  /// rhsNorm.
     496  CoinWorkDouble rhsNorm_;
     497  /// solutionNorm.
     498  CoinWorkDouble solutionNorm_;
     499  /// dualObjective.
     500  CoinWorkDouble dualObjective_;
     501  /// primalObjective.
     502  CoinWorkDouble primalObjective_;
     503  /// diagonalNorm.
     504  CoinWorkDouble diagonalNorm_;
     505  /// stepLength
     506  CoinWorkDouble stepLength_;
     507  /// linearPerturbation
     508  CoinWorkDouble linearPerturbation_;
     509  /// diagonalPerturbation
     510  CoinWorkDouble diagonalPerturbation_;
     511  // gamma from Saunders and Tomlin regularized
     512  CoinWorkDouble gamma_;
     513  // delta from Saunders and Tomlin regularized
     514  CoinWorkDouble delta_;
     515  /// targetGap
     516  CoinWorkDouble targetGap_;
     517  /// projectionTolerance
     518  CoinWorkDouble projectionTolerance_;
     519  /// maximumRHSError.  maximum Ax
     520  CoinWorkDouble maximumRHSError_;
     521  /// maximumBoundInfeasibility.
     522  CoinWorkDouble maximumBoundInfeasibility_;
     523  /// maximumDualError.
     524  CoinWorkDouble maximumDualError_;
     525  /// diagonalScaleFactor.
     526  CoinWorkDouble diagonalScaleFactor_;
     527  /// scaleFactor.  For scaling objective
     528  CoinWorkDouble scaleFactor_;
     529  /// actualPrimalStep
     530  CoinWorkDouble actualPrimalStep_;
     531  /// actualDualStep
     532  CoinWorkDouble actualDualStep_;
     533  /// smallestInfeasibility
     534  CoinWorkDouble smallestInfeasibility_;
     535  /// historyInfeasibility.
    485536#define LENGTH_HISTORY 5
    486      CoinWorkDouble historyInfeasibility_[LENGTH_HISTORY];
    487      /// complementarityGap.
    488      CoinWorkDouble complementarityGap_;
    489      /// baseObjectiveNorm
    490      CoinWorkDouble baseObjectiveNorm_;
    491      /// worstDirectionAccuracy
    492      CoinWorkDouble worstDirectionAccuracy_;
    493      /// maximumRHSChange
    494      CoinWorkDouble maximumRHSChange_;
    495      /// errorRegion. i.e. Ax
    496      CoinWorkDouble * errorRegion_;
    497      /// rhsFixRegion.
    498      CoinWorkDouble * rhsFixRegion_;
    499      /// upperSlack
    500      CoinWorkDouble * upperSlack_;
    501      /// lowerSlack
    502      CoinWorkDouble * lowerSlack_;
    503      /// diagonal
    504      CoinWorkDouble * diagonal_;
    505      /// solution
    506      CoinWorkDouble * solution_;
    507      /// work array
    508      CoinWorkDouble * workArray_;
    509      /// delta X
    510      CoinWorkDouble * deltaX_;
    511      /// delta Y
    512      CoinWorkDouble * deltaY_;
    513      /// deltaZ.
    514      CoinWorkDouble * deltaZ_;
    515      /// deltaW.
    516      CoinWorkDouble * deltaW_;
    517      /// deltaS.
    518      CoinWorkDouble * deltaSU_;
    519      CoinWorkDouble * deltaSL_;
    520      /// Primal regularization array
    521      CoinWorkDouble * primalR_;
    522      /// Dual regularization array
    523      CoinWorkDouble * dualR_;
    524      /// rhs B
    525      CoinWorkDouble * rhsB_;
    526      /// rhsU.
    527      CoinWorkDouble * rhsU_;
    528      /// rhsL.
    529      CoinWorkDouble * rhsL_;
    530      /// rhsZ.
    531      CoinWorkDouble * rhsZ_;
    532      /// rhsW.
    533      CoinWorkDouble * rhsW_;
    534      /// rhs C
    535      CoinWorkDouble * rhsC_;
    536      /// zVec
    537      CoinWorkDouble * zVec_;
    538      /// wVec
    539      CoinWorkDouble * wVec_;
    540      /// cholesky.
    541      ClpCholeskyBase * cholesky_;
    542      /// numberComplementarityPairs i.e. ones with lower and/or upper bounds (not fixed)
    543      int numberComplementarityPairs_;
    544      /// numberComplementarityItems_ i.e. number of active bounds
    545      int numberComplementarityItems_;
    546      /// Maximum iterations
    547      int maximumBarrierIterations_;
    548      /// gonePrimalFeasible.
    549      bool gonePrimalFeasible_;
    550      /// goneDualFeasible.
    551      bool goneDualFeasible_;
    552      /// Which algorithm being used
    553      int algorithm_;
    554      //@}
     537  CoinWorkDouble historyInfeasibility_[LENGTH_HISTORY];
     538  /// complementarityGap.
     539  CoinWorkDouble complementarityGap_;
     540  /// baseObjectiveNorm
     541  CoinWorkDouble baseObjectiveNorm_;
     542  /// worstDirectionAccuracy
     543  CoinWorkDouble worstDirectionAccuracy_;
     544  /// maximumRHSChange
     545  CoinWorkDouble maximumRHSChange_;
     546  /// errorRegion. i.e. Ax
     547  CoinWorkDouble *errorRegion_;
     548  /// rhsFixRegion.
     549  CoinWorkDouble *rhsFixRegion_;
     550  /// upperSlack
     551  CoinWorkDouble *upperSlack_;
     552  /// lowerSlack
     553  CoinWorkDouble *lowerSlack_;
     554  /// diagonal
     555  CoinWorkDouble *diagonal_;
     556  /// solution
     557  CoinWorkDouble *solution_;
     558  /// work array
     559  CoinWorkDouble *workArray_;
     560  /// delta X
     561  CoinWorkDouble *deltaX_;
     562  /// delta Y
     563  CoinWorkDouble *deltaY_;
     564  /// deltaZ.
     565  CoinWorkDouble *deltaZ_;
     566  /// deltaW.
     567  CoinWorkDouble *deltaW_;
     568  /// deltaS.
     569  CoinWorkDouble *deltaSU_;
     570  CoinWorkDouble *deltaSL_;
     571  /// Primal regularization array
     572  CoinWorkDouble *primalR_;
     573  /// Dual regularization array
     574  CoinWorkDouble *dualR_;
     575  /// rhs B
     576  CoinWorkDouble *rhsB_;
     577  /// rhsU.
     578  CoinWorkDouble *rhsU_;
     579  /// rhsL.
     580  CoinWorkDouble *rhsL_;
     581  /// rhsZ.
     582  CoinWorkDouble *rhsZ_;
     583  /// rhsW.
     584  CoinWorkDouble *rhsW_;
     585  /// rhs C
     586  CoinWorkDouble *rhsC_;
     587  /// zVec
     588  CoinWorkDouble *zVec_;
     589  /// wVec
     590  CoinWorkDouble *wVec_;
     591  /// cholesky.
     592  ClpCholeskyBase *cholesky_;
     593  /// numberComplementarityPairs i.e. ones with lower and/or upper bounds (not fixed)
     594  int numberComplementarityPairs_;
     595  /// numberComplementarityItems_ i.e. number of active bounds
     596  int numberComplementarityItems_;
     597  /// Maximum iterations
     598  int maximumBarrierIterations_;
     599  /// gonePrimalFeasible.
     600  bool gonePrimalFeasible_;
     601  /// goneDualFeasible.
     602  bool goneDualFeasible_;
     603  /// Which algorithm being used
     604  int algorithm_;
     605  //@}
    555606};
    556607//#############################################################################
     
    563614    It also does some testing of ClpFactorization class
    564615 */
    565 void
    566 ClpInteriorUnitTest(const std::string & mpsDir,
    567                     const std::string & netlibDir);
    568 
     616void ClpInteriorUnitTest(const std::string &mpsDir,
     617  const std::string &netlibDir);
    569618
    570619#endif
     620
     621/* vi: softtabstop=2 shiftwidth=2 expandtab tabstop=2
     622*/
Note: See TracChangeset for help on using the changeset viewer.