First of all: revision 1981 is mine, what is important me because I was born in 1981. But what is new in my revision? If you drag nodes with left button, edge-breakpoints do not change location. If you drag nodes by right button, they do, they take up their base situation at the halfpoint of the edge.
1 #include<lemon/lp_skeleton.h>
2 #include "test_tools.h"
9 #include <lemon/lp_glpk.h>
13 #include <lemon/lp_cplex.h>
16 using namespace lemon;
18 void lpTest(LpSolverBase & lp)
20 typedef LpSolverBase LP;
22 std::vector<LP::Col> x(10);
23 // for(int i=0;i<10;i++) x.push_back(lp.addCol());
26 std::vector<LP::Col> y(10);
29 std::map<int,LP::Col> z;
31 z.insert(std::make_pair(12,INVALID));
32 z.insert(std::make_pair(2,INVALID));
33 z.insert(std::make_pair(7,INVALID));
34 z.insert(std::make_pair(5,INVALID));
40 LP::Col p1,p2,p3,p4,p5;
76 e=((p1+p2)+(p1-p2)+(p1+12)+(12+p1)+(p1-12)+(12-p1)+
77 (f+12)+(12+f)+(p1+f)+(f+p1)+(f+g)+
78 (f-12)+(12-f)+(p1-f)+(f-p1)+(f-g)+
136 lp.addRow(LP::INF,e,23);
137 lp.addRow(LP::INF,3.0*(x[1]+x[2]/2)-x[3],23);
138 lp.addRow(LP::INF,3.0*(x[1]+x[2]*2-5*x[3]+12-x[4]/3)+2*x[4]-4,23);
140 lp.addRow(x[1]+x[3]<=x[5]-3);
141 lp.addRow(-7<=x[1]+x[3]-12<=3);
142 lp.addRow(x[1]<=x[5]);
147 LP::Row p1,p2,p3,p4,p5;
172 2.2*p1+p1*2.2+p1/2.2+
180 void aTest(LpSolverBase & lp)
182 typedef LpSolverBase LP;
184 //The following example is taken from the book by Gáspár and Temesi, page 39.
186 typedef LpSolverBase::Row Row;
187 typedef LpSolverBase::Col Col;
190 Col x1 = lp.addCol();
191 Col x2 = lp.addCol();
195 lp.addRow(3*x1+2*x2 >=6);
196 lp.addRow(-1*x1+x2<=4);
197 lp.addRow(5*x1+8*x2<=40);
198 lp.addRow(x1-2*x2<=4);
199 //Nonnegativity of the variables
200 lp.colLowerBound(x1, 0);
201 lp.colLowerBound(x2, 0);
208 double opt=122.0/9.0;
210 if (lp.primalStatus()==LpSolverBase::OPTIMAL){
211 std::cout<< "Z = "<<lp.primalValue()
212 << " (error = " << lp.primalValue()-opt
213 << "); x1 = "<<lp.primal(x1)
214 << "; x2 = "<<lp.primal(x2)
219 std::cout<<"Optimal solution not found!"<<std::endl;
222 check(lp.primalStatus()==LpSolverBase::OPTIMAL,"Primalstatus should be OPTIMAL");
224 check(std::abs(lp.primalValue()-opt)<1e-3,
225 "Wrong optimal value: the right optimum is 122/9 (13.555555...)");
237 LpGlpk lp_glpk1,lp_glpk2;