COIN-OR::LEMON - Graph Library

Changeset 2605:852361980706 in lemon-0.x for test/lp_test.cc


Ignore:
Timestamp:
04/08/08 18:01:28 (16 years ago)
Author:
Balazs Dezso
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@3488
Message:

Bug fixes in LP solvers

  • the copyLp is clarified
  • newLp and copyLp gives back pointers
  • cplex gives back empty string for variables without name
  • cplex row and column retrieval
  • added macro for soplex
File:
1 edited

Legend:

Unmodified
Added
Removed
  • test/lp_test.cc

    r2571 r2605  
    2121#include "test_tools.h"
    2222#include <lemon/tolerance.h>
     23#include <lemon/lp_utils.h>
    2324
    2425#ifdef HAVE_CONFIG_H
     
    217218  {
    218219    LP::DualExpr e,f,g;
    219     LP::Row p1,p2,p3,p4,p5;
     220    LP::Row p1 = INVALID, p2 = INVALID, p3 = INVALID,
     221      p4 = INVALID, p5 = INVALID;
    220222   
    221223    e[p1]=2;
     
    296298  lp.max();
    297299
    298 
    299300  //Testing the problem retrieving routines
    300301  check(lp.objCoeff(x1)==1,"First term should be 1 in the obj function!");
     
    308309  check(  lb==-LpSolverBase::INF,"The lower bound for the first row should be -infty.");
    309310  check(  ub==1,"The upper bound for the first row should be 1.");
    310 
     311  LpSolverBase::Expr e = lp.row(upright);
     312  check(  e.size() == 2, "The row retrieval gives back wrong expression.");
     313  check(  e[x1] == 1, "The first coefficient should 1.");
     314  check(  e[x2] == 1, "The second coefficient should 1.");
     315
     316  LpSolverBase::DualExpr de = lp.col(x1);
     317  check(  de.size() == 4, "The col retrieval gives back wrong expression.");
     318  check(  de[upright] == 1, "The first coefficient should 1.");
     319
     320  LpSolverBase* clp = lp.copyLp();
     321
     322  //Testing the problem retrieving routines
     323  check(clp->objCoeff(x1)==1,"First term should be 1 in the obj function!");
     324  check(clp->isMax(),"This is a maximization!");
     325  check(clp->coeff(upright,x1)==1,"The coefficient in question is 1!");
     326  //  std::cout<<lp.colLowerBound(x1)<<std::endl;
     327  check(  clp->colLowerBound(x1)==0,"The lower bound for variable x1 should be 0.");
     328  std::cerr << clp->colUpperBound(x1) << std::endl;
     329  check(  clp->colUpperBound(x1)==LpSolverBase::INF,"The upper bound for variable x1 should be infty.");
     330
     331  clp->getRowBounds(upright,lb,ub);
     332  check(  lb==-LpSolverBase::INF,"The lower bound for the first row should be -infty.");
     333  check(  ub==1,"The upper bound for the first row should be 1.");
     334  e = clp->row(upright);
     335  check(  e.size() == 2, "The row retrieval gives back wrong expression.");
     336  check(  e[x1] == 1, "The first coefficient should 1.");
     337  check(  e[x2] == 1, "The second coefficient should 1.");
     338
     339  de = clp->col(x1);
     340  check(  de.size() == 4, "The col retrieval gives back wrong expression.");
     341  check(  de[upright] == 1, "The first coefficient should 1.");
     342 
     343  delete clp;
    311344
    312345  //Maximization of x1+x2
     
    338371  lp.min();
    339372  check(lp.primalStatus()==LpSolverBase::UNDEFINED,"Primalstatus should be UNDEFINED");
     373
    340374
    341375//   lp.solve();
Note: See TracChangeset for help on using the changeset viewer.