Skip to content
Snippets Groups Projects
Commit 312aa405 authored by Derval Guillaume's avatar Derval Guillaume
Browse files

Add some tests

parent 6f8f3032
No related branches found
No related tags found
No related merge requests found
Showing
with 1438 additions and 1407 deletions
#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
#TIMEHORIZON T = 1;
#NODE B
#PARAMETERS
a <- 12;
#VARIABLES
internal : x;
#CONSTRAINTS
x <= -4;
#OBJECTIVES
max : x;
\ No newline at end of file
#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
// 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
......@@ -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
// Only timehorizon defined nothing else
// Only timehorizon defined nothing else
#TIMEHORIZON T=10;
\ No newline at end of file
// 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
// 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
{
"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
// 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
// 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
//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
{
"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
//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;
// 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
// 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];
// 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
This diff is collapsed.
// 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
// 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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment