Commit f1de3772 by Gianluca Frison

### added solution to ex09

parent 704bcf8d
 reset; param n := 5; # number of variables set I = {1..5}; param a{I}; param b{I}; param c{I}; param d{I}; param l{I}; param u{I}; var x{i in I} >= l[i], <= u[i]; minimize f: sum{i in I} x[i]/(a[i]+b[i]*x[i]+c[i]*x[i]^2+d[i]*x[i]^3); s.t. budget: sum{i in I} x[i] = 350; data; param: l u a b c d := 1 10 60 56.49 1.67 -0.041 0.00030 2 10 60 71.37 0.61 -0.016 0.00011 3 15 120 23.88 2.05 -0.024 0.00009 4 12.5 112.5 17.14 2.73 -0.035 0.00014 5 15 135 72.38 0.34 -0.003 0.00001; option solver knitro; option knitro_options "ms_enable=1"; #option solver couenne; solve; display f; print{i in 1..n} x[i];
 reset; param n := 5; # number of variables set I = {1..5}; param a{I}; param b{I}; param c{I}; param d{I}; param l{I}; param u{I}; var y{I} binary; var x{i in I}; minimize f: sum{i in I} x[i]/(a[i]+b[i]*x[i]+c[i]*x[i]^2+d[i]*x[i]^3); s.t. budget: sum{i in I} x[i] = 350; s.t. low{i in I}: x[i] >= l[i] * y[i]; s.t. high{i in I}: x[i] <= u[i] * y[i]; data; param: l u a b c d := 1 10 60 56.49 1.67 -0.041 0.00030 2 10 60 71.37 0.61 -0.016 0.00011 3 15 120 23.88 2.05 -0.024 0.00009 4 12.5 112.5 17.14 2.73 -0.035 0.00014 5 15 135 72.38 0.34 -0.003 0.00001; #option solver knitro; #option knitro_options "ms_enable=1"; option solver couenne; solve; display f; print{i in 1..n} x[i]; print{i in 1..n} y[i];
 reset; param n := 5; # number of variables set I = {1..5}; param a{I}; param b{I}; param c{I}; param d{I}; param l{I}; param u{I}; var x{i in I} >= l[i], <= u[i]; var y{I} binary; minimize f: sum{i in I} y[i]*x[i]/(a[i]+b[i]*x[i]+c[i]*x[i]^2+d[i]*x[i]^3); s.t. budget: sum{i in I} y[i]*x[i] = 350; data; param: l u a b c d := 1 10 60 56.49 1.67 -0.041 0.00030 2 10 60 71.37 0.61 -0.016 0.00011 3 15 120 23.88 2.05 -0.024 0.00009 4 12.5 112.5 17.14 2.73 -0.035 0.00014 5 15 135 72.38 0.34 -0.003 0.00001; option solver knitro; option knitro_options "ms_enable=1"; #option solver couenne; solve; display f; print{i in 1..n} x[i]; print{i in 1..n} y[i];
 reset; var x integer, >= -2.5; var y integer, >= -2.5; minimize obj: x^2 - y^2; s.t. c: x^2 + y^2 <= 1; option solver cplex; solve;
 reset; var x integer, >= -2.5; var y integer, >= -2.5; minimize obj: x^2 - y^2; s.t. c: x^2 + y^2 <= 1; option solver cplex; option cplex_options "reqconvex=2"; solve;
 reset; var x integer, >= -2.5; var y integer, >= -2.5; minimize obj: x^2 - y^2; s.t. c: x + y <= 1; option solver cplex; option cplex_options "reqconvex=2"; solve; display obj, x, y;
 reset; var x integer, >= -2.5; var y integer, >= -2.5; minimize obj: x^2 - y^2; s.t. c: x + y <= 1; option solver cplex; option cplex_options "reqconvex=3"; solve; display obj, x, y;
 reset; var x integer, >= -2.5; var y integer, >= -2.5; minimize obj: x^2 - y^2; s.t. c: x + y <= 1; option solver gurobi; option gurobi_options "outlev=1"; solve; display obj, x, y;
 reset; var x integer, >= -2.5; var y integer, >= -2.5; minimize obj: x^2 - y^2; s.t. c: x + y <= 1; option solver xpress; solve; display obj, x, y;;
 reset; var x integer, >= -2.5; var y integer, >= -2.5; minimize obj: x^2 - y^2; s.t. c: x + y <= 1; option solver scip; solve; display obj,x,y;
 reset; var x integer, >= -2.5; var y integer, >= -2.5; minimize obj: x^2 - y^2; s.t. c: x^2 + y^2 <= 1; option solver scip; solve; display obj, x, y;
 reset; var x integer, >= -2.5; var y integer, >= -2.5; minimize obj: x^2 - y^2; s.t. c1: x^2 + y^2 >= 1; s.t. c2: x^2 + y^2 <= 3; option solver scip; solve; display obj, x, y;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment