Skip to content

Commit

Permalink
fixed version
Browse files Browse the repository at this point in the history
  • Loading branch information
jifwin committed Jan 1, 2017
1 parent 017a2ab commit 49c4121
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 36 deletions.
44 changes: 18 additions & 26 deletions zad1konspekt10/zad1konspekt10.dat
Original file line number Diff line number Diff line change
Expand Up @@ -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> //<clients,cost>,
<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>]
];
18 changes: 8 additions & 10 deletions zad1konspekt10/zad1konspekt10.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

0 comments on commit 49c4121

Please sign in to comment.