Changeset 909 for trunk/Clp


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

for better cutoff

Location:
trunk/Clp/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Clp/src/ClpSimplex.cpp

    r809 r909  
    87588758// Compute objective value from solution
    87598759void
    8760 ClpSimplex::computeObjectiveValue()
     8760ClpSimplex::computeObjectiveValue(bool useInternalArrays)
    87618761{
    87628762  int iSequence;
    8763   //double oldObj = objectiveValue_;
    87648763  objectiveValue_ = 0.0;
    87658764  const double * obj = objective();
    8766   for (iSequence=0;iSequence<numberColumns_;iSequence++) {
    8767     double value = columnActivity_[iSequence];
    8768     objectiveValue_ += value*obj[iSequence];
    8769   }
    8770   // But remember direction
    8771   objectiveValue_ *= optimizationDirection_;
    8772   //if (fabs(objectiveValue_-oldObj)>1.0e-1) {
    8773   //if(problemStatus_!=3) printf("XX ");;
    8774   //printf("obj %g - was %g\n",objectiveValue(),objectiveValue()+(objectiveValue_-oldObj));
    8775   //}
     8765  if (!useInternalArrays) {
     8766    for (iSequence=0;iSequence<numberColumns_;iSequence++) {
     8767      double value = columnActivity_[iSequence];
     8768      objectiveValue_ += value*obj[iSequence];
     8769    }
     8770    // But remember direction as we are using external objective
     8771    objectiveValue_ *= optimizationDirection_;
     8772  } else if (!columnScale_) {
     8773    for (iSequence=0;iSequence<numberColumns_;iSequence++) {
     8774      double value = columnActivityWork_[iSequence];
     8775      objectiveValue_ += value*obj[iSequence];
     8776    }
     8777    // But remember direction as we are using external objective
     8778    objectiveValue_ *= optimizationDirection_;
     8779    objectiveValue_ += objective_->nonlinearOffset();
     8780    objectiveValue_ /= (objectiveScale_*rhsScale_);
     8781  } else {
     8782    for (iSequence=0;iSequence<numberColumns_;iSequence++) {
     8783      double scaleFactor = columnScale_[iSequence];
     8784      double valueScaled = columnActivityWork_[iSequence];
     8785      objectiveValue_ += valueScaled*scaleFactor*obj[iSequence];
     8786    }
     8787    // But remember direction as we are using external objective
     8788    objectiveValue_ *= optimizationDirection_;
     8789    objectiveValue_ += objective_->nonlinearOffset();
     8790    objectiveValue_ /= (objectiveScale_*rhsScale_);
     8791  }
    87768792}
    87778793// If user left factorization frequency then compute
  • trunk/Clp/src/ClpSimplex.hpp

    r891 r909  
    932932  { return objectiveValue_;};
    933933   /// Compute objective value from solution and put in objectiveValue_
    934   void computeObjectiveValue();
     934  void computeObjectiveValue(bool useWorkingSolution=false);
    935935  /** Number of extra rows.  These are ones which will be dynamically created
    936936      each iteration.  This is for GUB but may have other uses.
  • trunk/Clp/src/ClpSimplexDual.cpp

    r865 r909  
    39813981           !numberAtFakeBound()&&!numberDualInfeasibilities_) {
    39823982    //printf("lim %g obj %g %g\n",limit,objectiveValue_,objectiveValue());
    3983     if (perturbation_==101) {
     3983    // Even if not perturbed internal costs may have changed
     3984    if (true||perturbation_==101) {
    39843985      // be careful
    39853986      if (numberIterations_) {
    3986         computeObjectiveValue(); // value without perturbation
     3987        computeObjectiveValue(true); // value without perturbation
    39873988        if(objectiveValue()*optimizationDirection_>limit) {
    39883989          problemStatus_=1;
Note: See TracChangeset for help on using the changeset viewer.