reset; #option solver cplex; #option solver './minos'; # fuer macOS option randseed''; #option display_precision 5; option solution_round 9; param N := 10; # Number of projects/workers param w {i in 1..N,j in 1..N} := 2^round(Uniform(1,10)); # willingness of worker j to take project i ########### Linear integer var x {i in 1..N,j in 1..N} binary; # whether worker j takes project i maximize LP1: sum{i in 1..N,j in 1..N} w[i,j]*x[i,j]; subject to NBa1{j in 1..N}: sum{i in 1..N} x[i,j] = 1; # each project has to be taken subject to NBb1{i in 1..N}: sum{j in 1..N} x[i,j] = 1; # each worker has to take one project option solver cplex; solve; display LP1; display x; #end; ############ Linear continuous (relaxation) drop NBa1; drop NBb1; var x2 {i in 1..N,j in 1..N} >=0, <=1; # whether worker j takes project i maximize LP2: sum{i in 1..N,j in 1..N} w[i,j]*x2[i,j]; subject to NBa2{j in 1..N}: sum{i in 1..N} x2[i,j] = 1; # each project has to be taken subject to NBb2{i in 1..N}: sum{j in 1..N} x2[i,j] = 1; # each worker has to take one project objective LP2; option solver minos; solve; display LP2; display x2; #end; ############ Nonlinear continuous (relaxation) drop NBa2; drop NBb2; var x3 {i in 1..N,j in 1..N} >=0, <=1; # whether worker j takes project i var LP3_= sum{i in 1..N,j in 1..N} w[i,j]*x3[i,j]; maximize LP3: sum{j in 1..N} (sum{i in 1..N} w[i,j]*x3[i,j])^0.15; subject to NBa3{j in 1..N}: sum{i in 1..N} x3[i,j] = 1; # each project has to be taken subject to NBb3{i in 1..N}: sum{j in 1..N} x3[i,j] = 1; # each worker has to take one project objective LP3; option solver minos; solve; display LP3,LP3_; display x3; #end; ########### Nonlinear integer drop NBa3; drop NBb3; var x4 {i in 1..N,j in 1..N} binary; # whether worker j takes project i var LP4_= sum{i in 1..N,j in 1..N} w[i,j]*x4[i,j]; maximize LP4: sum{j in 1..N} (sum{i in 1..N} w[i,j]*x4[i,j])^0.15; subject to NBa4{j in 1..N}: sum{i in 1..N} x4[i,j] = 1; # each project has to be taken subject to NBb4{i in 1..N}: sum{j in 1..N} x4[i,j] = 1; # each worker has to take one project objective LP4; option solver baron; solve; display LP4,LP4_; display x4;