Ignore:
Timestamp:
Oct 4, 2002 4:58:06 PM (17 years ago)
Author:
forrest
Message:

Presolve (no changes to Makefile)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/devel-1/Test/unitTest.cpp

    r26 r29  
    3030#include "ClpPrimalColumnDantzig.hpp"
    3131#include "ClpParameters.hpp"
     32
     33#include "Presolve.hpp"
    3234
    3335//#############################################################################
     
    5557
    5658int mainTest (int argc, const char *argv[],bool doDual,
    57               ClpSimplex empty)
     59              ClpSimplex empty, bool doPresolve)
    5860{
    5961  int i;
     
    252254                           mps.getRowLower(),mps.getRowUpper());
    253255
    254       if (doDual) {
    255 #if 0
    256         solution.scaling(1);
    257         solution.setDualBound(1.0e6);
    258         solution.setDualTolerance(1.0e-7);
    259         // set objective sense,
    260         if(min[m])
    261           solution.setOptimizationDirection(1);
    262         else       
    263           solution.setOptimizationDirection(-1);
    264         ClpDualRowSteepest steep;
    265         solution.setDualRowPivotAlgorithm(steep);
    266 #endif
    267         solution.setDblParam(ClpObjOffset,mps.objectiveOffset());
    268         solution.dual();
     256      solution.setDblParam(ClpObjOffset,mps.objectiveOffset());
     257      if (doPresolve) {
     258        Presolve pinfo;
     259        ClpSimplex * model2 = pinfo.presolvedModel(solution,1.0e-8);
     260        if (doDual)
     261          model2->dual();
     262        else
     263          model2->primal();
     264        pinfo.postsolve(true);
     265       
     266        delete model2;
     267        printf("Resolving from postsolved model\n");
     268        // later try without (1) and check duals before solve
     269        solution.primal(1);
     270        if (solution.numberIterations())
     271          printf("****** iterated %d\n",solution.numberIterations());
     272        solution.checkSolution();
     273        printf("%g dual %g(%d) Primal %g(%d)\n",
     274               solution.objectiveValue(),
     275               solution.sumDualInfeasibilities(),
     276               solution.numberDualInfeasibilities(),
     277               solution.sumPrimalInfeasibilities(),
     278               solution.numberPrimalInfeasibilities());
     279        {
     280          Presolve pinfoA;
     281          model2 = pinfoA.presolvedModel(solution,1.0e-8);
     282
     283          printf("Resolving from presolved optimal solution\n");
     284          model2->primal(1);
     285               
     286          delete model2;
     287        }
     288
    269289      } else {
    270 #if 0
    271         solution.setPrimalTolerance(1.0e-8);
    272         solution.scaling(1);
    273         ClpPrimalColumnSteepest steep;
    274         solution.setPrimalColumnPivotAlgorithm(steep);
    275         // set objective sense,
    276         if(min[m])
    277           solution.setOptimizationDirection(1);
    278         else       
    279           solution.setOptimizationDirection(-1);
    280         solution.setInfeasibilityCost(1.0e6);
    281 #endif
    282         solution.setDblParam(ClpObjOffset,mps.objectiveOffset());
    283         solution.primal();
     290        if (doDual) {
     291          solution.dual();
     292        } else {
     293          solution.primal();
     294        }
    284295      }
    285296      // Test objective solution value
Note: See TracChangeset for help on using the changeset viewer.