Changeset 219 for branches


Ignore:
Timestamp:
Oct 3, 2003 5:00:16 PM (16 years ago)
Author:
forrest
Message:

pdco seems to work

Location:
branches/pre
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • branches/pre/ClpLsqr.cpp

    r215 r219  
    171171    acond   =   anorm * sqrt( ddnorm );
    172172    real res1    =   phibar*phibar;
    173     real res2    =   res2  +  psi*psi;
     173    real res2    =   res1  +  psi*psi;
    174174    rnorm   =   sqrt( res1 + res2 );
    175175    arnorm  =   alfa * fabs( tau );
     
    338338ClpLsqr::~ClpLsqr()
    339339{
    340   delete [] diag1_;
     340  // delete [] diag1_; no as we just borrowed it
    341341}
    342342bool
  • branches/pre/ClpPdco.cpp

    r217 r219  
    589589      for (int k=0; k<n; k++)
    590590        D_elts[k]= sqrt(H_elts[k]);
    591       thisLsqr.setDiag1(D_elts);
     591      thisLsqr.borrowDiag1(D_elts);
    592592      thisLsqr.diag2_ = d2;
    593593
     
    805805      printf(" %5.1f%7d%7.3f", log10(atolold), itncg, r3ratio);
    806806    }
    807     printf("\n************ debug\n");
    808     break;
    809807    //-------------------------------------------------------------------
    810808    // Test for termination.
  • branches/pre/ClpPresolve.cpp

    r217 r219  
    2222#include "CoinPresolveSingleton.hpp"
    2323#include "CoinPresolveDoubleton.hpp"
     24#include "CoinPresolveTripleton.hpp"
    2425#include "CoinPresolveZeros.hpp"
    2526#include "CoinPresolveSubst.hpp"
     
    478479#if 1
    479480    const bool slackd = true;
    480     const bool doubleton = true;
     481    const bool doubleton = false;
     482    const bool tripleton = true;
    481483    const bool forcing = true;
    482484    const bool ifree = true;
     
    553555        if (doubleton) {
    554556          paction_ = doubleton_action::presolve(prob, paction_);
     557          if (prob->status_)
     558            break;
     559        }
     560
     561        if (tripleton) {
     562          paction_ = tripleton_action::presolve(prob, paction_);
    555563          if (prob->status_)
    556564            break;
  • branches/pre/Samples/myPdco.cpp

    r217 r219  
    9090      y_sum += y_elts[k];
    9191      int i1 = rowIndex_[2*k];
     92      assert (i1>=0);
    9293      x_elts[i1] += y_elts[k];
    9394      int i2 = rowIndex_[2*k+1];
     95      assert (i2>=0);
    9496      x_elts[i2] -= y_elts[k];
    9597    }
     
    151153  x_elts[nrow-2] += y_sumb;
    152154  x_elts[nrow-1] += (y_sum + y_suma + y_sumb);
    153   delete ysq;
     155  delete [] ysq;
    154156  double delsq = delta*delta;
    155157  for (int k=0; k<nrow; k++)
     
    186188  return;
    187189}
    188 myPdco::myPdco(ClpInterior & model)
     190myPdco::myPdco(ClpInterior & model, FILE * fpData, FILE * fpParam)
    189191{
    190192  int nrow;
     
    200202  double  *dj;
    201203  int ipair[2], igparm[4], maxrows, maxlinks;
    202   // Open graph and parameter files
    203   FILE *fpin = fopen("./g.graph","r");
    204   FILE *fpp = fopen("./gparm","r");
    205204  // Read max array sizes and allocate them
    206   fscanf(fpp, "%d %d", &maxrows, &maxlinks);
     205  fscanf(fpParam, "%d %d", &maxrows, &maxlinks);
    207206  int *ir = new int[2*maxlinks + 5];
    208207  /********************** alpha parameter hrdwired here ***********/
     
    215214  int *ito = &ipair[1];
    216215  int nonzpt = 0;
    217   while(fscanf(fpin, "%d %d", ifrom, ito) && kct++ < maxlinks){
    218   //  while(fread(ipair, 4,2, fpin) && kct++ < maxlinks){
    219     if (*ifrom < 0){
     216  numlinks_ = 0;
     217  while(fscanf(fpData, "%d %d", ifrom, ito) && kct++ < maxlinks){
     218  //  while(fread(ipair, 4,2, fpData) && kct++ < maxlinks){
     219    if ((*ifrom) < 0){
    220220      printf("Bad link  %d  %d\n",*ifrom,*ito);
    221221      continue;
    222222    }
    223223    ipair[0]--;
    224           ipair[1]--;
     224    ipair[1]--;
     225    //assert(*ifrom>=0&&*ifrom<maxrows);
     226    //assert(*ito>=0&&*ifrom<maxrows);
     227    if (*ifrom<0||*ifrom>=maxrows||*ito<0||*ito>=maxrows) {
     228      printf("bad link %d %d\n",*ifrom,*ito);
     229      continue;
     230    }
     231    numlinks_++;
    225232    ir[nonzpt++] = *ifrom;
    226233    ir[nonzpt++] = *ito;
     
    230237    imin = min(imin, *ito);
    231238  }
    232   fclose(fpin);
    233   fclose(fpp);
     239  fclose(fpData);
     240  fclose(fpParam);
    234241  printf ("imax %d  imin %d\n", imax, imin);
    235242  // Set model size
    236243  numnodes_ = imax + 1;
    237   numlinks_ = maxlinks;
    238244  nrow = numnodes_ + 3;
    239245  ncol = numlinks_ + 2*numnodes_;
  • branches/pre/Samples/myPdco.hpp

    r217 r219  
    3939             int numnodes, int numlinks);
    4040  /// Also reads a model
    41   myPdco(ClpInterior &  model);
     41  myPdco(ClpInterior & model, FILE * fpData, FILE * fpParam);
    4242   /** Destructor */
    4343   virtual ~myPdco();
  • branches/pre/Samples/pdco.cpp

    r217 r219  
    2020  // Get model in some way
    2121  ClpInterior model;
    22   myPdco stuff(model);
     22  // Open graph and parameter files
     23  FILE *fpin = fopen("./g.graph","r");
     24  FILE *fpp = fopen("./gparm","r");
     25  //FILE *fpin = fopen("./g.tiny","r");
     26  //FILE *fpp = fopen("./gparm.tiny","r");
     27  assert(fpin);
     28  assert(fpp);
     29  myPdco stuff(model,fpin,fpp);
    2330  Info info;
    2431  Outfo outfo;
  • branches/pre/include/ClpLsqr.hpp

    r215 r219  
    119119
    120120  void matVecMult( int, CoinDenseVector &, CoinDenseVector &);
    121   /// diag1
    122   void setDiag1(double * array)
     121  /// diag1 - we just borrow as it is part of a CoinDenseVector
     122  void borrowDiag1(double * array)
    123123  { diag1_=array;};
    124124  //@}
Note: See TracChangeset for help on using the changeset viewer.