Changeset 744


Ignore:
Timestamp:
Mar 29, 2006 5:39:11 AM (14 years ago)
Author:
forrest
Message:

for quadratic

Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/ClpGubDynamicMatrix.cpp

    r605 r744  
    19611961}
    19621962/* Just for debug - may be extended to other matrix types later.
    1963    Returns number of primal infeasibilities.
     1963   Returns number and sum of primal infeasibilities.
    19641964*/
    19651965int
    1966 ClpGubDynamicMatrix::checkFeasible(ClpSimplex * model) const
     1966ClpGubDynamicMatrix::checkFeasible(ClpSimplex * model,double & sum) const
    19671967{
    19681968  int numberRows = model_->numberRows();
     
    19811981  const double * rowLower = model_->rowLower();
    19821982  const double * rowUpper = model_->rowUpper();
     1983  sum=0.0;
    19831984  for (iRow=0;iRow<numberRows;iRow++) {
    19841985    double value=smallSolution[numberColumns+iRow];
     
    19881989      //     iRow,rowLower[iRow],value,rowUpper[iRow]);
    19891990      numberInfeasible++;
     1991      sum += CoinMax(rowLower[iRow]-value,value-rowUpper[iRow]);
    19901992    }
    19911993    rhs[iRow]=value;
     
    20002002      //     iColumn,columnLower[iColumn],value,columnUpper[iColumn]);
    20012003      numberInfeasible++;
     2004      sum += CoinMax(columnLower[iColumn]-value,value-columnUpper[iColumn]);
    20022005    }
    20032006    for (CoinBigIndex j=startColumn[iColumn];
  • trunk/ClpMatrixBase.cpp

    r653 r744  
    424424}
    425425/* Just for debug if odd type matrix.
    426    Returns number of primal infeasibilities.
     426   Returns number and sum of primal infeasibilities.
    427427*/
    428428int
    429 ClpMatrixBase::checkFeasible(ClpSimplex * model) const
     429ClpMatrixBase::checkFeasible(ClpSimplex * model, double & sum) const
    430430{
    431431  int numberRows = model->numberRows();
     
    443443  solution = model->solutionRegion(0);
    444444  double tolerance = model->primalTolerance()*1.01;
     445  sum=0.0;
    445446  for (iRow=0;iRow<numberRows;iRow++) {
    446447    double value=rhs[iRow];
     
    453454        value>rowUpper[iRow]+tolerance) {
    454455      numberInfeasible++;
     456      sum += CoinMax(rowLower[iRow]-value,value-rowUpper[iRow]);
    455457    }
    456458    if (value2>rowLower[iRow]+tolerance&&
     
    468470        value>columnUpper[iColumn]+tolerance) {
    469471      numberInfeasible++;
     472      sum += CoinMax(columnLower[iColumn]-value,value-columnUpper[iColumn]);
    470473    }
    471474    if (value>columnLower[iColumn]+tolerance&&
  • trunk/ClpSimplexNonlinear.cpp

    r694 r744  
    31893189#endif
    31903190      lastObjective = objValue;
    3191       if (targetDrop<1.0e-5&&goodMove&&iPass) {
     3191      if (targetDrop<CoinMax(1.0e-8,CoinMin(1.0e-6,1.0e-6*fabs(objValue)))&&goodMove&&iPass>3) {
    31923192        if (handler_->logLevel()>1)
    31933193        printf("Exiting on target drop %g\n",targetDrop);
  • trunk/ClpSimplexPrimal.cpp

    r742 r744  
    742742    if (numberThrownOut||
    743743        (sumInfeasibility>1.0e7&&sumInfeasibility>100.0*lastSumInfeasibility
    744          &&factorization_->pivotTolerance()<0.11)) {
     744         &&factorization_->pivotTolerance()<0.11)||(largestPrimalError_>1.0e10&&largestDualError_>1.0e10)) {
    745745      problemStatus_=tentativeStatus;
    746746      doFactorization=true;
     747      if (numberPivots) {
     748        // go back
     749        numberThrownOut=-1;
     750        // trouble - restore solution
     751        CoinMemcpyN(saveStatus_,numberColumns_+numberRows_,status_);
     752        CoinMemcpyN(savedSolution_+numberColumns_ ,
     753                    numberRows_,rowActivityWork_);
     754        CoinMemcpyN(savedSolution_ ,
     755           numberColumns_,columnActivityWork_);
     756        // restore extra stuff
     757        matrix_->generalExpanded(this,6,dummy);
     758        forceFactorization_=1; // a bit drastic but ..
     759        // Go to safe
     760        factorization_->pivotTolerance(0.99);
     761        pivotRow_=-1; // say no weights update
     762        changeMade_++; // say change made
     763        if (numberPivots==1) {
     764          // throw out something
     765          if (sequenceIn_>=0&&getStatus(sequenceIn_)!=basic) {
     766            setFlagged(sequenceIn_);
     767          } else if (sequenceOut_>=0&&getStatus(sequenceOut_)!=basic) {
     768            setFlagged(sequenceOut_);
     769          }
     770        }
     771        numberPivots=0;
     772      }
    747773    }
    748774  }
     
    25942620#if CLP_DEBUG >1
    25952621    {
    2596       int ninf= matrix_->checkFeasible(this);
     2622      double sum;
     2623      int ninf= matrix_->checkFeasible(this,sum);
    25972624      if (ninf)
    25982625        printf("infeas %d\n",ninf);
  • trunk/include/ClpGubDynamicMatrix.hpp

    r439 r744  
    5353                       const double * x, double * y) const;
    5454  /** Just for debug
    55       Returns number of primal infeasibilities. Recomputes keys
     55      Returns sum and number of primal infeasibilities. Recomputes keys
    5656  */
    57   virtual int checkFeasible(ClpSimplex * model) const;
     57  virtual int checkFeasible(ClpSimplex * model,double & sum) const;
    5858  //@}
    5959
  • trunk/include/ClpMatrixBase.hpp

    r653 r744  
    234234  /** Just for debug if odd type matrix.
    235235      Returns number of primal infeasibilities. */
    236   virtual int checkFeasible(ClpSimplex * model) const ;
     236  virtual int checkFeasible(ClpSimplex * model,double & sum) const ;
    237237  /// Returns reduced cost of a variable
    238238  double reducedCost(ClpSimplex * model,int sequence) const;
Note: See TracChangeset for help on using the changeset viewer.