diff --git a/zad1konspekt10/zad1konspekt10.dat b/zad1konspekt10/zad1konspekt10.dat index 287f1ca..7384851 100644 --- a/zad1konspekt10/zad1konspekt10.dat +++ b/zad1konspekt10/zad1konspekt10.dat @@ -4,39 +4,31 @@ * Creation Date: 01-01-2017 at 11:01:46 *********************************************/ -//clients S = {1,2,3,4,5,6,7,8,9,10}; J = {1,2,3,4,5}; + Js = [ - {1} //1 - {1,2} //2 - {1,2,3} //3 - {2,3} //4 - {2,3,4} //5 - {3,4} //6 - {3,4,5} //7 - {4,5} //8 - {4,5} //9 - {5} //10 + [1 0 0 0 0] //1 + [1 1 0 0 0] //2 + [0 1 0 0 0] //3 + [0 1 1 0 0] //4 + [0 0 1 0 0] //5 + [0 0 1 1 0] //6 + [0 0 1 1 0] //7 + [0 0 1 1 1] //8 + [0 0 0 1 1] //9 + [0 0 0 0 1] //10 ]; + T = {1,2,3}; Tj = [ - {1,2,3}//1 - {1,2,3}//2 - {1,2,3}//3 - {1,2,3}//4 - {1,2,3}//5 -]; - -devices = -[ -<10,5> //, -<15,7>, -<20,10> -]; - - + [<10,5>, <15,7>, <20,10>] + [<10,5>, <15,7>, <20,10>] + [<10,5>, <15,7>, <20,10>] + [<10,5>, <15,7>, <20,10>] + [<10,5>, <15,7>, <20,10>] +]; \ No newline at end of file diff --git a/zad1konspekt10/zad1konspekt10.mod b/zad1konspekt10/zad1konspekt10.mod index a15f222..f33a74c 100644 --- a/zad1konspekt10/zad1konspekt10.mod +++ b/zad1konspekt10/zad1konspekt10.mod @@ -11,24 +11,22 @@ tuple device { {int} S = ...; {int} J = ...; -{int} Js[S] = ...; +int Js[S][J] = ...; {int} T = ...; -{int} Tj[J] = ...; -device devices[T] = ...; +device Tj[J][T] = ...; dvar int x[S][J] in 0..1; -dvar int y[J][T]; //todo: should be plus? -//dvar int y[J][T] in 0..1; +dvar int+ y[J][T]; //todo: should be plus? minimize - sum(j in J) sum(t in Tj[j]) devices[t].cost * y[j][t]; + sum(j in J) sum(t in T) Tj[j][t].cost * y[j][t]; subject to { - forall (s in S) sum(j in J) x[s][j] == 1; -// forall (j in J) sum (s in S: j in Js[s]) x[s][j] <= sum(t in Tj[j]) devices[t].number_of_clients*y[j][t]; - forall (j in J) sum (s in S: j in Js[s]) x[s][j] <= sum(t in Tj[j]) devices[t].number_of_clients*y[j][t]; - forall (j in J) sum(t in Tj[j]) y[j][t] <= 1; + forall (s in S) sum(j in J) Js[s][j]*x[s][j] == 1; //todo: if condition + //forall (j in J) sum (s in S) (Js[s][j]*x[s][j]) <= sum(t in T) (Tj[j][t].number_of_clients * y[j][t]); + forall (j in J) sum (s in S) (Js[s][j]*x[s][j]) <= sum(t in T) (Tj[j][t].number_of_clients * y[j][t]); + forall (j in J) sum(t in T) y[j][t] <= 1; } \ No newline at end of file