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

formatting

File:
1 edited

Legend:

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

    r2384 r2385  
    2424
    2525public:
    26 
    27      /**@name Methods */
    28      //@{
    29      /** Dual ranging.
     26  /**@name Methods */
     27  //@{
     28  /** Dual ranging.
    3029         This computes increase/decrease in cost for each given variable and corresponding
    3130         sequence numbers which would change basis.  Sequence numbers are 0..numberColumns
     
    4746         When here - guaranteed optimal
    4847     */
    49      void dualRanging(int numberCheck, const int * which,
    50                       double * costIncrease, int * sequenceIncrease,
    51                       double * costDecrease, int * sequenceDecrease,
    52                       double * valueIncrease = NULL, double * valueDecrease = NULL);
    53      /** Primal ranging.
     48  void dualRanging(int numberCheck, const int *which,
     49    double *costIncrease, int *sequenceIncrease,
     50    double *costDecrease, int *sequenceDecrease,
     51    double *valueIncrease = NULL, double *valueDecrease = NULL);
     52  /** Primal ranging.
    5453         This computes increase/decrease in value for each given variable and corresponding
    5554         sequence numbers which would change basis.  Sequence numbers are 0..numberColumns
     
    6564         When here - guaranteed optimal
    6665     */
    67      void primalRanging(int numberCheck, const int * which,
    68                         double * valueIncrease, int * sequenceIncrease,
    69                         double * valueDecrease, int * sequenceDecrease);
    70      /** Parametrics
     66  void primalRanging(int numberCheck, const int *which,
     67    double *valueIncrease, int *sequenceIncrease,
     68    double *valueDecrease, int *sequenceDecrease);
     69  /** Parametrics
    7170         This is an initial slow version.
    7271         The code uses current bounds + theta * change (if change array not NULL)
     
    8180         On exit endingTheta is maximum reached (can be used for next startingTheta)
    8281     */
    83      int parametrics(double startingTheta, double & endingTheta, double reportIncrement,
    84                      const double * changeLowerBound, const double * changeUpperBound,
    85                      const double * changeLowerRhs, const double * changeUpperRhs,
    86                      const double * changeObjective);
    87      /** Version of parametrics which reads from file
     82  int parametrics(double startingTheta, double &endingTheta, double reportIncrement,
     83    const double *changeLowerBound, const double *changeUpperBound,
     84    const double *changeLowerRhs, const double *changeUpperRhs,
     85    const double *changeObjective);
     86  /** Version of parametrics which reads from file
    8887         See CbcClpParam.cpp for details of format
    8988         Returns -2 if unable to open file */
    90      int parametrics(const char * dataFile);
    91      /** Parametrics
     89  int parametrics(const char *dataFile);
     90  /** Parametrics
    9291         This is an initial slow version.
    9392         The code uses current bounds + theta * change (if change array not NULL)
     
    9897         On exit endingTheta is maximum reached (can be used for next startingTheta)
    9998     */
    100      int parametrics(double startingTheta, double & endingTheta,
    101                      const double * changeLowerBound, const double * changeUpperBound,
    102                      const double * changeLowerRhs, const double * changeUpperRhs);
    103      int parametricsObj(double startingTheta, double & endingTheta,
    104                         const double * changeObjective);
    105     /// Finds best possible pivot
    106     double bestPivot(bool justColumns=false);
     99  int parametrics(double startingTheta, double &endingTheta,
     100    const double *changeLowerBound, const double *changeUpperBound,
     101    const double *changeLowerRhs, const double *changeUpperRhs);
     102  int parametricsObj(double startingTheta, double &endingTheta,
     103    const double *changeObjective);
     104  /// Finds best possible pivot
     105  double bestPivot(bool justColumns = false);
    107106  typedef struct {
    108107    double startingTheta;
     
    110109    double maxTheta;
    111110    double acceptableMaxTheta; // if this far then within tolerances
    112     double * lowerChange; // full array of lower bound changes
    113     int * lowerList; // list of lower bound changes
    114     double * upperChange; // full array of upper bound changes
    115     int * upperList; // list of upper bound changes
    116     char * markDone; // mark which ones looked at
    117     int * backwardBasic; // from sequence to pivot row
    118     int * lowerActive;
    119     double * lowerGap;
    120     double * lowerCoefficient;
    121     int * upperActive;
    122     double * upperGap;
    123     double * upperCoefficient;
    124     int unscaledChangesOffset; 
     111    double *lowerChange; // full array of lower bound changes
     112    int *lowerList; // list of lower bound changes
     113    double *upperChange; // full array of upper bound changes
     114    int *upperList; // list of upper bound changes
     115    char *markDone; // mark which ones looked at
     116    int *backwardBasic; // from sequence to pivot row
     117    int *lowerActive;
     118    double *lowerGap;
     119    double *lowerCoefficient;
     120    int *upperActive;
     121    double *upperGap;
     122    double *upperCoefficient;
     123    int unscaledChangesOffset;
    125124    bool firstIteration; // so can update rhs for accuracy
    126125  } parametricsData;
    127126
    128127private:
    129      /** Parametrics - inner loop
     128  /** Parametrics - inner loop
    130129         This first attempt is when reportIncrement non zero and may
    131130         not report endingTheta correctly
     
    135134         if event handler exists it may do more
    136135     */
    137      int parametricsLoop(parametricsData & paramData, double reportIncrement,
    138                          const double * changeLower, const double * changeUpper,
    139                          const double * changeObjective, ClpDataSave & data,
    140                          bool canTryQuick);
    141      int parametricsLoop(parametricsData & paramData,
    142                          ClpDataSave & data,bool canSkipFactorization=false);
    143      int parametricsObjLoop(parametricsData & paramData,
    144                          ClpDataSave & data,bool canSkipFactorization=false);
    145      /**  Refactorizes if necessary
     136  int parametricsLoop(parametricsData &paramData, double reportIncrement,
     137    const double *changeLower, const double *changeUpper,
     138    const double *changeObjective, ClpDataSave &data,
     139    bool canTryQuick);
     140  int parametricsLoop(parametricsData &paramData,
     141    ClpDataSave &data, bool canSkipFactorization = false);
     142  int parametricsObjLoop(parametricsData &paramData,
     143    ClpDataSave &data, bool canSkipFactorization = false);
     144  /**  Refactorizes if necessary
    146145          Checks if finished.  Updates status.
    147146
     
    150149           - 2 restoring from saved
    151150     */
    152      void statusOfProblemInParametrics(int type, ClpDataSave & saveData);
    153      void statusOfProblemInParametricsObj(int type, ClpDataSave & saveData);
    154      /** This has the flow between re-factorizations
     151  void statusOfProblemInParametrics(int type, ClpDataSave &saveData);
     152  void statusOfProblemInParametricsObj(int type, ClpDataSave &saveData);
     153  /** This has the flow between re-factorizations
    155154
    156155         Reasons to come out:
     
    162161         +3 max iterations
    163162      */
    164      int whileIterating(parametricsData & paramData, double reportIncrement,
    165                         const double * changeObjective);
    166      /** Computes next theta and says if objective or bounds (0= bounds, 1 objective, -1 none).
     163  int whileIterating(parametricsData &paramData, double reportIncrement,
     164    const double *changeObjective);
     165  /** Computes next theta and says if objective or bounds (0= bounds, 1 objective, -1 none).
    167166         theta is in theta_.
    168167         type 1 bounds, 2 objective, 3 both.
    169168     */
    170      int nextTheta(int type, double maxTheta, parametricsData & paramData,
    171                    const double * changeObjective);
    172      int whileIteratingObj(parametricsData & paramData);
    173      int nextThetaObj(double maxTheta, parametricsData & paramData);
    174      /// Restores bound to original bound
    175      void originalBound(int iSequence, double theta, const double * changeLower,
    176                      const double * changeUpper);
    177      /// Compute new rowLower_ etc (return negative if infeasible - otherwise largest change)
    178      double computeRhsEtc(parametricsData & paramData);
    179      /// Redo lower_ from rowLower_ etc
    180      void redoInternalArrays();
    181      /**
     169  int nextTheta(int type, double maxTheta, parametricsData &paramData,
     170    const double *changeObjective);
     171  int whileIteratingObj(parametricsData &paramData);
     172  int nextThetaObj(double maxTheta, parametricsData &paramData);
     173  /// Restores bound to original bound
     174  void originalBound(int iSequence, double theta, const double *changeLower,
     175    const double *changeUpper);
     176  /// Compute new rowLower_ etc (return negative if infeasible - otherwise largest change)
     177  double computeRhsEtc(parametricsData &paramData);
     178  /// Redo lower_ from rowLower_ etc
     179  void redoInternalArrays();
     180  /**
    182181         Row array has row part of pivot row
    183182         Column array has column part.
    184183         This is used in dual ranging
    185184     */
    186      void checkDualRatios(CoinIndexedVector * rowArray,
    187                           CoinIndexedVector * columnArray,
    188                           double & costIncrease, int & sequenceIncrease, double & alphaIncrease,
    189                           double & costDecrease, int & sequenceDecrease, double & alphaDecrease);
    190      /**
     185  void checkDualRatios(CoinIndexedVector *rowArray,
     186    CoinIndexedVector *columnArray,
     187    double &costIncrease, int &sequenceIncrease, double &alphaIncrease,
     188    double &costDecrease, int &sequenceDecrease, double &alphaDecrease);
     189  /**
    191190         Row array has pivot column
    192191         This is used in primal ranging
    193192     */
    194      void checkPrimalRatios(CoinIndexedVector * rowArray,
    195                             int direction);
    196      /// Returns new value of whichOther when whichIn enters basis
    197      double primalRanging1(int whichIn, int whichOther);
     193  void checkPrimalRatios(CoinIndexedVector *rowArray,
     194    int direction);
     195  /// Returns new value of whichOther when whichIn enters basis
     196  double primalRanging1(int whichIn, int whichOther);
    198197
    199198public:
    200      /** Write the basis in MPS format to the specified file.
     199  /** Write the basis in MPS format to the specified file.
    201200     If writeValues true writes values of structurals
    202201     (and adds VALUES to end of NAME card)
     
    212211     Returns non-zero on I/O error
    213212     */
    214      int writeBasis(const char *filename,
    215                     bool writeValues = false,
    216                     int formatType = 0) const;
    217      /// Read a basis from the given filename
    218      int readBasis(const char *filename);
    219      /** Creates dual of a problem if looks plausible
     213  int writeBasis(const char *filename,
     214    bool writeValues = false,
     215    int formatType = 0) const;
     216  /// Read a basis from the given filename
     217  int readBasis(const char *filename);
     218  /** Creates dual of a problem if looks plausible
    220219         (defaults will always create model)
    221220         fractionRowRanges is fraction of rows allowed to have ranges
    222221         fractionColumnRanges is fraction of columns allowed to have ranges
    223222     */
    224      ClpSimplex * dualOfModel(double fractionRowRanges = 1.0, double fractionColumnRanges = 1.0) const;
    225      /** Restores solution from dualized problem
     223  ClpSimplex *dualOfModel(double fractionRowRanges = 1.0, double fractionColumnRanges = 1.0) const;
     224  /** Restores solution from dualized problem
    226225         non-zero return code indicates minor problems
    227226     */
    228      int restoreFromDual(const ClpSimplex * dualProblem,
    229                          bool checkAccuracy=false);
    230      /** Sets solution in dualized problem
     227  int restoreFromDual(const ClpSimplex *dualProblem,
     228    bool checkAccuracy = false);
     229  /** Sets solution in dualized problem
    231230         non-zero return code indicates minor problems
    232231     */
    233      int setInDual(ClpSimplex * dualProblem);
    234      /** Does very cursory presolve.
     232  int setInDual(ClpSimplex *dualProblem);
     233  /** Does very cursory presolve.
    235234         rhs is numberRows, whichRows is 3*numberRows and whichColumns is 2*numberColumns.
    236235     */
    237      ClpSimplex * crunch(double * rhs, int * whichRows, int * whichColumns,
    238                          int & nBound, bool moreBounds = false, bool tightenBounds = false);
    239      /** After very cursory presolve.
     236  ClpSimplex *crunch(double *rhs, int *whichRows, int *whichColumns,
     237    int &nBound, bool moreBounds = false, bool tightenBounds = false);
     238  /** After very cursory presolve.
    240239         rhs is numberRows, whichRows is 3*numberRows and whichColumns is 2*numberColumns.
    241240     */
    242      void afterCrunch(const ClpSimplex & small,
    243                       const int * whichRows, const int * whichColumns,
    244                       int nBound);
    245      /** Returns gub version of model or NULL
     241  void afterCrunch(const ClpSimplex &small,
     242    const int *whichRows, const int *whichColumns,
     243    int nBound);
     244  /** Returns gub version of model or NULL
    246245         whichRows has to be numberRows
    247246         whichColumns has to be numberRows+numberColumns */
    248      ClpSimplex * gubVersion(int * whichRows, int * whichColumns,
    249                              int neededGub,
    250                              int factorizationFrequency=50);
    251      /// Sets basis from original
    252      void setGubBasis(ClpSimplex &original,const int * whichRows,
    253                       const int * whichColumns);
    254      /// Restores basis to original
    255      void getGubBasis(ClpSimplex &original,const int * whichRows,
    256                       const int * whichColumns) const;
    257      /// Quick try at cleaning up duals if postsolve gets wrong
    258      void cleanupAfterPostsolve();
    259      /** Tightens integer bounds - returns number tightened or -1 if infeasible
    260      */
    261      int tightenIntegerBounds(double * rhsSpace);
    262      /** Expands out all possible combinations for a knapsack
     247  ClpSimplex *gubVersion(int *whichRows, int *whichColumns,
     248    int neededGub,
     249    int factorizationFrequency = 50);
     250  /// Sets basis from original
     251  void setGubBasis(ClpSimplex &original, const int *whichRows,
     252    const int *whichColumns);
     253  /// Restores basis to original
     254  void getGubBasis(ClpSimplex &original, const int *whichRows,
     255    const int *whichColumns) const;
     256  /// Quick try at cleaning up duals if postsolve gets wrong
     257  void cleanupAfterPostsolve();
     258  /** Tightens integer bounds - returns number tightened or -1 if infeasible
     259     */
     260  int tightenIntegerBounds(double *rhsSpace);
     261  /** Expands out all possible combinations for a knapsack
    263262         If buildObj NULL then just computes space needed - returns number elements
    264263         On entry numberOutput is maximum allowed, on exit it is number needed or
     
    270269         in expanded knapsack.  Values in buildRow and buildElement;
    271270     */
    272      int expandKnapsack(int knapsackRow, int & numberOutput,
    273                         double * buildObj, CoinBigIndex * buildStart,
    274                         int * buildRow, double * buildElement, int reConstruct = -1) const;
    275      /// Create a string of commands to guess at best strategy for model
    276      /// At present mode is ignored
    277      char * guess(int mode) const;
    278      //@}
     271  int expandKnapsack(int knapsackRow, int &numberOutput,
     272    double *buildObj, CoinBigIndex *buildStart,
     273    int *buildRow, double *buildElement, int reConstruct = -1) const;
     274  /// Create a string of commands to guess at best strategy for model
     275  /// At present mode is ignored
     276  char *guess(int mode) const;
     277  //@}
    279278};
    280279#endif
     280
     281/* vi: softtabstop=2 shiftwidth=2 expandtab tabstop=2
     282*/
Note: See TracChangeset for help on using the changeset viewer.