Changeset 240


Ignore:
Timestamp:
Oct 23, 2003 1:53:35 PM (16 years ago)
Author:
forrest
Message:

Add returns

Location:
trunk
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/ClpDummyMatrix.cpp

    r238 r240  
    167167  std::cerr<<"fillBasis not supported - ClpDummyMatrix"<<std::endl;
    168168  abort();
     169  return 0;
    169170}
    170171/* If element NULL returns number of elements in column part of basis,
  • trunk/ClpMatrixBase.cpp

    r238 r240  
    9191  std::cerr<<"subsetClone not supported - ClpMatrixBase"<<std::endl;
    9292  abort();
     93  return NULL;
    9394}
    9495/* Given positive integer weights for each row fills in sum of weights
  • trunk/ClpModel.cpp

    r225 r240  
    4747  status_(NULL),
    4848  integerType_(NULL),
     49  userPointer_(NULL),
    4950  numberIterations_(0),
    5051  solveType_(0),
     
    324325  numberRows_ = rhs.numberRows_;
    325326  numberColumns_ = rhs.numberColumns_;
     327  userPointer_ = rhs.userPointer_;
    326328  if (trueCopy) {
    327329    lengthNames_ = rhs.lengthNames_;
     
    13611363  numberRows_ = numberRows;
    13621364  numberColumns_ = numberColumns;
     1365  userPointer_ = rhs->userPointer_;
    13631366  if (!dropNames) {
    13641367    unsigned int maxLength=0;
     
    14491452  rowNames_.reserve(numberRows_);
    14501453  for (iRow=0;iRow<numberRows_;iRow++) {
    1451     rowNames_[iRow] = rowNames[iRow];
     1454    rowNames_.push_back(rowNames[iRow]);
    14521455    maxLength = max(maxLength,(unsigned int) strlen(rowNames_[iRow].c_str()));
    14531456  }
     
    14551458  columnNames_.reserve(numberColumns_);
    14561459  for (iColumn=0;iColumn<numberColumns_;iColumn++) {
    1457     columnNames_[iColumn] = columnNames[iColumn];
     1460    columnNames_.push_back(columnNames[iColumn]);
    14581461    maxLength = max(maxLength,(unsigned int) strlen(columnNames_[iColumn].c_str()));
    14591462  }
    14601463  lengthNames_=(int) maxLength;
     1464}
     1465// Dual objective limit
     1466void
     1467ClpModel::setDualObjectiveLimit(double value)
     1468{
     1469  dblParam_[ClpDualObjectiveLimit]=value;
     1470}
     1471// Objective offset
     1472void
     1473ClpModel::setObjectiveOffset(double value)
     1474{
     1475  dblParam_[ClpObjOffset]=value;
    14611476}
    14621477//#############################################################################
  • trunk/ClpNonLinearCost.cpp

    r238 r240  
    356356  double primalTolerance = model_->currentPrimalTolerance();
    357357  int iSequence;
    358   bool fakeCosts=false;
    359358  double * solution = model_->solutionRegion();
    360359  double * upper = model_->upperRegion();
     
    377376    if (infeasible(start)) {
    378377      thisFeasibleCost = cost_[start+1];
    379       if (fakeCosts) {
    380         thisFeasibleCost=0.0;
    381         cost_[start+1]=0.0;
    382       }
    383378      cost_[start] = thisFeasibleCost-infeasibilityCost;
    384379    }
    385380    if (infeasible(end-1)) {
    386381      thisFeasibleCost = cost_[end-2];
    387       if (fakeCosts) {
    388         thisFeasibleCost=0.0;
    389         cost_[end-2]=0.0;
    390       }
    391382      cost_[end-1] = thisFeasibleCost+infeasibilityCost;
    392383    }
  • trunk/ClpObjective.cpp

    r238 r240  
    5656  std::cerr<<"subsetClone not supported - ClpObjective"<<std::endl;
    5757  abort();
     58  return NULL;
    5859}
    5960
  • trunk/ClpSimplex.cpp

    r238 r240  
    21962196  // ray may be null if in branch and bound
    21972197  if (rowScale_) {
     2198    // Collect infeasibilities
     2199    int numberPrimalScaled=0;
     2200    int numberPrimalUnscaled=0;
     2201    int numberDualScaled=0;
     2202    int numberDualUnscaled=0;
    21982203    for (i=0;i<numberColumns_;i++) {
    2199       columnActivity_[i] = columnActivityWork_[i]*columnScale_[i];
    2200       reducedCost_[i] = reducedCostWork_[i]/columnScale_[i];
     2204      double scaleFactor = columnScale_[i];
     2205      double valueScaled = columnActivityWork_[i];
     2206      if (valueScaled<columnLowerWork_[i]-primalTolerance_)
     2207        numberPrimalScaled++;
     2208      else if (valueScaled>columnUpperWork_[i]+primalTolerance_)
     2209        numberPrimalScaled++;
     2210      columnActivity_[i] = valueScaled*scaleFactor;
     2211      double value = columnActivity_[i];
     2212      if (value<columnLower_[i]-primalTolerance_)
     2213        numberPrimalUnscaled++;
     2214      else if (value>columnUpper_[i]+primalTolerance_)
     2215        numberPrimalUnscaled++;
     2216      double valueScaledDual = reducedCostWork_[i];
     2217      if (valueScaled>columnLowerWork_[i]+primalTolerance_&&valueScaledDual>dualTolerance_)
     2218        numberDualScaled++;
     2219      if (valueScaled<columnUpperWork_[i]-primalTolerance_&&valueScaledDual<-dualTolerance_)
     2220        numberDualScaled++;
     2221      reducedCost_[i] = valueScaledDual/scaleFactor;
     2222      double valueDual = reducedCost_[i];
     2223      if (value>columnLower_[i]+primalTolerance_&&valueDual>dualTolerance_)
     2224        numberDualUnscaled++;
     2225      if (value<columnUpper_[i]-primalTolerance_&&valueDual<-dualTolerance_)
     2226        numberDualUnscaled++;
    22012227    }
    22022228    for (i=0;i<numberRows_;i++) {
    2203       rowActivity_[i] = rowActivityWork_[i]/rowScale_[i];
    2204       dual_[i] *= rowScale_[i];
     2229      double scaleFactor = rowScale_[i];
     2230      double valueScaled = rowActivityWork_[i];
     2231      if (valueScaled<rowLowerWork_[i]-primalTolerance_)
     2232        numberPrimalScaled++;
     2233      else if (valueScaled>rowUpperWork_[i]+primalTolerance_)
     2234        numberPrimalScaled++;
     2235      rowActivity_[i] = valueScaled/scaleFactor;
     2236      double value = rowActivity_[i];
     2237      if (value<rowLower_[i]-primalTolerance_)
     2238        numberPrimalUnscaled++;
     2239      else if (value>rowUpper_[i]+primalTolerance_)
     2240        numberPrimalUnscaled++;
     2241      double valueScaledDual = dual_[i];
     2242      if (valueScaled>rowLowerWork_[i]+primalTolerance_&&valueScaledDual>dualTolerance_)
     2243        numberDualScaled++;
     2244      if (valueScaled<rowUpperWork_[i]-primalTolerance_&&valueScaledDual<-dualTolerance_)
     2245        numberDualScaled++;
     2246      dual_[i] = valueScaledDual*scaleFactor;
     2247      double valueDual = dual_[i];
     2248      if (value>rowLower_[i]+primalTolerance_&&valueDual>dualTolerance_)
     2249        numberDualUnscaled++;
     2250      if (value<rowUpper_[i]-primalTolerance_&&valueDual<-dualTolerance_)
     2251        numberDualUnscaled++;
     2252    }
     2253    if (!problemStatus_&&!secondaryStatus_) {
     2254      // See if we need to set secondary status
     2255      assert (!numberPrimalScaled);
     2256      assert (!numberDualScaled);
     2257      if (numberPrimalUnscaled) {
     2258        if (numberDualUnscaled)
     2259          secondaryStatus_=4;
     2260        else
     2261          secondaryStatus_=2;
     2262      } else {
     2263        if (numberDualUnscaled)
     2264          secondaryStatus_=3;
     2265      }
    22052266    }
    22062267    if (problemStatus_==2) {
  • trunk/ClpSolve.cpp

    r238 r240  
    2424#include "Idiot.hpp"
    2525#endif
    26 
    2726//#############################################################################
    2827// Allow for interrupts
    29 // But is this threadsafe ? (so switched off by option)
     28// But is this threadsafe ? (so switched off by option
    3029#include <csignal>
    3130static ClpSimplex * currentModel = NULL;
     
    3635  return;
    3736}
     37
    3838/** General solve algorithm which can do presolve
    3939    special options (bits)
     
    5959  ClpSimplex * model2 = this;
    6060  bool interrupt = (options.getSpecialOption(2)==0);
    61   typeof(SIG_DFL) saveSignal=SIG_DFL;
     61  sighandler_t saveSignal=SIG_DFL;
    6262  if (interrupt) {
    6363    currentModel = model2;
  • trunk/include/ClpModel.hpp

    r238 r240  
    194194   inline double dualTolerance() const  { return dblParam_[ClpDualTolerance]; }
    195195   void setDualTolerance( double value) ;
     196  /// Dual objective limit
     197  inline double dualObjectiveLimit() const { return dblParam_[ClpDualObjectiveLimit];}
     198  void setDualObjectiveLimit(double value);
     199  /// Objective offset
     200  inline double objectiveOffset() const { return dblParam_[ClpObjOffset];}
     201  void setObjectiveOffset(double value);
     202  inline std::string problemName() const { return strParam_[ClpProbName]; };
    196203   /// Number of iterations
    197204   inline int numberIterations() const  { return numberIterations_; }
     
    226233       0 - none
    227234       1 - primal infeasible because dual limit reached
     235       2 - scaled problem optimal - unscaled problem has primal infeasibilities
     236       3 - scaled problem optimal - unscaled problem has dual infeasibilities
     237       4 - scaled problem optimal - unscaled problem has primal and dual infeasibilities
    228238   */
    229239   inline int secondaryStatus() const            { return secondaryStatus_; }
     
    375385   /// Return pointer to messages
    376386   CoinMessages * messagesPointer()                  { return & messages_; }
    377    /// Log level
     387  /** Amount of print out:
     388      0 - none
     389      1 - just final
     390      2 - just factorizations
     391      3 - as 2 plus a bit more
     392      4 - verbose
     393      above that 8,16,32 etc just for selective debug
     394  */
    378395   void setLogLevel(int value)    { handler_->setLogLevel(value); }
    379396   int logLevel() const           { return handler_->logLevel(); }
  • trunk/include/ClpSimplex.hpp

    r225 r240  
    292292  */
    293293  /** Perturbation:
    294       -50 to +50 - perturb by this power of ten (-6 sounds good)
     294      50  - switch on perturbation
    295295      100 - auto perturb if takes too long (1.0e-6 largest nonzero)
    296296      101 - we are perturbed
    297297      102 - don't try perturbing again
    298298      default is 100
     299      others are for playing
    299300  */
    300301  inline int perturbation() const
Note: See TracChangeset for help on using the changeset viewer.