From 312aa4057ba0def2699bde2c1b1f22d75eee2ad4 Mon Sep 17 00:00:00 2001 From: Derval Guillaume <gderval@uliege.be> Date: Fri, 28 Apr 2023 17:21:36 +0200 Subject: [PATCH] Add some tests --- tests/instances/imports/b_gen.gboml | 11 + tests/instances/imports/b_nogen.gboml | 11 + tests/instances/ko_parsing/test25.txt | 46 +- tests/instances/ko_parsing/test3.txt | 20 +- tests/instances/ok/complex_parsing.txt | 19 +- tests/instances/ok/test1.txt | 4 +- tests/instances/ok/test10.txt | 22 +- tests/instances/ok/test11.txt | 22 +- tests/instances/ok/test12.json | 112 +- tests/instances/ok/test12.txt | 22 +- tests/instances/ok/test13.txt | 22 +- tests/instances/ok/test14.txt | 22 +- tests/instances/ok/test15.json | 236 +-- tests/instances/ok/test15.txt | 62 +- tests/instances/ok/test16.txt | 32 +- tests/instances/ok/test17.txt | 22 +- tests/instances/ok/test18.txt | 24 +- tests/instances/ok/test19.json | 2092 ++++++++++++------------ tests/instances/ok/test19.txt | 24 +- tests/instances/ok/test2.txt | 20 +- tests/instances/ok/test20.json | 234 +-- tests/instances/ok/test20.txt | 40 +- tests/instances/ok/test21.json | 198 +-- tests/instances/ok/test21.txt | 62 +- tests/instances/ok/test22.txt | 32 +- tests/instances/ok/test23.json | 372 ++--- tests/instances/ok/test23.txt | 50 +- tests/instances/ok/test24.txt | 36 +- tests/instances/ok/test26.txt | 56 +- tests/instances/ok/test27.txt | 56 +- tests/instances/ok/test28.txt | 90 +- tests/instances/ok/test4.txt | 20 +- tests/instances/ok/test5.txt | 24 +- tests/instances/ok/test6.json | 118 +- tests/instances/ok/test6.txt | 24 +- tests/instances/ok/test7.json | 92 +- tests/instances/ok/test7.txt | 20 +- tests/instances/ok/test8.txt | 20 +- tests/instances/ok/test9.txt | 24 +- tests/test_import.py | 63 + 40 files changed, 2285 insertions(+), 2191 deletions(-) create mode 100644 tests/instances/imports/b_gen.gboml create mode 100644 tests/instances/imports/b_nogen.gboml create mode 100644 tests/test_import.py diff --git a/tests/instances/imports/b_gen.gboml b/tests/instances/imports/b_gen.gboml new file mode 100644 index 0000000..7d506d3 --- /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 0000000..7bd19c1 --- /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 9cfbab3..b53e0d9 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 d3c1621..5acaa9d 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 a4e0269..1e4a503 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 60620fe..4208244 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 a47542d..5ce5c6b 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 7d9cc5c..24182de 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 c02cb8a..d34b98b 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 d7a5a01..e65ac25 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 e2a0a7d..3b8b11b 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 71a3b5e..9bdb921 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 67c27c0..a493699 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 40757ca..05c86bc 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 849f6be..fc30e47 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 455c621..497c92e 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 570427b..9a16652 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 3800d36..299be9b 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 8e3fe62..e566792 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 9708288..1be8bdf 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 0eb4e4b..368cbdc 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 e2ec9fd..e7c9c91 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 1baaca6..73735cb 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 136e3c0..8a4f53b 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 799b344..bed96af 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 5d0228b..c0834f3 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 9597557..1792e86 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 ec9c0f9..669f013 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 8e8f367..cf607a8 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 d4d4ba3..0a4d516 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 04b9665..de69b1c 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 8c6524c..e150a6a 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 bd67b67..e0f3b11 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 876f798..fa8ddfc 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 4841586..4f3610a 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 388ba19..433de4f 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 9fb0c55..87fc0d6 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 a5725b8..2cdbb01 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 a57a68f..5463baa 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 0000000..267b7f4 --- /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() -- GitLab