# Fair & Square

## Fair Division Tool

Begin
## How it works

The Fair and Square division tool is allows couples to discover who should get what in the event that they breakup.

First it takes in the peoples names

Second it takes in the items to be divided up.

Then it takes in how much they want each item from each person. Each person has 100 total points they can use to rate each item.

Finally it calculates an allocation of items that mean each person gets as much as possible

www.fairandsquare.ie
/* 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;
maximize obj: worst;