Changeset 175 for trunk


Ignore:
Timestamp:
Jul 15, 2003 11:52:20 AM (17 years ago)
Author:
jpfasano
Message:

John Forrest's changes to show how to save last 10 feasible extreme points

Location:
trunk/Test
Files:
2 added
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Test/Makefile.test

    r170 r175  
    2626CXXFLAGS += -DUSE_PRESOLVE
    2727CXXFLAGS += -DCLP_IDIOT
     28# Pick up any include files in Test
     29CXXFLAGS += -I.
    2830#CXXFLAGS += -DQUADRATIC
    2931#ifeq ($(OPTFLAG),-g)
     
    3335TESTSRC := ClpMain.cpp
    3436TESTSRC += unitTest.cpp
     37TESTSRC += MyMessageHandler.cpp
    3538
    3639###############################################################################
  • trunk/Test/unitTest.cpp

    r170 r175  
    2626#include "ClpNetworkMatrix.hpp"
    2727#include "ClpPlusMinusOneMatrix.hpp"
     28#include "MyMessageHandler.hpp"
    2829
    2930#include "Presolve.hpp"
     
    533534    solution.dual();
    534535  }
     536  // Test Message handler
     537  {   
     538    CoinMpsIO m;
     539    std::string fn = mpsDir+"exmip1";
     540    m.readMps(fn.c_str(),"mps");
     541    ClpSimplex solution;
     542    solution.loadProblem(*m.getMatrixByCol(),m.getColLower(),m.getColUpper(),
     543                         m.getObjCoefficients(),
     544                         m.getRowLower(),m.getRowUpper());
     545    // Message handler
     546    MyMessageHandler messageHandler(&solution);
     547    std::cout<<"Testing derived message handler"<<std::endl;
     548    solution.passInMessageHandler(&messageHandler);
     549    solution.primal();
     550
     551    // Write saved solutions
     552    int nc = solution.getNumCols();
     553    int s;
     554    std::deque<StdVectorDouble> fep = messageHandler.getFeasibleExtremePoints();
     555    int numSavedSolutions = fep.size();
     556    for ( s=0; s<numSavedSolutions; ++s ) {
     557      const StdVectorDouble & solnVec = fep[s];
     558      for ( int c=0; c<nc; ++c ) {
     559        if (fabs(solnVec[c])>1.0e-8)
     560          std::cout <<"Saved Solution: " <<s <<" ColNum: " <<c <<" Value: " <<solnVec[c] <<std::endl;
     561      }
     562    }
     563    // solve again without scaling
     564    messageHandler.clearFeasibleExtremePoints();
     565    solution.scaling(0);
     566    solution.allSlackBasis();
     567    solution.primal();
     568    fep = messageHandler.getFeasibleExtremePoints();
     569    numSavedSolutions = fep.size();
     570    for ( s=0; s<numSavedSolutions; ++s ) {
     571      const StdVectorDouble & solnVec = fep[s];
     572      for ( int c=0; c<nc; ++c ) {
     573        if (fabs(solnVec[c])>1.0e-8)
     574          std::cout <<"Saved Solution: " <<s <<" ColNum: " <<c <<" Value: " <<solnVec[c] <<std::endl;
     575      }
     576    }
     577  }
    535578  // test steepest edge
    536579  {   
Note: See TracChangeset for help on using the changeset viewer.