Skip to content
Snippets Groups Projects
Commit e3aeeda7 authored by Francois Hamonic's avatar Francois Hamonic
Browse files

final

parent e67af6ac
Branches
No related tags found
No related merge requests found
No preview for this file type
......@@ -32,4 +32,3 @@
8 9 1.0
9 10 1.0
10 11 1.0
\ No newline at end of file
......@@ -10013,9 +10013,23 @@ Bounds
0.58700 <= x2 <= 0.58700
-0.58700 <= x3 <= -0.58700
-0.95100 <= x4 <= -0.95100
x5 Free
x6 Free
x7 Free
x8 Free
x9 Free
x10 Free
x11 Free
1 <= x12 <= 1
0.30900 <= x13 <= 0.30900
-0.80900 <= x14 <= -0.80900
-0.80900 <= x15 <= -0.80900
0.30900 <= x16 <= 0.30900
x17 Free
x18 Free
x19 Free
x20 Free
x21 Free
x22 Free
x23 Free
End
%!PS-Adobe-2.0 EPSF-2.0
%%Creator: LEMON, graphToEps()
%%CreationDate: Thu Dec 5 03:39:26 2019
%%CreationDate: Thu Dec 5 15:07:12 2019
%%BoundingBox: -108 -94 108 113
%%EndComments
/lb { setlinewidth setrgbcolor newpath moveto
......@@ -68,41 +68,41 @@ gsave
100 dup scale
%Arcs:
gsave
0 0 0 0.0680909 0 0 0 0.00787469 l
0.310636 0 0 0 0 0 0 0.00787469 l
0.457636 0.290727 0.310636 0 0 0 0 0.00787469 l
0.402 0.491727 0.457636 0.290727 0 0 0 0.00787469 l
0.201 0.382091 0 0.0680909 0 0 0 0.00787469 l
0.201 0.382091 0.310636 0 0 0 0 0.00787469 l
0.201 0.382091 0.457636 0.290727 0 0 0 0.00787469 l
0.201 0.382091 0.402 0.491727 0 0 0 0.00787469 l
0 0.436909 0 0.0680909 0 0 0 0.00787469 l
0 0.436909 0.201 0.382091 0 0 0 0.00787469 l
-0.951 0.309 0 0.0680909 0 0 0 0.00787469 l
-0.951 0.309 0 0.436909 0 0 0 0.00787469 l
-0.587 -0.809 0 0.0680909 0 0 0 0.00787469 l
-0.587 -0.809 0 0 0 0 0 0.00787469 l
-0.276364 -0.330545 -0.422545 -0.0199091 0 0 0 0.00787469 l
0.166727 -0.147818 -0.276364 -0.330545 0 0 0 0.00787469 l
0.366273 0.235909 0.166727 -0.147818 0 0 0 0.00787469 l
0.329727 0.473455 0.366273 0.235909 0 0 0 0.00787469 l
0.0190909 0.327273 -0.422545 -0.0199091 0 0 0 0.00787469 l
0.0190909 0.327273 0.166727 -0.147818 0 0 0 0.00787469 l
0.0190909 0.327273 0.366273 0.235909 0 0 0 0.00787469 l
0.0190909 0.327273 0.329727 0.473455 0 0 0 0.00787469 l
-0.331182 0.400364 -0.422545 -0.0199091 0 0 0 0.00787469 l
-0.331182 0.400364 0.0190909 0.327273 0 0 0 0.00787469 l
-0.951 0.309 -0.422545 -0.0199091 0 0 0 0.00787469 l
-0.951 0.309 -0.331182 0.400364 0 0 0 0.00787469 l
-0.587 -0.809 -0.422545 -0.0199091 0 0 0 0.00787469 l
-0.587 -0.809 -0.276364 -0.330545 0 0 0 0.00787469 l
-0.587 -0.809 -0.951 0.309 0 0 0 0.00787469 l
0.587 -0.809 0.310636 0 0 0 0 0.00787469 l
0.587 -0.809 0.166727 -0.147818 0 0 0 0.00787469 l
0.587 -0.809 -0.587 -0.809 0 0 0 0.00787469 l
0.951 0.309 0.457636 0.290727 0 0 0 0.00787469 l
0.951 0.309 0.402 0.491727 0 0 0 0.00787469 l
0.951 0.309 0.366273 0.235909 0 0 0 0.00787469 l
0.951 0.309 0.329727 0.473455 0 0 0 0.00787469 l
0.951 0.309 0.587 -0.809 0 0 0 0.00787469 l
0 1 0.402 0.491727 0 0 0 0.00787469 l
0 1 0.201 0.382091 0 0 0 0.00787469 l
0 1 0 0.436909 0 0 0 0.00787469 l
0 1 0.329727 0.473455 0 0 0 0.00787469 l
0 1 0.0190909 0.327273 0 0 0 0.00787469 l
0 1 -0.331182 0.400364 0 0 0 0.00787469 l
0 1 -0.951 0.309 0 0 0 0.00787469 l
0 1 0.951 0.309 0 0 0 0.00787469 l
grestore
%Nodes:
gsave
0 0.0680909 0.026249 1 1 1 nc
0 0 0.026249 1 1 1 nc
0.310636 0 0.026249 1 1 1 nc
0.457636 0.290727 0.026249 1 1 1 nc
0.402 0.491727 0.026249 1 1 1 nc
0.201 0.382091 0.026249 1 1 1 nc
0 0.436909 0.026249 1 1 1 nc
-0.422545 -0.0199091 0.026249 1 1 1 nc
-0.276364 -0.330545 0.026249 1 1 1 nc
0.166727 -0.147818 0.026249 1 1 1 nc
0.366273 0.235909 0.026249 1 1 1 nc
0.329727 0.473455 0.026249 1 1 1 nc
0.0190909 0.327273 0.026249 1 1 1 nc
-0.331182 0.400364 0.026249 1 1 1 nc
-0.951 0.309 0.026249 1 1 1 nc
-0.587 -0.809 0.026249 1 1 1 nc
0.587 -0.809 0.026249 1 1 1 nc
......
%!PS-Adobe-2.0 EPSF-2.0
%%Creator: LEMON, graphToEps()
%%CreationDate: Thu Dec 5 16:13:00 2019
%%BoundingBox: -108 -94 108 113
%%EndComments
/lb { setlinewidth setrgbcolor newpath moveto
4 2 roll 1 index 1 index curveto stroke } bind def
/l { setlinewidth setrgbcolor newpath moveto lineto stroke } bind def
/c { newpath dup 3 index add 2 index moveto 0 360 arc closepath } bind def
/sq { newpath 2 index 1 index add 2 index 2 index add moveto
2 index 1 index sub 2 index 2 index add lineto
2 index 1 index sub 2 index 2 index sub lineto
2 index 1 index add 2 index 2 index sub lineto
closepath pop pop pop} bind def
/di { newpath 2 index 1 index add 2 index moveto
2 index 2 index 2 index add lineto
2 index 1 index sub 2 index lineto
2 index 2 index 2 index sub lineto
closepath pop pop pop} bind def
/nc { 0 0 0 setrgbcolor 5 index 5 index 5 index c fill
setrgbcolor 1.1 div c fill
} bind def
/nsq { 0 0 0 setrgbcolor 5 index 5 index 5 index sq fill
setrgbcolor 1.1 div sq fill
} bind def
/ndi { 0 0 0 setrgbcolor 5 index 5 index 5 index di fill
setrgbcolor 1.1 div di fill
} bind def
/nfemale { 0 0 0 setrgbcolor 3 index 0.0909091 1.5 mul mul setlinewidth
newpath 5 index 5 index moveto 5 index 5 index 5 index 3.01 mul sub
lineto 5 index 4 index .7 mul sub 5 index 5 index 2.2 mul sub moveto
5 index 4 index .7 mul add 5 index 5 index 2.2 mul sub lineto stroke
5 index 5 index 5 index c fill
setrgbcolor 1.1 div c fill
} bind def
/nmale {
0 0 0 setrgbcolor 3 index 0.0909091 1.5 mul mul setlinewidth
newpath 5 index 5 index moveto
5 index 4 index 1 mul 1.5 mul add
5 index 5 index 3 sqrt 1.5 mul mul add
1 index 1 index lineto
1 index 1 index 7 index sub moveto
1 index 1 index lineto
exch 5 index 3 sqrt .5 mul mul sub exch 5 index .5 mul sub lineto
stroke
5 index 5 index 5 index c fill
setrgbcolor 1.1 div c fill
} bind def
/arrl 1 def
/arrw 0.3 def
/lrl { 2 index mul exch 2 index mul exch rlineto pop} bind def
/arr { setrgbcolor /y1 exch def /x1 exch def /dy exch def /dx exch def
/w exch def /len exch def
newpath x1 dy w 2 div mul add y1 dx w 2 div mul sub moveto
len w sub arrl sub dx dy lrl
arrw dy dx neg lrl
dx arrl w add mul dy w 2 div arrw add mul sub
dy arrl w add mul dx w 2 div arrw add mul add rlineto
dx arrl w add mul neg dy w 2 div arrw add mul sub
dy arrl w add mul neg dx w 2 div arrw add mul add rlineto
arrw dy dx neg lrl
len w sub arrl sub neg dx dy lrl
closepath fill } bind def
/cshow { 2 index 2 index moveto dup stringwidth pop
neg 2 div fosi .35 mul neg rmoveto show pop pop} def
gsave
100 dup scale
%Arcs:
gsave
-0.280883 -0.323493 -0.42839 -0.018524 0 0 0 0.00787469 l
0.173856 -0.141598 -0.280883 -0.323493 0 0 0 0.00787469 l
0.369568 0.240292 0.173856 -0.141598 0 0 0 0.00787469 l
0.33518 0.46834 0.369568 0.240292 0 0 0 0.00787469 l
0.018099 0.325358 -0.42839 -0.018524 0 0 0 0.00787469 l
0.018099 0.325358 0.173856 -0.141598 0 0 0 0.00787469 l
0.018099 0.325358 0.369568 0.240292 0 0 0 0.00787469 l
0.018099 0.325358 0.33518 0.46834 0 0 0 0.00787469 l
-0.33981 0.404089 -0.42839 -0.018524 0 0 0 0.00787469 l
-0.33981 0.404089 0.018099 0.325358 0 0 0 0.00787469 l
-0.951 0.309 -0.42839 -0.018524 0 0 0 0.00787469 l
-0.951 0.309 -0.33981 0.404089 0 0 0 0.00787469 l
-0.587 -0.809 -0.42839 -0.018524 0 0 0 0.00787469 l
-0.587 -0.809 -0.280883 -0.323493 0 0 0 0.00787469 l
-0.587 -0.809 -0.951 0.309 0 0 0 0.00787469 l
0.587 -0.809 0.173856 -0.141598 0 0 0 0.00787469 l
0.587 -0.809 -0.587 -0.809 0 0 0 0.00787469 l
0.951 0.309 0.369568 0.240292 0 0 0 0.00787469 l
0.951 0.309 0.33518 0.46834 0 0 0 0.00787469 l
0.951 0.309 0.587 -0.809 0 0 0 0.00787469 l
0 1 0.33518 0.46834 0 0 0 0.00787469 l
0 1 0.018099 0.325358 0 0 0 0.00787469 l
0 1 -0.33981 0.404089 0 0 0 0.00787469 l
0 1 -0.951 0.309 0 0 0 0.00787469 l
0 1 0.951 0.309 0 0 0 0.00787469 l
grestore
%Nodes:
gsave
-0.42839 -0.018524 0.026249 1 1 1 nc
-0.280883 -0.323493 0.026249 1 1 1 nc
0.173856 -0.141598 0.026249 1 1 1 nc
0.369568 0.240292 0.026249 1 1 1 nc
0.33518 0.46834 0.026249 1 1 1 nc
0.018099 0.325358 0.026249 1 1 1 nc
-0.33981 0.404089 0.026249 1 1 1 nc
-0.951 0.309 0.026249 1 1 1 nc
-0.587 -0.809 0.026249 1 1 1 nc
0.587 -0.809 0.026249 1 1 1 nc
0.951 0.309 0.026249 1 1 1 nc
0 1 0.026249 1 1 1 nc
grestore
grestore
showpage
No preview for this file type
......@@ -35,6 +35,9 @@ void parse(std::string & file_name) {
std::ifstream in(file_name);
int s;
in >> n >> m >> s;
assert(n > s && m > 1 && s > 2);
create_nodes(n);
for(int i=0; i<s; i++) {
int v;
......@@ -49,6 +52,14 @@ void parse(std::string & file_name) {
create_edge(u, v, strength);
}
}
std::string getFileName(const std::string& s) {
char sep = '/';
size_t i = s.rfind(sep, s.length());
if (i != std::string::npos) {
return(s.substr(i+1, s.length() - i));
}
return("");
}
int main (int argc, const char *argv[]) {
if(argc < 3) {
......@@ -109,8 +120,8 @@ int main (int argc, const char *argv[]) {
OsiClpSolver_Builder * solver_builder = new OsiClpSolver_Builder();
solver_builder->addVarType(x_var_number, NULL, NULL, 0, solver_builder->infty());
solver_builder->addVarType(y_var_number, NULL, NULL, 0, solver_builder->infty());
solver_builder->addVarType(x_var_number, NULL, NULL, -solver_builder->infty(), solver_builder->infty());
solver_builder->addVarType(y_var_number, NULL, NULL, -solver_builder->infty(), solver_builder->infty());
solver_builder->addVarType(x2_var_number, NULL, NULL, 0, solver_builder->infty());
solver_builder->addVarType(y2_var_number, NULL, NULL, 0, solver_builder->infty());
solver_builder->init();
......@@ -166,7 +177,7 @@ int main (int argc, const char *argv[]) {
OsiClpSolverInterface * solver = solver_builder->buildSolver(OsiClpSolver_Builder::MIN);
solver->writeLp("debug.lp");
// solver->writeLp("debug.lp");
solver->resolve();
const double * solution = solver->getColSolution();
......@@ -179,8 +190,15 @@ int main (int argc, const char *argv[]) {
coordsMap[u] = Point_t(x_u, y_u);
}
lemon::graphToEps(graph, "graph.eps").coords(coordsMap).run();
// eps output
std::string output = "output/" + getFileName(file_name) + ".eps";
lemon::graphToEps(graph, output).coords(coordsMap).run();
// open eps file
std::string command = "xdg-open " + output;
if(std::system(command.c_str()) != 0)
std::cerr << "failed to launch \"" << command << "\" , open it manually, cheers." << std::endl;
// python output
std::cout << "[";
Graph_t::NodeIt u(graph);
Point_t & p = coordsMap[u];
......
......@@ -3,10 +3,9 @@ import math
center_x = 0
center_y = 0
radius = 1
nb_vertices = 5
angle = 2 * math.pi / nb_vertices
for i in range(nb_vertices):
x = center_x + radius * math.sin(i * angle)
y = center_y + radius * math.cos(i * angle)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment