Changeset 728


Ignore:
Timestamp:
Feb 18, 2006 3:34:11 PM (15 years ago)
Author:
forrest
Message:

improve?

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ClpPredictorCorrector.cpp

    r590 r728  
    2323#include <cstdio>
    2424#include <iostream>
     25static int yyyyyy=0;
     26void ClpPredictorCorrector::saveSolution(std::string fileName)
     27{
     28  FILE * fp=fopen(fileName.c_str(),"wb");
     29  if (fp) {
     30    int numberRows=numberRows_;
     31    int numberColumns=numberColumns_;
     32    fwrite(&numberRows,sizeof(int),1,fp);
     33    fwrite(&numberColumns,sizeof(int),1,fp);
     34    double dsave[20];
     35    memset(dsave,0,sizeof(dsave));
     36    fwrite(dsave,sizeof(double),20,fp);
     37    int msave[20];
     38    memset(msave,0,sizeof(msave));
     39    msave[0]=numberIterations_;
     40    fwrite(msave,sizeof(int),20,fp);
     41    fwrite(dual_,sizeof(double),numberRows,fp);
     42    fwrite(errorRegion_,sizeof(double),numberRows,fp);
     43    fwrite(rhsFixRegion_,sizeof(double),numberRows,fp);
     44    fwrite(solution_,sizeof(double),numberColumns,fp);
     45    fwrite(solution_+numberColumns,sizeof(double),numberRows,fp);
     46    fwrite(diagonal_,sizeof(double),numberColumns,fp);
     47    fwrite(diagonal_+numberColumns,sizeof(double),numberRows,fp);
     48    fwrite(wVec_,sizeof(double),numberColumns,fp);
     49    fwrite(wVec_+numberColumns,sizeof(double),numberRows,fp);
     50    fwrite(zVec_,sizeof(double),numberColumns,fp);
     51    fwrite(zVec_+numberColumns,sizeof(double),numberRows,fp);
     52    fwrite(upperSlack_,sizeof(double),numberColumns,fp);
     53    fwrite(upperSlack_+numberColumns,sizeof(double),numberRows,fp);
     54    fwrite(lowerSlack_,sizeof(double),numberColumns,fp);
     55    fwrite(lowerSlack_+numberColumns,sizeof(double),numberRows,fp);
     56    fclose(fp);
     57  } else {
     58    std::cout<<"Unable to open file "<<fileName<<std::endl;
     59  }
     60}
    2561
    2662static double eScale=1.0e27;
     
    4480    return 2;
    4581  }
     82  //diagonalPerturbation_=1.0e-25;
    4683  ClpMatrixBase * saveMatrix = NULL;
    4784  // If quadratic then make copy so we can actually scale or normalize
     
    198235      <<cholesky_->rank()
    199236      <<CoinMessageEol;
     237    if (numberIterations_==-1) {
     238      saveSolution("xxx.sav");
     239      if (yyyyyy)
     240        exit(99);
     241    }
    200242    // move up history
    201243    for (i=1;i<LENGTH_HISTORY;i++)
     
    18881930    solveSystem(deltaX_,errorRegion_,solution_,NULL,NULL,NULL,false);
    18891931  }
    1890   //initialValue=1.0e2;
    1891   //if (rhsNorm_*1.0e-2>initialValue) {
    1892   //initialValue=rhsNorm_*1.0e-2;
    1893   //}
    1894   initialValue = CoinMax(1.0,rhsNorm_);
     1932  initialValue=1.0e2;
     1933  if (rhsNorm_*1.0e-2>initialValue) {
     1934    initialValue=rhsNorm_*1.0e-2;
     1935  }
     1936  //initialValue = CoinMax(1.0,rhsNorm_);
    18951937  double smallestBoundDifference=COIN_DBL_MAX;
    18961938  double * fakeSolution = deltaX_;
     
    19141956  double extra=1.0e-10;
    19151957  double largeGap=1.0e15;
    1916   double safeObjectiveValue=2.0*objectiveNorm_;
     1958  //double safeObjectiveValue=2.0*objectiveNorm_;
     1959  double safeObjectiveValue=objectiveNorm_+1.0;
    19171960  double safeFree=1.0e-1*initialValue;
    19181961  //printf("normal safe dual value of %g, primal value of %g\n",
Note: See TracChangeset for help on using the changeset viewer.