Skip to content

Commit

Permalink
initial version
Browse files Browse the repository at this point in the history
  • Loading branch information
jifwin committed Jan 1, 2017
1 parent 70aeef4 commit 017a2ab
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 0 deletions.
42 changes: 42 additions & 0 deletions zad1konspekt10/zad1konspekt10.dat
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*********************************************
* OPL 12.6.3.0 Data
* Author: grzegorz
* 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
];

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>
];


34 changes: 34 additions & 0 deletions zad1konspekt10/zad1konspekt10.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*********************************************
* OPL 12.6.3.0 Model
* Author: grzegorz
* Creation Date: 01-01-2017 at 11:01:46
*********************************************/

tuple device {
int number_of_clients;
int cost;
}

{int} S = ...;
{int} J = ...;
{int} Js[S] = ...;
{int} T = ...;
{int} Tj[J] = ...;

device devices[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;

minimize
sum(j in J) sum(t in Tj[j]) devices[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;
}
3 changes: 3 additions & 0 deletions zad1konspekt10/zad1konspekt10.ops
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>

<settings version="2"/>

0 comments on commit 017a2ab

Please sign in to comment.