Changeset 908 for branches


Ignore:
Timestamp:
Jan 15, 2007 4:18:19 PM (13 years ago)
Author:
forrest
Message:

for better cutoff checking

Location:
branches/devel/Clp/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/devel/Clp/src/ClpSimplex.cpp

    r867 r908  
    88718871// Compute objective value from solution
    88728872void
    8873 ClpSimplex::computeObjectiveValue()
     8873ClpSimplex::computeObjectiveValue(bool useInternalArrays)
    88748874{
    88758875  int iSequence;
    8876   //double oldObj = objectiveValue_;
    88778876  objectiveValue_ = 0.0;
    88788877  const double * obj = objective();
    8879   for (iSequence=0;iSequence<numberColumns_;iSequence++) {
    8880     double value = columnActivity_[iSequence];
    8881     objectiveValue_ += value*obj[iSequence];
    8882   }
    8883   // But remember direction
    8884   objectiveValue_ *= optimizationDirection_;
    8885   //if (fabs(objectiveValue_-oldObj)>1.0e-1) {
    8886   //if(problemStatus_!=3) printf("XX ");;
    8887   //printf("obj %g - was %g\n",objectiveValue(),objectiveValue()+(objectiveValue_-oldObj));
    8888   //}
     8878  if (!useInternalArrays) {
     8879    for (iSequence=0;iSequence<numberColumns_;iSequence++) {
     8880      double value = columnActivity_[iSequence];
     8881      objectiveValue_ += value*obj[iSequence];
     8882    }
     8883    // But remember direction as we are using external objective
     8884    objectiveValue_ *= optimizationDirection_;
     8885  } else if (!columnScale_) {
     8886    for (iSequence=0;iSequence<numberColumns_;iSequence++) {
     8887      double value = columnActivityWork_[iSequence];
     8888      objectiveValue_ += value*obj[iSequence];
     8889    }
     8890    // But remember direction as we are using external objective
     8891    objectiveValue_ *= optimizationDirection_;
     8892    objectiveValue_ += objective_->nonlinearOffset();
     8893    objectiveValue_ /= (objectiveScale_*rhsScale_);
     8894  } else {
     8895    for (iSequence=0;iSequence<numberColumns_;iSequence++) {
     8896      double scaleFactor = columnScale_[iSequence];
     8897      double valueScaled = columnActivityWork_[iSequence];
     8898      objectiveValue_ += valueScaled*scaleFactor*obj[iSequence];
     8899    }
     8900    // But remember direction as we are using external objective
     8901    objectiveValue_ *= optimizationDirection_;
     8902    objectiveValue_ += objective_->nonlinearOffset();
     8903    objectiveValue_ /= (objectiveScale_*rhsScale_);
     8904  }
    88898905}
    88908906// Compute minimization objective value from internal solution
     
    88948910  int iSequence;
    88958911  //double oldObj = objectiveValue_;
    8896   double objectiveValue = -dblParam_[ClpObjOffset];
     8912  double objectiveValue = 0.0;
    88978913  const double * obj = objective();
    8898   double scaleR = optimizationDirection_/rhsScale_;
    88998914  if (!columnScale_) {
    89008915    for (iSequence=0;iSequence<numberColumns_;iSequence++) {
    8901       double value = solution_[iSequence]*scaleR;
     8916      double value = solution_[iSequence];
    89028917      objectiveValue += value*obj[iSequence];
    89038918    }
    89048919  } else {
    89058920    for (iSequence=0;iSequence<numberColumns_;iSequence++) {
    8906       double value = solution_[iSequence]*scaleR*columnScale_[iSequence];
     8921      double value = solution_[iSequence]*columnScale_[iSequence];
    89078922      objectiveValue += value*obj[iSequence];
    89088923    }
    89098924  }
     8925  objectiveValue_ *= optimizationDirection_/rhsScale_;
     8926  objectiveValue -= dblParam_[ClpObjOffset];
    89108927  return objectiveValue;
    89118928}
  • branches/devel/Clp/src/ClpSimplex.hpp

    r890 r908  
    933933  { return objectiveValue_;};
    934934   /// Compute objective value from solution and put in objectiveValue_
    935   void computeObjectiveValue();
     935  void computeObjectiveValue(bool useWorkingSolution=false);
    936936  /// Compute minimization objective value from internal solution without perturbation
    937937  double computeInternalObjectiveValue();
  • branches/devel/Clp/src/ClpSimplexDual.cpp

    r866 r908  
    40454045      looksInfeasible=true;
    40464046    if (looksInfeasible) {
    4047       //printf("lim %g obj %g %g\n",limit,objectiveValue_,objectiveValue());
    4048       if (perturbation_==101) {
     4047      // Even if not perturbed internal costs may have changed
     4048      if (true||perturbation_==101) {
    40494049        // be careful
    40504050        if (numberIterations_) {
Note: See TracChangeset for help on using the changeset viewer.