Created
April 12, 2014 15:55
-
-
Save cavedave/10542688 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Fair Division Program | |
This is a program for dividing up items between people people. | |
So the minimum satisfaction of any of them is maximised. */ | |
param people, integer,> 0; | |
/* number of people dividing stuff */ | |
param divi, integer, >= 0; | |
param indiv, integer, >= 0; | |
/* number of items to be divided. divi divisible. indiv non divisible */ | |
set I:= 1..people; | |
/* set of people */ | |
set J := 1..indiv; | |
/* set of nondivisible items */ | |
set K := 1..divi; | |
/* set of divisible items */ | |
param indivItems{i in I, j in J}, >= 0; | |
/*indivisible amount recieved if item j is given to agent i */ | |
param divItems{i in I, k in K}, >= 0; | |
/*divisible amount recieved if item k is given to agent i */ | |
var worst; | |
/*how is the worst person doing?*/ | |
var x{i in I, k in K},>=0; | |
var y{i in I, j in J}, binary; | |
/* | |
here ,>=0; means that the items are divisible. | |
here , binary; means that items are not divisable. | |
x[i,j] = 1 means item j is assigned to agent i */ | |
s.t. one{k in K}: sum{i in I} x[i,k] = 1; | |
s.t. two{j in J}: sum{i in I} y[i,j] = 1; | |
/* job j must be assigned exactly to one agent */ | |
/*s.t. lim{i in I}: ((sum{j in J} c[i,j] * x[i,j])+(sum{k in K} d[i,k] * y[i,k]) )<= b[i];*/ | |
/*add check person does not get more then 100%. Want to make sure they do not ask for more then 100% */ | |
s.t. wor{i in I}: ((sum{k in K} divItems[1,k] * x[1,k])+(sum{j in J} indivItems[1,j] * y[1,j])) >= worst; | |
s.t. wor2{i in I}: ((sum{k in K} divItems[2,k] * x[2,k])+(sum{j in J} indivItems[2,j] * y[2,j])) >= worst; | |
/*Add wo3 3 for 3rd person etc | |
s.t. wor3{i in I}: ((sum{k in K} divItems[3,k] * x[3,k])+(sum{j in J} indivItems[3,j] * y[3,j])) >= worst;*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment