equal
deleted
inserted
replaced
1 #include "test_tools.h" |
1 #include "test_tools.h" |
2 |
2 |
3 |
3 |
4 #include <lemon/mip_cplex.h> |
4 #include <lemon/mip_cplex.h> |
5 #include <lemon/mip_glpk.h> |
5 #include <lemon/mip_glpk.h> |
6 #include<lemon/config.h> |
6 |
|
7 #ifdef HAVE_CONFIG_H |
|
8 #include <config.h> |
|
9 #endif |
|
10 |
|
11 |
7 |
12 |
8 using namespace lemon; |
13 using namespace lemon; |
9 |
14 |
10 void solveAndCheck(MipSolverBase& lp, MipSolverBase::SolutionStatus stat, |
15 void solveAndCheck(MipSolverBase& lp, MipSolverBase::SolutionStatus stat, |
11 double exp_opt) { |
16 double exp_opt) { |
60 mip.colLowerBound(x1, 0); |
65 mip.colLowerBound(x1, 0); |
61 |
66 |
62 |
67 |
63 |
68 |
64 //Maximization of x1 |
69 //Maximization of x1 |
65 //over the triangle with vertices |
70 //over the triangle with vertices (0,0),(4/5,2/5),(0,2) |
66 double expected_opt=4.0/5.0; |
71 double expected_opt=4.0/5.0; |
67 solveAndCheck(mip, MipSolverBase::OPTIMAL, expected_opt); |
72 solveAndCheck(mip, MipSolverBase::OPTIMAL, expected_opt); |
68 |
73 |
69 //Restrict x2 to integer |
74 //Restrict x2 to integer |
70 mip.colType(x2,MipSolverBase::LEMON_INTEGER); |
75 mip.colType(x2,MipSolverBase::LEMON_INTEGER); |
88 #ifdef HAVE_GLPK |
93 #ifdef HAVE_GLPK |
89 MipGlpk mip1; |
94 MipGlpk mip1; |
90 aTest(mip1); |
95 aTest(mip1); |
91 #endif |
96 #endif |
92 |
97 |
93 |
|
94 |
|
95 #ifdef HAVE_CPLEX |
98 #ifdef HAVE_CPLEX |
96 //std::cout<<ATTILA<<INTEGER; |
|
97 MipCplex mip2; |
99 MipCplex mip2; |
98 aTest(mip2); |
100 aTest(mip2); |
99 #endif |
101 #endif |
100 |
102 |
101 return 0; |
103 return 0; |