diff --git a/tests/instances/imports/b_gen.gboml b/tests/instances/imports/b_gen.gboml new file mode 100644 index 0000000000000000000000000000000000000000..7d506d3bc8fa20f8ecd930e99fd9b7a356f60e47 --- /dev/null +++ b/tests/instances/imports/b_gen.gboml @@ -0,0 +1,11 @@ +#TIMEHORIZON T = 1; + +#NODE B[i] for i in [0:1] + #PARAMETERS + a <- 2*i; + #VARIABLES + internal : x; + #CONSTRAINTS + x <= -4; + #OBJECTIVES + max : x; \ No newline at end of file diff --git a/tests/instances/imports/b_nogen.gboml b/tests/instances/imports/b_nogen.gboml new file mode 100644 index 0000000000000000000000000000000000000000..7bd19c10abb4d4cd4d73c389d7e4dd28d22bda54 --- /dev/null +++ b/tests/instances/imports/b_nogen.gboml @@ -0,0 +1,11 @@ +#TIMEHORIZON T = 1; + +#NODE B + #PARAMETERS + a <- 12; + #VARIABLES + internal : x; + #CONSTRAINTS + x <= -4; + #OBJECTIVES + max : x; \ No newline at end of file diff --git a/tests/instances/ko_parsing/test25.txt b/tests/instances/ko_parsing/test25.txt index 9cfbab39c6725a31887d6e73e36c860413710c31..b53e0d94adc201c95f9ee80513c8fd486ff10306 100644 --- a/tests/instances/ko_parsing/test25.txt +++ b/tests/instances/ko_parsing/test25.txt @@ -1,24 +1,24 @@ - -#TIMEHORIZON T = 2; - -#NODE B -#PARAMETERS -lower_bound = 5; -#VARIABLES -external integer : b; -#CONSTRAINTS -b >= lower_bound; -#OBJECTIVES -min : b; - -#NODE A -#PARAMETERS -lower_bound = 6; -#VARIABLES -external integer : x; -#CONSTRAINTS -x >= lower_bound; -#OBJECTIVES -min : x; - + +#TIMEHORIZON T = 2; + +#NODE B +#PARAMETERS +lower_bound = 5; +#VARIABLES +external integer : b; +#CONSTRAINTS +b >= lower_bound; +#OBJECTIVES +min : b; + +#NODE A +#PARAMETERS +lower_bound = 6; +#VARIABLES +external integer : x; +#CONSTRAINTS +x >= lower_bound; +#OBJECTIVES +min : x; + #HYPEREDGE H = import H from "test24.txt" \ No newline at end of file diff --git a/tests/instances/ko_parsing/test3.txt b/tests/instances/ko_parsing/test3.txt index d3c16210bbad11a714981738adf809473b2c1c64..5acaa9de8be1d014634079857bc99272b7baf0d3 100644 --- a/tests/instances/ko_parsing/test3.txt +++ b/tests/instances/ko_parsing/test3.txt @@ -1,11 +1,11 @@ -// Negative timehorizon error - -#TIMEHORIZON T = -10; - -#NODE H -#VARIABLES -internal : x; -#CONSTRAINTS -x[0]>=0; -#OBJECTIVES +// Negative timehorizon error + +#TIMEHORIZON T = -10; + +#NODE H +#VARIABLES +internal : x; +#CONSTRAINTS +x[0]>=0; +#OBJECTIVES min : x[0]; \ No newline at end of file diff --git a/tests/instances/ok/complex_parsing.txt b/tests/instances/ok/complex_parsing.txt index a4e026904f851167ba597dc493b2ee021f1f158f..1e4a503646f2b9e259f8f6960cc66e626c365b67 100644 --- a/tests/instances/ok/complex_parsing.txt +++ b/tests/instances/ok/complex_parsing.txt @@ -6,28 +6,35 @@ c = 2e2; d = -1; e <- 2e-2; - f = [0:2]; + f = 0:2; + f = {i for i in 0:10, i for i in 100:120}; g = [0:10:2]; #NODE nodeI = import nodeA from "hello.gboml"; #NODE nodeI2 = import nodeA from "hello.gboml" with a = 2; b external; c internal; -#NODE nodeL[i] for i in [0:10] @hello - x = 3; - x = @test @test; +#NODE ALAKAZAM[i] for i in [0:10] @cquetuveux + x = 3*i; + y = @test @test; #VARIABLES pass; #HYPEREDGE E[i] for i in [0:10] #CONSTRAINTS pass; -#NODE node1 +#NODE node1 extends A from "lol.txt" @cquetuveux #PARAMETERS a = 2; b = import "lol.csv"; c = {2, 2 for i in [0:2], node1, "hello", import "lol.csv", {22}, f(22, 2 for i in [0:2])}; d = "hey"; e = {2 for i in global.g}; + f <- {A, B}; + dict <- {"heu": A, "je": B}; + func(x) <- x*2; + #CONSTRAINTS + sum(e.x for e in @pv) == 0; + dict["heu"].x == dict["je"].x + f(2); #NODE A #VARIABLES external: x @tag; @@ -58,6 +65,8 @@ #OBJECTIVES min named: a @tag; max: b[i] for i in [0:2*4] where i % 2 == 1; + deactivate named if 3 - 1 == 2; + activate @tag; #HYPEREDGE he1 = import lal from "x" with a = 2; b = 2; \ No newline at end of file diff --git a/tests/instances/ok/test1.txt b/tests/instances/ok/test1.txt index 60620fe097d37cd4e628e888af17c5f169720ebf..420824440ccbcab6f853e52fd5e1ce4dffb23515 100644 --- a/tests/instances/ok/test1.txt +++ b/tests/instances/ok/test1.txt @@ -1,3 +1,3 @@ -// Only timehorizon defined nothing else - +// Only timehorizon defined nothing else + #TIMEHORIZON T=10; \ No newline at end of file diff --git a/tests/instances/ok/test10.txt b/tests/instances/ok/test10.txt index a47542d905de703915de077fac69ad941a23b3cb..5ce5c6b99fa13a9526657572360b5f48c634ae8d 100644 --- a/tests/instances/ok/test10.txt +++ b/tests/instances/ok/test10.txt @@ -1,12 +1,12 @@ -// Non linearity in constraint ERROR - -#TIMEHORIZON -T = 10; - -#NODE A -#VARIABLES -internal : x[T]; -#CONSTRAINTS -x[t]/x[t]>=0; -#OBJECTIVES +// Non linearity in constraint ERROR + +#TIMEHORIZON +T = 10; + +#NODE A +#VARIABLES +internal : x[T]; +#CONSTRAINTS +x[t]/x[t]>=0; +#OBJECTIVES min: x[t]; \ No newline at end of file diff --git a/tests/instances/ok/test11.txt b/tests/instances/ok/test11.txt index 7d9cc5c32bc750fcbd025491ce94b5fcf3f90e85..24182de5c05f7aecb34426cbab37fa2bc2a39bac 100644 --- a/tests/instances/ok/test11.txt +++ b/tests/instances/ok/test11.txt @@ -1,12 +1,12 @@ -// Only there to check if any addition prints occur - -#TIMEHORIZON -T = 10; - -#NODE A -#VARIABLES -internal : x[T]; -#CONSTRAINTS -x[t]>=0; -#OBJECTIVES +// Only there to check if any addition prints occur + +#TIMEHORIZON +T = 10; + +#NODE A +#VARIABLES +internal : x[T]; +#CONSTRAINTS +x[t]>=0; +#OBJECTIVES min: x[t]; \ No newline at end of file diff --git a/tests/instances/ok/test12.json b/tests/instances/ok/test12.json index c02cb8a0f73d9b3cdf1632fcf52d88bb5c664b21..d34b98bfac955b042e0b9dc790556ab30b994eb2 100644 --- a/tests/instances/ok/test12.json +++ b/tests/instances/ok/test12.json @@ -1,57 +1,57 @@ -{ - "version": "0.0.4", - "model": { - "horizon": 10, - "number_nodes": 1, - "global_parameters": {}, - "nodes": { - "A": { - "number_parameters": 0, - "number_variables": 1, - "number_constraints": 1, - "number_expanded_constraints": 1, - "number_objectives": 1, - "number_expanded_objectives": 1, - "parameters": {}, - "variables": [ - "x" - ] - } - }, - "hyperedges": {} - }, - "solver": { - "name": "gurobi", - "options": {}, - "status": 2 - }, - "solution": { - "status": "optimal", - "objective": 0.0, - "elements": { - "A": { - "variables": { - "x": { - "values": [ - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0 - ] - } - }, - "objectives": { - "unnamed": [ - 0.0 - ] - } - } - } - } +{ + "version": "0.0.4", + "model": { + "horizon": 10, + "number_nodes": 1, + "global_parameters": {}, + "nodes": { + "A": { + "number_parameters": 0, + "number_variables": 1, + "number_constraints": 1, + "number_expanded_constraints": 1, + "number_objectives": 1, + "number_expanded_objectives": 1, + "parameters": {}, + "variables": [ + "x" + ] + } + }, + "hyperedges": {} + }, + "solver": { + "name": "gurobi", + "options": {}, + "status": 2 + }, + "solution": { + "status": "optimal", + "objective": 0.0, + "elements": { + "A": { + "variables": { + "x": { + "values": [ + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0 + ] + } + }, + "objectives": { + "unnamed": [ + 0.0 + ] + } + } + } + } } \ No newline at end of file diff --git a/tests/instances/ok/test12.txt b/tests/instances/ok/test12.txt index d7a5a01a54cf737a32896e71d2f0ec02c6bc0fc5..e65ac2548735f497ae4a372c8b2c47991eb9528c 100644 --- a/tests/instances/ok/test12.txt +++ b/tests/instances/ok/test12.txt @@ -1,12 +1,12 @@ -// Test working constrainting and optimizing only one element of vector - -#TIMEHORIZON -T = 10; - -#NODE A -#VARIABLES -internal : x[T]; -#CONSTRAINTS -x[T-1]>=0; -#OBJECTIVES +// Test working constrainting and optimizing only one element of vector + +#TIMEHORIZON +T = 10; + +#NODE A +#VARIABLES +internal : x[T]; +#CONSTRAINTS +x[T-1]>=0; +#OBJECTIVES min: x[T-1]; \ No newline at end of file diff --git a/tests/instances/ok/test13.txt b/tests/instances/ok/test13.txt index e2a0a7d2a204ccb8a25507373d5baf8abcde27d4..3b8b11b9cbf06e00ef43f8bb7dbf408c7d453a75 100644 --- a/tests/instances/ok/test13.txt +++ b/tests/instances/ok/test13.txt @@ -1,12 +1,12 @@ -// Testing the keyword where - -#TIMEHORIZON -T = 10; - -#NODE A -#VARIABLES -internal : x[T]; -#CONSTRAINTS -x[t]>=0 where t == 9; -#OBJECTIVES +// Testing the keyword where + +#TIMEHORIZON +T = 10; + +#NODE A +#VARIABLES +internal : x[T]; +#CONSTRAINTS +x[t]>=0 where t == 9; +#OBJECTIVES min: x[T-1]; \ No newline at end of file diff --git a/tests/instances/ok/test14.txt b/tests/instances/ok/test14.txt index 71a3b5e171144ca6bc26aab8429131fa785891ca..9bdb921979514ca888c7ad843e64dfe08b696771 100644 --- a/tests/instances/ok/test14.txt +++ b/tests/instances/ok/test14.txt @@ -1,12 +1,12 @@ -//Testing the constraint loop iteration - -#TIMEHORIZON -T = 10; - -#NODE A -#VARIABLES -internal : x[T]; -#CONSTRAINTS -x[i]>=0 for i in [9:9]; -#OBJECTIVES +//Testing the constraint loop iteration + +#TIMEHORIZON +T = 10; + +#NODE A +#VARIABLES +internal : x[T]; +#CONSTRAINTS +x[i]>=0 for i in [9:9]; +#OBJECTIVES min: x[T-1]; \ No newline at end of file diff --git a/tests/instances/ok/test15.json b/tests/instances/ok/test15.json index 67c27c0759554ce7da768a9eed5951816921c681..a49369966a57ec99d7d8345cfad3955002b9f4ca 100644 --- a/tests/instances/ok/test15.json +++ b/tests/instances/ok/test15.json @@ -1,119 +1,119 @@ -{ - "version": "0.0.4", - "model": { - "horizon": 1, - "number_nodes": 2, - "global_parameters": {}, - "nodes": { - "R": { - "number_parameters": 0, - "number_variables": 4, - "number_constraints": 0, - "number_expanded_constraints": 0, - "number_objectives": 0, - "number_expanded_objectives": 0, - "parameters": {}, - "variables": [ - "f", - "d", - "h", - "ff" - ] - }, - "A": { - "number_parameters": 0, - "number_variables": 3, - "number_constraints": 3, - "number_expanded_constraints": 3, - "number_objectives": 1, - "number_expanded_objectives": 1, - "parameters": {}, - "variables": [ - "b", - "a", - "c" - ] - } - }, - "hyperedges": { - "links": { - "number_parameters": 0, - "number_constraints": 4, - "number_expanded_constraints": 8, - "parameters": {}, - "variables_used": { - "R": [ - "f", - "ff", - "h", - "d" - ], - "A": [ - "b", - "a", - "c" - ] - } - } - } - }, - "solver": { - "name": "gurobi", - "options": {}, - "status": 2 - }, - "solution": { - "status": "optimal", - "objective": 0.0, - "elements": { - "R": { - "variables": { - "f": { - "values": [ - 1.0 - ] - }, - "d": { - "values": [ - 2.0 - ] - }, - "h": { - "values": [ - 0.0 - ] - }, - "ff": { - "values": [ - 1.0 - ] - } - } - }, - "A": { - "variables": { - "b": { - "values": [ - 1.0 - ] - }, - "a": { - "values": [ - 0.0 - ] - }, - "c": { - "values": [ - 2.0 - ] - } - }, - "objectives": { - "unnamed": [ - 0.0 - ] - } - } - } - } +{ + "version": "0.0.4", + "model": { + "horizon": 1, + "number_nodes": 2, + "global_parameters": {}, + "nodes": { + "R": { + "number_parameters": 0, + "number_variables": 4, + "number_constraints": 0, + "number_expanded_constraints": 0, + "number_objectives": 0, + "number_expanded_objectives": 0, + "parameters": {}, + "variables": [ + "f", + "d", + "h", + "ff" + ] + }, + "A": { + "number_parameters": 0, + "number_variables": 3, + "number_constraints": 3, + "number_expanded_constraints": 3, + "number_objectives": 1, + "number_expanded_objectives": 1, + "parameters": {}, + "variables": [ + "b", + "a", + "c" + ] + } + }, + "hyperedges": { + "links": { + "number_parameters": 0, + "number_constraints": 4, + "number_expanded_constraints": 8, + "parameters": {}, + "variables_used": { + "R": [ + "f", + "ff", + "h", + "d" + ], + "A": [ + "b", + "a", + "c" + ] + } + } + } + }, + "solver": { + "name": "gurobi", + "options": {}, + "status": 2 + }, + "solution": { + "status": "optimal", + "objective": 0.0, + "elements": { + "R": { + "variables": { + "f": { + "values": [ + 1.0 + ] + }, + "d": { + "values": [ + 2.0 + ] + }, + "h": { + "values": [ + 0.0 + ] + }, + "ff": { + "values": [ + 1.0 + ] + } + } + }, + "A": { + "variables": { + "b": { + "values": [ + 1.0 + ] + }, + "a": { + "values": [ + 0.0 + ] + }, + "c": { + "values": [ + 2.0 + ] + } + }, + "objectives": { + "unnamed": [ + 0.0 + ] + } + } + } + } } \ No newline at end of file diff --git a/tests/instances/ok/test15.txt b/tests/instances/ok/test15.txt index 40757cacc0e8b56a5543edf1995f66e68337851e..05c86bc289a6dd33101a2219051d5546815e57b1 100644 --- a/tests/instances/ok/test15.txt +++ b/tests/instances/ok/test15.txt @@ -1,31 +1,31 @@ -//Testing hyperedges - -#TIMEHORIZON T = 1; - -#NODE A -#VARIABLES -external : b ; -external : a ; -external : c; - -#CONSTRAINTS -a >=0; -b >=1; -c >=2; -#OBJECTIVES -min : a ; - -#NODE R -#VARIABLES -external : f; -external : d; -external: h; -external : ff; - -#HYPEREDGE links -#CONSTRAINTS -A.b == R.f; -A.b == R.ff; -R.h == A.a; -A.c == R.d; - +//Testing hyperedges + +#TIMEHORIZON T = 1; + +#NODE A +#VARIABLES +external : b ; +external : a ; +external : c; + +#CONSTRAINTS +a >=0; +b >=1; +c >=2; +#OBJECTIVES +min : a ; + +#NODE R +#VARIABLES +external : f; +external : d; +external: h; +external : ff; + +#HYPEREDGE links +#CONSTRAINTS +A.b == R.f; +A.b == R.ff; +R.h == A.a; +A.c == R.d; + diff --git a/tests/instances/ok/test16.txt b/tests/instances/ok/test16.txt index 849f6be4f899d4272a7e193e72c6152fdbcca163..fc30e47007ec2040c6035160e5875c1b2bd2f455 100644 --- a/tests/instances/ok/test16.txt +++ b/tests/instances/ok/test16.txt @@ -1,17 +1,17 @@ -// Testing objective extension - -#TIMEHORIZON T = 3; - -#NODE A -#PARAMETERS -w = {1,2,3}; -one = 1; -#VARIABLES -internal : x[T]; -external : y[T]; -#CONSTRAINTS -x[t]>=0; -y[t]>=0; -#OBJECTIVES -min: w[t]*x[0]; +// Testing objective extension + +#TIMEHORIZON T = 3; + +#NODE A +#PARAMETERS +w = {1,2,3}; +one = 1; +#VARIABLES +internal : x[T]; +external : y[T]; +#CONSTRAINTS +x[t]>=0; +y[t]>=0; +#OBJECTIVES +min: w[t]*x[0]; min: one*y[0]; \ No newline at end of file diff --git a/tests/instances/ok/test17.txt b/tests/instances/ok/test17.txt index 455c6210878d0351459109bfd7f76bd0f40d05f5..497c92eea81bf73c7077241d2a75064885e4fc49 100644 --- a/tests/instances/ok/test17.txt +++ b/tests/instances/ok/test17.txt @@ -1,11 +1,11 @@ -// Test a vector variable of length 0 - -#TIMEHORIZON T = 10; - -#NODE A -#VARIABLES -internal : x[0] ; -#CONSTRAINTS -x[0]>=0; -#OBJECTIVES -min: x[0]; +// Test a vector variable of length 0 + +#TIMEHORIZON T = 10; + +#NODE A +#VARIABLES +internal : x[0] ; +#CONSTRAINTS +x[0]>=0; +#OBJECTIVES +min: x[0]; diff --git a/tests/instances/ok/test18.txt b/tests/instances/ok/test18.txt index 570427b307360f77d104724ff65a4921470aa33a..9a1665272f9900700eb26a04dd20b66e992cc683 100644 --- a/tests/instances/ok/test18.txt +++ b/tests/instances/ok/test18.txt @@ -1,13 +1,13 @@ -// Test objective declared as sum - -#TIMEHORIZON -T = 10; - -#NODE C -#VARIABLES -internal : x[T]; -external : y[T]; -#CONSTRAINTS -x[t]>=0; -#OBJECTIVES +// Test objective declared as sum + +#TIMEHORIZON +T = 10; + +#NODE C +#VARIABLES +internal : x[T]; +external : y[T]; +#CONSTRAINTS +x[t]>=0; +#OBJECTIVES min: sum(x[i] for i in [0:T-1]); \ No newline at end of file diff --git a/tests/instances/ok/test19.json b/tests/instances/ok/test19.json index 3800d362b87c9a5fcc7258be14a4908ffc660b3f..299be9b62b5f70faa84a9c089ccc4297d99c2237 100644 --- a/tests/instances/ok/test19.json +++ b/tests/instances/ok/test19.json @@ -1,1047 +1,1047 @@ -{ - "version": "0.0.4", - "model": { - "horizon": 10, - "number_nodes": 1, - "global_parameters": {}, - "nodes": { - "A": { - "number_parameters": 0, - "number_variables": 1, - "number_constraints": 2, - "number_expanded_constraints": 1002, - "number_objectives": 1, - "number_expanded_objectives": 1000, - "parameters": {}, - "variables": [ - "x" - ] - } - }, - "hyperedges": {} - }, - "solver": { - "name": "gurobi", - "options": {}, - "status": 2 - }, - "solution": { - "status": "optimal", - "objective": 10.0, - "elements": { - "A": { - "variables": { - "x": { - "values": [ - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 10.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0 - ] - } - }, - "objectives": { - "unnamed": [ - 10.0 - ] - } - } - } - } +{ + "version": "0.0.4", + "model": { + "horizon": 10, + "number_nodes": 1, + "global_parameters": {}, + "nodes": { + "A": { + "number_parameters": 0, + "number_variables": 1, + "number_constraints": 2, + "number_expanded_constraints": 1002, + "number_objectives": 1, + "number_expanded_objectives": 1000, + "parameters": {}, + "variables": [ + "x" + ] + } + }, + "hyperedges": {} + }, + "solver": { + "name": "gurobi", + "options": {}, + "status": 2 + }, + "solution": { + "status": "optimal", + "objective": 10.0, + "elements": { + "A": { + "variables": { + "x": { + "values": [ + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 10.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0 + ] + } + }, + "objectives": { + "unnamed": [ + 10.0 + ] + } + } + } + } } \ No newline at end of file diff --git a/tests/instances/ok/test19.txt b/tests/instances/ok/test19.txt index 8e3fe62e39e58f0221de133e489097f90438e4dc..e566792c676146d6af241898e623b6468ad9cd32 100644 --- a/tests/instances/ok/test19.txt +++ b/tests/instances/ok/test19.txt @@ -1,13 +1,13 @@ -// Test explicit objective extension - -#TIMEHORIZON -T = 10; - -#NODE A -#VARIABLES -internal : x[1000]; -#CONSTRAINTS -x[i]>=0 for i in [0:999]; -x[i] == 10 for i in [0:999] where i == 100; -#OBJECTIVES +// Test explicit objective extension + +#TIMEHORIZON +T = 10; + +#NODE A +#VARIABLES +internal : x[1000]; +#CONSTRAINTS +x[i]>=0 for i in [0:999]; +x[i] == 10 for i in [0:999] where i == 100; +#OBJECTIVES min : x[i] for i in [0:999]; \ No newline at end of file diff --git a/tests/instances/ok/test2.txt b/tests/instances/ok/test2.txt index 9708288812f47af999a327ac6bcf9fe191406cd7..1be8bdfd02fd58f87276eb5cb879df87b931af7a 100644 --- a/tests/instances/ok/test2.txt +++ b/tests/instances/ok/test2.txt @@ -1,11 +1,11 @@ -// Error as variable is a scalar but used as vector - -#TIMEHORIZON T = 1; - -#NODE H -#VARIABLES -internal : x; -#CONSTRAINTS -x[0]>=0; -#OBJECTIVES +// Error as variable is a scalar but used as vector + +#TIMEHORIZON T = 1; + +#NODE H +#VARIABLES +internal : x; +#CONSTRAINTS +x[0]>=0; +#OBJECTIVES min : x[0]; \ No newline at end of file diff --git a/tests/instances/ok/test20.json b/tests/instances/ok/test20.json index 0eb4e4bfb5d89d11df267924d74a3a14ba7cc2e4..368cbdc646f3e55f095683c0aef58fb66e4265bc 100644 --- a/tests/instances/ok/test20.json +++ b/tests/instances/ok/test20.json @@ -1,118 +1,118 @@ -{ - "version": "0.0.4", - "model": { - "horizon": 10, - "number_nodes": 2, - "global_parameters": {}, - "nodes": { - "B": { - "number_parameters": 0, - "number_variables": 2, - "number_constraints": 0, - "number_expanded_constraints": 0, - "number_objectives": 0, - "number_expanded_objectives": 0, - "parameters": {}, - "variables": [ - "y", - "w" - ] - }, - "A": { - "number_parameters": 0, - "number_variables": 1, - "number_constraints": 1, - "number_expanded_constraints": 10, - "number_objectives": 1, - "number_expanded_objectives": 10, - "parameters": {}, - "variables": [ - "x" - ] - } - }, - "hyperedges": { - "link": { - "number_parameters": 0, - "number_constraints": 1, - "number_expanded_constraints": 12, - "parameters": {}, - "variables_used": { - "B": [ - "y", - "w" - ], - "A": [ - "x" - ] - } - } - } - }, - "solver": { - "name": "gurobi", - "options": {}, - "status": 2 - }, - "solution": { - "status": "optimal", - "objective": 20.0, - "elements": { - "B": { - "variables": { - "y": { - "values": [ - 0.0, - 0.0, - 0.0, - 2.0, - 2.0, - 2.0, - 0.0, - 0.0, - 0.0, - 0.0 - ] - }, - "w": { - "values": [ - 2.0, - 2.0, - 2.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0 - ] - } - } - }, - "A": { - "variables": { - "x": { - "values": [ - 2.0, - 2.0, - 2.0, - 2.0, - 2.0, - 2.0, - 2.0, - 2.0, - 2.0, - 2.0 - ] - } - }, - "objectives": { - "unnamed": [ - 20.0 - ] - } - } - } - } +{ + "version": "0.0.4", + "model": { + "horizon": 10, + "number_nodes": 2, + "global_parameters": {}, + "nodes": { + "B": { + "number_parameters": 0, + "number_variables": 2, + "number_constraints": 0, + "number_expanded_constraints": 0, + "number_objectives": 0, + "number_expanded_objectives": 0, + "parameters": {}, + "variables": [ + "y", + "w" + ] + }, + "A": { + "number_parameters": 0, + "number_variables": 1, + "number_constraints": 1, + "number_expanded_constraints": 10, + "number_objectives": 1, + "number_expanded_objectives": 10, + "parameters": {}, + "variables": [ + "x" + ] + } + }, + "hyperedges": { + "link": { + "number_parameters": 0, + "number_constraints": 1, + "number_expanded_constraints": 12, + "parameters": {}, + "variables_used": { + "B": [ + "y", + "w" + ], + "A": [ + "x" + ] + } + } + } + }, + "solver": { + "name": "gurobi", + "options": {}, + "status": 2 + }, + "solution": { + "status": "optimal", + "objective": 20.0, + "elements": { + "B": { + "variables": { + "y": { + "values": [ + 0.0, + 0.0, + 0.0, + 2.0, + 2.0, + 2.0, + 0.0, + 0.0, + 0.0, + 0.0 + ] + }, + "w": { + "values": [ + 2.0, + 2.0, + 2.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0 + ] + } + } + }, + "A": { + "variables": { + "x": { + "values": [ + 2.0, + 2.0, + 2.0, + 2.0, + 2.0, + 2.0, + 2.0, + 2.0, + 2.0, + 2.0 + ] + } + }, + "objectives": { + "unnamed": [ + 20.0 + ] + } + } + } + } } \ No newline at end of file diff --git a/tests/instances/ok/test20.txt b/tests/instances/ok/test20.txt index e2ec9fde1226ff6a5debb65145b2dddbabd60622..e7c9c9113e23d6ef9207357c3c0bcac6dd41d698 100644 --- a/tests/instances/ok/test20.txt +++ b/tests/instances/ok/test20.txt @@ -1,21 +1,21 @@ -// Test linking with explicit extension - -#TIMEHORIZON -T = 10; - -#NODE A -#VARIABLES -external : x[T]; -#CONSTRAINTS -x[t]>=2; -#OBJECTIVES -min:x[t]; - -#NODE B -#VARIABLES -external : y[T]; -external : w[T]; - -#HYPEREDGE link -#CONSTRAINTS +// Test linking with explicit extension + +#TIMEHORIZON +T = 10; + +#NODE A +#VARIABLES +external : x[T]; +#CONSTRAINTS +x[t]>=2; +#OBJECTIVES +min:x[t]; + +#NODE B +#VARIABLES +external : y[T]; +external : w[T]; + +#HYPEREDGE link +#CONSTRAINTS A.x[i] == B.y[i] + B.w[i] for i in [0:5]; \ No newline at end of file diff --git a/tests/instances/ok/test21.json b/tests/instances/ok/test21.json index 1baaca634d775da35804594cdbeff23dc9b50b41..73735cb3d6f168403434b4c21d33bdb645ea2dd4 100644 --- a/tests/instances/ok/test21.json +++ b/tests/instances/ok/test21.json @@ -1,100 +1,100 @@ -{ - "version": "0.0.4", - "model": { - "horizon": 2, - "number_nodes": 2, - "global_parameters": { - "a": [ - 2 - ], - "b": [ - 3 - ] - }, - "nodes": { - "D": { - "number_parameters": 0, - "number_variables": 1, - "number_constraints": 0, - "number_expanded_constraints": 0, - "number_objectives": 0, - "number_expanded_objectives": 0, - "parameters": {}, - "variables": [ - "y" - ] - }, - "O": { - "number_parameters": 2, - "number_variables": 1, - "number_constraints": 2, - "number_expanded_constraints": 4, - "number_objectives": 1, - "number_expanded_objectives": 2, - "parameters": { - "p1": [ - 2 - ], - "p2": [ - 3 - ] - }, - "variables": [ - "x" - ] - } - }, - "hyperedges": { - "l1": { - "number_parameters": 0, - "number_constraints": 1, - "number_expanded_constraints": 2, - "parameters": {}, - "variables_used": { - "D": [ - "y" - ], - "O": [ - "x" - ] - } - } - } - }, - "solver": { - "name": "cplex", - "options": {}, - "status": 101 - }, - "solution": { - "status": "optimal", - "objective": 5.0, - "elements": { - "D": { - "variables": { - "y": { - "values": [ - 1.0, - 2.0 - ] - } - } - }, - "O": { - "variables": { - "x": { - "values": [ - 2.0, - 3.0 - ] - } - }, - "objectives": { - "unnamed": [ - 5.0 - ] - } - } - } - } +{ + "version": "0.0.4", + "model": { + "horizon": 2, + "number_nodes": 2, + "global_parameters": { + "a": [ + 2 + ], + "b": [ + 3 + ] + }, + "nodes": { + "D": { + "number_parameters": 0, + "number_variables": 1, + "number_constraints": 0, + "number_expanded_constraints": 0, + "number_objectives": 0, + "number_expanded_objectives": 0, + "parameters": {}, + "variables": [ + "y" + ] + }, + "O": { + "number_parameters": 2, + "number_variables": 1, + "number_constraints": 2, + "number_expanded_constraints": 4, + "number_objectives": 1, + "number_expanded_objectives": 2, + "parameters": { + "p1": [ + 2 + ], + "p2": [ + 3 + ] + }, + "variables": [ + "x" + ] + } + }, + "hyperedges": { + "l1": { + "number_parameters": 0, + "number_constraints": 1, + "number_expanded_constraints": 2, + "parameters": {}, + "variables_used": { + "D": [ + "y" + ], + "O": [ + "x" + ] + } + } + } + }, + "solver": { + "name": "cplex", + "options": {}, + "status": 101 + }, + "solution": { + "status": "optimal", + "objective": 5.0, + "elements": { + "D": { + "variables": { + "y": { + "values": [ + 1.0, + 2.0 + ] + } + } + }, + "O": { + "variables": { + "x": { + "values": [ + 2.0, + 3.0 + ] + } + }, + "objectives": { + "unnamed": [ + 5.0 + ] + } + } + } + } } \ No newline at end of file diff --git a/tests/instances/ok/test21.txt b/tests/instances/ok/test21.txt index 136e3c0e09e70a2a0079e251381887d23d0b06d4..8a4f53b2ca00433f83074d3021e3c15d8d88a49f 100644 --- a/tests/instances/ok/test21.txt +++ b/tests/instances/ok/test21.txt @@ -1,32 +1,32 @@ -// Test linking with global parameters - -#TIMEHORIZON - T = 2; - -#GLOBAL - a = 2; - b = 3; - -#NODE O - #PARAMETERS - p1 = global.a; - p2 = global.b; - - #VARIABLES - external integer : x[2]; - - #CONSTRAINTS - x[0]==(global.a+p1)/2; - x[1]==(global.b+p2)/2; - - #OBJECTIVES - min: x[t]*global.a/2; - - -#NODE D - #VARIABLES - external integer : y[T]; - -#HYPEREDGE l1 - #CONSTRAINTS +// Test linking with global parameters + +#TIMEHORIZON + T = 2; + +#GLOBAL + a = 2; + b = 3; + +#NODE O + #PARAMETERS + p1 = global.a; + p2 = global.b; + + #VARIABLES + external integer : x[2]; + + #CONSTRAINTS + x[0]==(global.a+p1)/2; + x[1]==(global.b+p2)/2; + + #OBJECTIVES + min: x[t]*global.a/2; + + +#NODE D + #VARIABLES + external integer : y[T]; + +#HYPEREDGE l1 + #CONSTRAINTS O.x[t] <= global.a *D.y[t]; \ No newline at end of file diff --git a/tests/instances/ok/test22.txt b/tests/instances/ok/test22.txt index 799b34470e014d311b20a4f020943f7abd6534e9..bed96affe1660d5f00b6554472233e44ebc1bcd9 100644 --- a/tests/instances/ok/test22.txt +++ b/tests/instances/ok/test22.txt @@ -1,17 +1,17 @@ -// Test a normal equality node - -#TIMEHORIZON - T = 4; - -#NODE O - - #VARIABLES - external integer : x[T]; - internal : acc[T]; - - #CONSTRAINTS - acc[t]==2; - x[t] == 1; - - #OBJECTIVES +// Test a normal equality node + +#TIMEHORIZON + T = 4; + +#NODE O + + #VARIABLES + external integer : x[T]; + internal : acc[T]; + + #CONSTRAINTS + acc[t]==2; + x[t] == 1; + + #OBJECTIVES min: acc[t]; \ No newline at end of file diff --git a/tests/instances/ok/test23.json b/tests/instances/ok/test23.json index 5d0228b672f74671ef0575e6061e853db2b88e6e..c0834f3a9b8d2f3872938e29607d8bfdd7e5e48b 100644 --- a/tests/instances/ok/test23.json +++ b/tests/instances/ok/test23.json @@ -1,187 +1,187 @@ -{ - "version": "0.0.2", - "model": { - "horizon": 2, - "number_nodes": 1, - "global_parameters": { - "pi": [ - 3.14 - ] - }, - "nodes": { - "A": { - "number_parameters": 2, - "number_variables": 1, - "number_constraints": 1, - "number_expanded_constraints": 2, - "number_objectives": 1, - "number_expanded_objectives": 1, - "parameters": { - "diameter": [ - 12 - ], - "circumference": [ - 37.68 - ] - }, - "variables": [ - "x" - ], - "sub_nodes": { - "PV": { - "number_parameters": 3, - "number_variables": 3, - "number_constraints": 4, - "number_expanded_constraints": 6, - "number_objectives": 1, - "number_expanded_objectives": 1, - "parameters": { - "pi": [ - 3.14 - ], - "irradiance_time_series": [ - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.04, - 0.08, - 0.12, - 0.14, - 0.15, - 0.14, - 0.12, - 0.08, - 0.04, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0 - ], - "max_capacity": [ - 1000 - ] - }, - "variables": [ - "capacity", - "investment", - "electricity" - ] - }, - "B": { - "number_parameters": 1, - "number_variables": 1, - "number_constraints": 1, - "number_expanded_constraints": 4, - "number_objectives": 0, - "number_expanded_objectives": 0, - "parameters": { - "demand": [ - 6.9, - 6.4, - 6.1, - 5.9, - 5.7, - 5.4, - 4.8, - 4.5, - 4.6, - 4.6, - 4.7, - 4.9, - 5.1, - 5.3, - 5.4, - 5.4, - 5.4, - 5.8, - 8.4, - 10.6, - 11.0, - 10.5, - 9.2, - 7.8 - ] - }, - "variables": [ - "consumption" - ] - } - } - } - }, - "hyperedges": {} - }, - "solver": { - "name": "cplex", - "options": { - "lpmethod": 2, - "solutiontype": 2 - }, - "status": 1 - }, - "solution": { - "status": "optimal", - "objective": 496.80000000000007, - "elements": { - "A": { - "variables": { - "x": { - "values": [ - 120.0 - ] - } - }, - "objectives": { - "unnamed": [ - 120.0 - ] - }, - "sub_elements": { - "PV": { - "variables": { - "capacity": { - "values": [ - 120.0 - ] - }, - "investment": { - "values": [ - 376.8 - ] - }, - "electricity": { - "values": [ - 0.0, - 0.0 - ] - } - }, - "objectives": { - "named": { - "hi": 376.8 - } - } - }, - "B": { - "variables": { - "consumption": { - "values": [ - 6.9, - 6.4 - ] - } - } - } - } - } - } - } +{ + "version": "0.0.2", + "model": { + "horizon": 2, + "number_nodes": 1, + "global_parameters": { + "pi": [ + 3.14 + ] + }, + "nodes": { + "A": { + "number_parameters": 2, + "number_variables": 1, + "number_constraints": 1, + "number_expanded_constraints": 2, + "number_objectives": 1, + "number_expanded_objectives": 1, + "parameters": { + "diameter": [ + 12 + ], + "circumference": [ + 37.68 + ] + }, + "variables": [ + "x" + ], + "sub_nodes": { + "PV": { + "number_parameters": 3, + "number_variables": 3, + "number_constraints": 4, + "number_expanded_constraints": 6, + "number_objectives": 1, + "number_expanded_objectives": 1, + "parameters": { + "pi": [ + 3.14 + ], + "irradiance_time_series": [ + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.04, + 0.08, + 0.12, + 0.14, + 0.15, + 0.14, + 0.12, + 0.08, + 0.04, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0 + ], + "max_capacity": [ + 1000 + ] + }, + "variables": [ + "capacity", + "investment", + "electricity" + ] + }, + "B": { + "number_parameters": 1, + "number_variables": 1, + "number_constraints": 1, + "number_expanded_constraints": 4, + "number_objectives": 0, + "number_expanded_objectives": 0, + "parameters": { + "demand": [ + 6.9, + 6.4, + 6.1, + 5.9, + 5.7, + 5.4, + 4.8, + 4.5, + 4.6, + 4.6, + 4.7, + 4.9, + 5.1, + 5.3, + 5.4, + 5.4, + 5.4, + 5.8, + 8.4, + 10.6, + 11.0, + 10.5, + 9.2, + 7.8 + ] + }, + "variables": [ + "consumption" + ] + } + } + } + }, + "hyperedges": {} + }, + "solver": { + "name": "cplex", + "options": { + "lpmethod": 2, + "solutiontype": 2 + }, + "status": 1 + }, + "solution": { + "status": "optimal", + "objective": 496.80000000000007, + "elements": { + "A": { + "variables": { + "x": { + "values": [ + 120.0 + ] + } + }, + "objectives": { + "unnamed": [ + 120.0 + ] + }, + "sub_elements": { + "PV": { + "variables": { + "capacity": { + "values": [ + 120.0 + ] + }, + "investment": { + "values": [ + 376.8 + ] + }, + "electricity": { + "values": [ + 0.0, + 0.0 + ] + } + }, + "objectives": { + "named": { + "hi": 376.8 + } + } + }, + "B": { + "variables": { + "consumption": { + "values": [ + 6.9, + 6.4 + ] + } + } + } + } + } + } + } } \ No newline at end of file diff --git a/tests/instances/ok/test23.txt b/tests/instances/ok/test23.txt index 95975579d09e2d006ec2f57972e777ff871c69ba..1792e86c4c608df6169d76b16bf59153d71379fe 100644 --- a/tests/instances/ok/test23.txt +++ b/tests/instances/ok/test23.txt @@ -1,26 +1,26 @@ -//encapsulating imported nodes with redefinitions - -#TIMEHORIZON T = 2; - -#GLOBAL -pi = 3.14; - -#NODE A - #PARAMETERS - diameter = 12; - circumference = diameter * global.pi; - - #NODE B = import DEMAND from "../examples/microgrid/microgrid.txt" with - consumption internal; - - #NODE PV = import SOLAR_PV from "../examples/microgrid/microgrid.txt" with - capex = global.pi; - - #VARIABLES - internal : x <- PV.capacity; - - #CONSTRAINTS - x == 120; - - #OBJECTIVES +//encapsulating imported nodes with redefinitions + +#TIMEHORIZON T = 2; + +#GLOBAL +pi = 3.14; + +#NODE A + #PARAMETERS + diameter = 12; + circumference = diameter * global.pi; + + #NODE B = import DEMAND from "../examples/microgrid/microgrid.txt" with + consumption internal; + + #NODE PV = import SOLAR_PV from "../examples/microgrid/microgrid.txt" with + capex = global.pi; + + #VARIABLES + internal : x <- PV.capacity; + + #CONSTRAINTS + x == 120; + + #OBJECTIVES min: x; \ No newline at end of file diff --git a/tests/instances/ok/test24.txt b/tests/instances/ok/test24.txt index ec9c0f92961c1fbd20ef44e94f95d9d2057a382d..669f013bbb68e612f03c8d54107bbb39a6e48be3 100644 --- a/tests/instances/ok/test24.txt +++ b/tests/instances/ok/test24.txt @@ -1,19 +1,19 @@ - -#TIMEHORIZON T = 2; - -#GLOBAL -pi = 9; - - -#NODE B -#VARIABLES -external integer : b; -#CONSTRAINTS -b >= global.pi; - -#NODE A = import A from "test23.txt" with -x external; - -#HYPEREDGE H -#CONSTRAINTS + +#TIMEHORIZON T = 2; + +#GLOBAL +pi = 9; + + +#NODE B +#VARIABLES +external integer : b; +#CONSTRAINTS +b >= global.pi; + +#NODE A = import A from "test23.txt" with +x external; + +#HYPEREDGE H +#CONSTRAINTS A.x <= B.b+2; \ No newline at end of file diff --git a/tests/instances/ok/test26.txt b/tests/instances/ok/test26.txt index 8e8f36718545fc8ab971e2a6096b5d6b5ae2dc42..cf607a856b9b29feba35b4dd7fc258c6823d12cd 100644 --- a/tests/instances/ok/test26.txt +++ b/tests/instances/ok/test26.txt @@ -1,29 +1,29 @@ - -#TIMEHORIZON T = 1; - -#NODE A - #PARAMETERS - a = 1; - #NODE B - #PARAMETERS - b = 2; - #NODE C - #PARAMETERS - c = 3; - #NODE D - #PARAMETERS - d = 4; - #VARIABLES - internal : x; - #CONSTRAINTS - x >= A.a; - #VARIABLES - internal : x <- D.x; - #CONSTRAINTS - x <= B.b+A.a+c; - #VARIABLES - internal : x <- C.x; - #VARIABLES - internal : x <- B.x; - #OBJECTIVES + +#TIMEHORIZON T = 1; + +#NODE A + #PARAMETERS + a = 1; + #NODE B + #PARAMETERS + b = 2; + #NODE C + #PARAMETERS + c = 3; + #NODE D + #PARAMETERS + d = 4; + #VARIABLES + internal : x; + #CONSTRAINTS + x >= A.a; + #VARIABLES + internal : x <- D.x; + #CONSTRAINTS + x <= B.b+A.a+c; + #VARIABLES + internal : x <- C.x; + #VARIABLES + internal : x <- B.x; + #OBJECTIVES min : x + a; \ No newline at end of file diff --git a/tests/instances/ok/test27.txt b/tests/instances/ok/test27.txt index d4d4ba38af414cd35d4c4a61f55a23ae36f791ce..0a4d5169f76d8f17dba724826aa92661c606fae8 100644 --- a/tests/instances/ok/test27.txt +++ b/tests/instances/ok/test27.txt @@ -1,29 +1,29 @@ - -#TIMEHORIZON T = 5; - -#NODE A - #PARAMETERS - param = 1; - #NODE B - #PARAMETERS - param = 2; - #NODE C - #PARAMETERS - param = 3; - #NODE D - #PARAMETERS - param = 4; - #VARIABLES - internal : x[T]; - #CONSTRAINTS - x[t] >= A.param; - #VARIABLES - internal : x[T] <- D.x[5]; - #CONSTRAINTS - x[t] <= B.param+A.param+param; - #VARIABLES - internal : x[T] <- C.x[5]; - #VARIABLES - internal : x[T] <- B.x[5]; - #OBJECTIVES + +#TIMEHORIZON T = 5; + +#NODE A + #PARAMETERS + param = 1; + #NODE B + #PARAMETERS + param = 2; + #NODE C + #PARAMETERS + param = 3; + #NODE D + #PARAMETERS + param = 4; + #VARIABLES + internal : x[T]; + #CONSTRAINTS + x[t] >= A.param; + #VARIABLES + internal : x[T] <- D.x[5]; + #CONSTRAINTS + x[t] <= B.param+A.param+param; + #VARIABLES + internal : x[T] <- C.x[5]; + #VARIABLES + internal : x[T] <- B.x[5]; + #OBJECTIVES min : x[t] ; \ No newline at end of file diff --git a/tests/instances/ok/test28.txt b/tests/instances/ok/test28.txt index 04b96656fde4cc71ed182cac9d5375d1749b5d6a..de69b1c6019f60c9f738a0eeae71d5d601cd5ddd 100644 --- a/tests/instances/ok/test28.txt +++ b/tests/instances/ok/test28.txt @@ -1,46 +1,46 @@ - -#TIMEHORIZON T = 2; - -#NODE A - #PARAMETERS - param = 1; - #NODE B - #PARAMETERS - param = 2; - #NODE C - #PARAMETERS - param = 3; - #NODE D - #PARAMETERS - param = 4; - #VARIABLES - external : x[T]; - #CONSTRAINTS - x[t] >= A.param; - - #NODE E - #PARAMETERS - param = 5.5; - #VARIABLES - external integer : y[T]; - #CONSTRAINTS - y[t] >= param; - #OBJECTIVES - min: y[t]; - - #HYPEREDGE H - #PARAMETERS - param = A.param; - #CONSTRAINTS - E.y[t]+D.x[t] == param+9; - - #VARIABLES - internal : x[T] <- D.x[T]; - #CONSTRAINTS - x[t] <= B.param+A.param+param; - #VARIABLES - internal : x[T] <- C.x[T]; - #VARIABLES - internal : x[T] <- B.x[T]; - #OBJECTIVES + +#TIMEHORIZON T = 2; + +#NODE A + #PARAMETERS + param = 1; + #NODE B + #PARAMETERS + param = 2; + #NODE C + #PARAMETERS + param = 3; + #NODE D + #PARAMETERS + param = 4; + #VARIABLES + external : x[T]; + #CONSTRAINTS + x[t] >= A.param; + + #NODE E + #PARAMETERS + param = 5.5; + #VARIABLES + external integer : y[T]; + #CONSTRAINTS + y[t] >= param; + #OBJECTIVES + min: y[t]; + + #HYPEREDGE H + #PARAMETERS + param = A.param; + #CONSTRAINTS + E.y[t]+D.x[t] == param+9; + + #VARIABLES + internal : x[T] <- D.x[T]; + #CONSTRAINTS + x[t] <= B.param+A.param+param; + #VARIABLES + internal : x[T] <- C.x[T]; + #VARIABLES + internal : x[T] <- B.x[T]; + #OBJECTIVES min : x[t] ; \ No newline at end of file diff --git a/tests/instances/ok/test4.txt b/tests/instances/ok/test4.txt index 8c6524cc0da4a3c486c757a832216bfe3fcf6cce..e150a6a3a7778cd9a3938fd2d5941778620d9cf4 100644 --- a/tests/instances/ok/test4.txt +++ b/tests/instances/ok/test4.txt @@ -1,11 +1,11 @@ -// Error in variable declared as scalar - -#TIMEHORIZON T = 10; - -#NODE H -#VARIABLES -internal : x; -#CONSTRAINTS -0*x[0]==10; -#OBJECTIVES +// Error in variable declared as scalar + +#TIMEHORIZON T = 10; + +#NODE H +#VARIABLES +internal : x; +#CONSTRAINTS +0*x[0]==10; +#OBJECTIVES min : x[0]; \ No newline at end of file diff --git a/tests/instances/ok/test5.txt b/tests/instances/ok/test5.txt index bd67b67b4d06ef4796d06cda4dbcaf344a345df4..e0f3b11843ed26385eaf261f4299caaaeb6a7276 100644 --- a/tests/instances/ok/test5.txt +++ b/tests/instances/ok/test5.txt @@ -1,13 +1,13 @@ -// working example of a minimization of un-constrainted variable -// No solution - -#TIMEHORIZON T = 10; - -#NODE H -#VARIABLES -internal : y[T]; -internal : x[T]; -#CONSTRAINTS -x[t]==0; -#OBJECTIVES +// working example of a minimization of un-constrainted variable +// No solution + +#TIMEHORIZON T = 10; + +#NODE H +#VARIABLES +internal : y[T]; +internal : x[T]; +#CONSTRAINTS +x[t]==0; +#OBJECTIVES min : y[t]; \ No newline at end of file diff --git a/tests/instances/ok/test6.json b/tests/instances/ok/test6.json index 876f798a84346dab2dd69814cb6dadbb71dbdb06..fa8ddfc82e2fe2afbe4edb573fe7d60ee94ab461 100644 --- a/tests/instances/ok/test6.json +++ b/tests/instances/ok/test6.json @@ -1,60 +1,60 @@ -{ - "version": "0.0.4", - "model": { - "horizon": 10, - "number_nodes": 1, - "global_parameters": {}, - "nodes": { - "H": { - "number_parameters": 1, - "number_variables": 1, - "number_constraints": 1, - "number_expanded_constraints": 10, - "number_objectives": 1, - "number_expanded_objectives": 10, - "parameters": { - "b": [ - 4 - ] - }, - "variables": [ - "x" - ] - } - }, - "hyperedges": {} - }, - "solver": { - "name": "linprog", - "status": true - }, - "solution": { - "status": "optimal", - "objective": 40.0, - "elements": { - "H": { - "variables": { - "x": { - "values": [ - 4.0, - 4.0, - 4.0, - 4.0, - 4.0, - 4.0, - 4.0, - 4.0, - 4.0, - 4.0 - ] - } - }, - "objectives": { - "unnamed": [ - 40.0 - ] - } - } - } - } +{ + "version": "0.0.4", + "model": { + "horizon": 10, + "number_nodes": 1, + "global_parameters": {}, + "nodes": { + "H": { + "number_parameters": 1, + "number_variables": 1, + "number_constraints": 1, + "number_expanded_constraints": 10, + "number_objectives": 1, + "number_expanded_objectives": 10, + "parameters": { + "b": [ + 4 + ] + }, + "variables": [ + "x" + ] + } + }, + "hyperedges": {} + }, + "solver": { + "name": "linprog", + "status": true + }, + "solution": { + "status": "optimal", + "objective": 40.0, + "elements": { + "H": { + "variables": { + "x": { + "values": [ + 4.0, + 4.0, + 4.0, + 4.0, + 4.0, + 4.0, + 4.0, + 4.0, + 4.0, + 4.0 + ] + } + }, + "objectives": { + "unnamed": [ + 40.0 + ] + } + } + } + } } \ No newline at end of file diff --git a/tests/instances/ok/test6.txt b/tests/instances/ok/test6.txt index 4841586fa92ab54b7f7c96acb3fbd4d1dc02f92f..4f3610a64f0453c2601dcbfa7a1c130de592c397 100644 --- a/tests/instances/ok/test6.txt +++ b/tests/instances/ok/test6.txt @@ -1,13 +1,13 @@ -// working example where x[t] = b for every t in T - -#TIMEHORIZON T = 10; - -#NODE H -#PARAMETERS -b = 4; -#VARIABLES -internal : x[T]; -#CONSTRAINTS -x[t]>=b; -#OBJECTIVES +// working example where x[t] = b for every t in T + +#TIMEHORIZON T = 10; + +#NODE H +#PARAMETERS +b = 4; +#VARIABLES +internal : x[T]; +#CONSTRAINTS +x[t]>=b; +#OBJECTIVES min : x[t]; \ No newline at end of file diff --git a/tests/instances/ok/test7.json b/tests/instances/ok/test7.json index 388ba190b645dd964d8567a7103981efa975d0cc..433de4f3c4473158a38fbf6273542cc26c66ba3f 100644 --- a/tests/instances/ok/test7.json +++ b/tests/instances/ok/test7.json @@ -1,47 +1,47 @@ -{ - "version": "0.0.4", - "model": { - "horizon": 1, - "number_nodes": 1, - "global_parameters": {}, - "nodes": { - "H": { - "number_parameters": 0, - "number_variables": 1, - "number_constraints": 1, - "number_expanded_constraints": 1, - "number_objectives": 1, - "number_expanded_objectives": 1, - "parameters": {}, - "variables": [ - "x" - ] - } - }, - "hyperedges": {} - }, - "solver": { - "name": "linprog", - "status": true - }, - "solution": { - "status": "optimal", - "objective": 4.0, - "elements": { - "H": { - "variables": { - "x": { - "values": [ - -4.0 - ] - } - }, - "objectives": { - "unnamed": [ - -4.0 - ] - } - } - } - } +{ + "version": "0.0.4", + "model": { + "horizon": 1, + "number_nodes": 1, + "global_parameters": {}, + "nodes": { + "H": { + "number_parameters": 0, + "number_variables": 1, + "number_constraints": 1, + "number_expanded_constraints": 1, + "number_objectives": 1, + "number_expanded_objectives": 1, + "parameters": {}, + "variables": [ + "x" + ] + } + }, + "hyperedges": {} + }, + "solver": { + "name": "linprog", + "status": true + }, + "solution": { + "status": "optimal", + "objective": 4.0, + "elements": { + "H": { + "variables": { + "x": { + "values": [ + -4.0 + ] + } + }, + "objectives": { + "unnamed": [ + -4.0 + ] + } + } + } + } } \ No newline at end of file diff --git a/tests/instances/ok/test7.txt b/tests/instances/ok/test7.txt index 9fb0c5576ee6a0b0e35780f9368bcba497fdf04e..87fc0d6a501fbbeb817eb6df9fa21bd8d0ad6759 100644 --- a/tests/instances/ok/test7.txt +++ b/tests/instances/ok/test7.txt @@ -1,11 +1,11 @@ -// Working example where x = -4 - -#TIMEHORIZON T = 1; - -#NODE H -#VARIABLES -internal : x; -#CONSTRAINTS -x<=-4; -#OBJECTIVES +// Working example where x = -4 + +#TIMEHORIZON T = 1; + +#NODE H +#VARIABLES +internal : x; +#CONSTRAINTS +x<=-4; +#OBJECTIVES max : x; \ No newline at end of file diff --git a/tests/instances/ok/test8.txt b/tests/instances/ok/test8.txt index a5725b8c82afe9dd699fd5513ece375646684f64..2cdbb0197fc9b5095dc3c64b3293f54ad3b68d20 100644 --- a/tests/instances/ok/test8.txt +++ b/tests/instances/ok/test8.txt @@ -1,11 +1,11 @@ -// Non linearity error - -#TIMEHORIZON T = 2; - -#NODE A -#VARIABLES -internal : x ; -#CONSTRAINTS -x*x==10; -#OBJECTIVES +// Non linearity error + +#TIMEHORIZON T = 2; + +#NODE A +#VARIABLES +internal : x ; +#CONSTRAINTS +x*x==10; +#OBJECTIVES min: x; \ No newline at end of file diff --git a/tests/instances/ok/test9.txt b/tests/instances/ok/test9.txt index a57a68f8ae68b69c16e8115e9d3ad1ffaaed703f..5463baa974b70d060a30de3ffd7ec4b2887fe0e7 100644 --- a/tests/instances/ok/test9.txt +++ b/tests/instances/ok/test9.txt @@ -1,13 +1,13 @@ -// import a file as parameter that does not exist - -#TIMEHORIZON T = 10; - -#NODE B -#PARAMETERS -d = import "inexistant.txt"; -#VARIABLES -internal : a; -#CONSTRAINTS -a >=10; -#OBJECTIVES +// import a file as parameter that does not exist + +#TIMEHORIZON T = 10; + +#NODE B +#PARAMETERS +d = import "inexistant.txt"; +#VARIABLES +internal : a; +#CONSTRAINTS +a >=10; +#OBJECTIVES min: a; \ No newline at end of file diff --git a/tests/test_import.py b/tests/test_import.py new file mode 100644 index 0000000000000000000000000000000000000000..267b7f4286bbdd00903a8246856374eb962112dd --- /dev/null +++ b/tests/test_import.py @@ -0,0 +1,63 @@ +import unittest +from pathlib import Path + +from gboml.ast.check import check +from gboml.parsing import parse_file, parse +from gboml.resolve_imports import resolve_imports + + +class TestImport(unittest.TestCase): + def test_import_nogen(self): + tree = parse( + """ + #TIMEHORIZON + T = 8760; + #NODE A extends B from "instances/imports/b_nogen.gboml"; + """ + ) + print(resolve_imports(tree, Path('.'))) + + def test_import_nogen_2(self): + tree = parse( + """ + #TIMEHORIZON + T = 8760; + #NODE A extends B from "instances/imports/b_nogen.gboml" + #PARAMETERS + i = 2; + #VARIABLES + pass; + """ + ) + print(resolve_imports(tree, Path('.'))) + + def test_import_gen_1(self): + tree = parse( + """ + #TIMEHORIZON + T = 8760; + #NODE A extends B[2] from "instances/imports/b_gen.gboml" + #PARAMETERS + j = 2; + #VARIABLES + pass; + """ + ) + print(resolve_imports(tree, Path('.'))) + + def test_import_gen_2(self): + tree = parse( + """ + #TIMEHORIZON + T = 8760; + #NODE A extends B[2] from "instances/imports/b_gen.gboml" + #PARAMETERS + i = 2; //this should fail, as i is an index of B + #VARIABLES + pass; + """ + ) + print(resolve_imports(tree, Path('.'))) + +if __name__ == '__main__': + unittest.main()