Changeset 494


Ignore:
Timestamp:
Nov 1, 2004 9:18:04 AM (15 years ago)
Author:
forrest
Message:

weight could be bad

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ClpDualRowSteepest.cpp

    r482 r494  
    136136  return *this;
    137137}
    138 
    139138// Returns pivot row, -1 if none
    140139int
     
    144143  int i,iRow;
    145144  double * infeas = infeasible_->denseVector();
    146   double largest=1.0e-50;
     145  double largest=0.0;
    147146  int * index = infeasible_->getIndices();
    148147  int number = infeasible_->getNumElements();
     
    257256#endif
    258257        double weight = weights_[iRow];
     258        assert (weight<1.0e50);
    259259        //largestWeight = CoinMax(largestWeight,weight);
    260260        //smallestWeight = CoinMin(smallestWeight,weight);
     
    744744    } else {
    745745      int * which = alternateWeights_->getIndices();
     746      CoinIndexedVector * rowArray3 = model_->rowArray(3);
     747      assert (!rowArray3->getNumElements());
     748      int * back = rowArray3->getIndices();
     749      // In case something went wrong
     750      for (i=0;i<numberRows+numberColumns;i++)
     751        back[i]=-1;
    746752      if (mode!=4) {
    747753        // save
     
    752758      } else {
    753759        // restore
    754         memcpy(which,savedWeights_->getIndices(),
    755                numberRows*sizeof(int));
    756         memcpy(weights_,savedWeights_->denseVector(),
    757                numberRows*sizeof(double));
     760        //memcpy(which,savedWeights_->getIndices(),
     761        //     numberRows*sizeof(int));
     762        //memcpy(weights_,savedWeights_->denseVector(),
     763        //     numberRows*sizeof(double));
     764        which = savedWeights_->getIndices();
    758765      }
    759766      // restore (a bit slow - but only every re-factorization)
    760       double * array = new double[numberRows+numberColumns];
     767      double * array = savedWeights_->denseVector();
    761768      for (i=0;i<numberRows;i++) {
    762769        int iSeq=which[i];
    763         array[iSeq]=weights_[i];
     770        back[iSeq]=i;
    764771      }
    765772      for (i=0;i<numberRows;i++) {
    766773        int iPivot=pivotVariable[i];
    767         weights_[i]=array[iPivot];
    768         if (weights_[i]<TRY_NORM)
    769           weights_[i] = TRY_NORM; // may need to check more
    770       }
    771       delete [] array;
     774        iPivot = back[iPivot];
     775        if (iPivot>=0) {
     776          weights_[i]=array[iPivot];
     777          if (weights_[i]<TRY_NORM)
     778            weights_[i] = TRY_NORM; // may need to check more
     779        } else {
     780          // odd
     781          weights_[i]=1.0;
     782        }
     783      }
    772784    }
    773785    state_=0;
Note: See TracChangeset for help on using the changeset viewer.