1.1 --- a/src/test/lp_test.cc Sat May 21 21:04:57 2005 +0000
1.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1.3 @@ -1,155 +0,0 @@
1.4 -#include<lemon/lp_skeleton.h>
1.5 -
1.6 -#ifdef HAVE_CONFIG_H
1.7 -#include <config.h>
1.8 -#endif
1.9 -
1.10 -#ifdef HAVE_GLPK
1.11 -#include <lemon/lp_glpk.h>
1.12 -#elif HAVE_CPLEX
1.13 -#include <lemon/lp_cplex.h>
1.14 -#endif
1.15 -
1.16 -using namespace lemon;
1.17 -
1.18 -#ifdef HAVE_GLPK
1.19 -typedef LpGlpk LpDefault;
1.20 -#elif HAVE_CPLEX
1.21 -typedef LpCplex LpDefault;
1.22 -#endif
1.23 -
1.24 -void lpTest(LpSolverBase & lp)
1.25 -{
1.26 - typedef LpSolverBase LP;
1.27 -
1.28 - std::vector<LP::Col> x(10);
1.29 - // for(int i=0;i<10;i++) x.push_back(lp.addCol());
1.30 - lp.addColSet(x);
1.31 -
1.32 - std::vector<LP::Col> y(10);
1.33 - lp.addColSet(y);
1.34 -
1.35 - std::map<int,LP::Col> z;
1.36 -
1.37 - z.insert(std::make_pair(12,INVALID));
1.38 - z.insert(std::make_pair(2,INVALID));
1.39 - z.insert(std::make_pair(7,INVALID));
1.40 - z.insert(std::make_pair(5,INVALID));
1.41 -
1.42 - lp.addColSet(z);
1.43 -
1.44 -
1.45 - LP::Expr e,f,g;
1.46 - LP::Col p1,p2,p3,p4,p5;
1.47 - LP::Constr c;
1.48 -
1.49 - e[p1]=2;
1.50 - e.constComp()=12;
1.51 - e[p1]+=2;
1.52 - e.constComp()+=12;
1.53 - e[p1]-=2;
1.54 - e.constComp()-=12;
1.55 -
1.56 - e=2;
1.57 - e=2.2;
1.58 - e=p1;
1.59 - e=f;
1.60 -
1.61 - e+=2;
1.62 - e+=2.2;
1.63 - e+=p1;
1.64 - e+=f;
1.65 -
1.66 - e-=2;
1.67 - e-=2.2;
1.68 - e-=p1;
1.69 - e-=f;
1.70 -
1.71 - e*=2;
1.72 - e*=2.2;
1.73 - e/=2;
1.74 - e/=2.2;
1.75 -
1.76 - e=((p1+p2)+(p1-p2)+(p1+12)+(12+p1)+(p1-12)+(12-p1)+
1.77 - (f+12)+(12+f)+(p1+f)+(f+p1)+(f+g)+
1.78 - (f-12)+(12-f)+(p1-f)+(f-p1)+(f-g)+
1.79 - 2.2*f+f*2.2+f/2.2+
1.80 - 2*f+f*2+f/2+
1.81 - 2.2*p1+p1*2.2+p1/2.2+
1.82 - 2*p1+p1*2+p1/2
1.83 - );
1.84 -
1.85 -
1.86 - c = (e <= f );
1.87 - c = (e <= 2.2);
1.88 - c = (e <= 2 );
1.89 - c = (e <= p1 );
1.90 - c = (2.2<= f );
1.91 - c = (2 <= f );
1.92 - c = (p1 <= f );
1.93 - c = (p1 <= p2 );
1.94 - c = (p1 <= 2.2);
1.95 - c = (p1 <= 2 );
1.96 - c = (2.2<= p2 );
1.97 - c = (2 <= p2 );
1.98 -
1.99 - c = (e >= f );
1.100 - c = (e >= 2.2);
1.101 - c = (e >= 2 );
1.102 - c = (e >= p1 );
1.103 - c = (2.2>= f );
1.104 - c = (2 >= f );
1.105 - c = (p1 >= f );
1.106 - c = (p1 >= p2 );
1.107 - c = (p1 >= 2.2);
1.108 - c = (p1 >= 2 );
1.109 - c = (2.2>= p2 );
1.110 - c = (2 >= p2 );
1.111 -
1.112 - c = (e == f );
1.113 - c = (e == 2.2);
1.114 - c = (e == 2 );
1.115 - c = (e == p1 );
1.116 - c = (2.2== f );
1.117 - c = (2 == f );
1.118 - c = (p1 == f );
1.119 - //c = (p1 == p2 );
1.120 - c = (p1 == 2.2);
1.121 - c = (p1 == 2 );
1.122 - c = (2.2== p2 );
1.123 - c = (2 == p2 );
1.124 -
1.125 - c = (2 <= e <= 3);
1.126 - c = (2 <= p1<= 3);
1.127 -
1.128 - c = (2 >= e >= 3);
1.129 - c = (2 >= p1>= 3);
1.130 -
1.131 - e[x[3]]=2;
1.132 - e[x[3]]=4;
1.133 - e[x[3]]=1;
1.134 - e.constComp()=12;
1.135 -
1.136 - lp.addRow(LP::INF,e,23);
1.137 - lp.addRow(LP::INF,3.0*(x[1]+x[2]/2)-x[3],23);
1.138 - lp.addRow(LP::INF,3.0*(x[1]+x[2]*2-5*x[3]+12-x[4]/3)+2*x[4]-4,23);
1.139 -
1.140 - lp.addRow(x[1]+x[3]<=x[5]-3);
1.141 - lp.addRow(-7<=x[1]+x[3]-12<=3);
1.142 - lp.addRow(x[1]<=x[5]);
1.143 -
1.144 -
1.145 -
1.146 -}
1.147 -
1.148 -int main()
1.149 -{
1.150 - LpSkeleton lp_skel;
1.151 - lpTest(lp_skel);
1.152 -
1.153 - LpDefault lp;
1.154 -
1.155 - lpTest(lp);
1.156 -
1.157 - return 0;
1.158 -}