Commit 63e5cb50 by Gianluca Frison

### added solition to ex08

parent fcb7ecbf
 reset; param n; var x{i in 1..n, j in 1..n} binary := 0; param a{1..n,1..n}; param b{1..n,1..n}; minimize obj: sum{i in 1..n, k in 1..n, l in 1..n, m in 1..n} a[i,k]*x[k,l]*b[l,m]*x[i,m]; s.t. c0{i in 1..n}: sum{j in 1..n} x[i,j] = 1; s.t. c1{i in 1..n}: sum{j in 1..n} x[j,i] = 1; data qap10.dat; option solver cplex; option cplex_options "mipdisplay=2"; #option solver gurobi; #option gurobi_options "outlev=1"; #option solver mosek; #option gurobi_options "outlev=2"; #option solver scip; #option solver xpress; #option xpress_options "outlev=0"; #option solver bonmin; #option solver couenne; solve; display x; var y{i in 1..n, j in 1..n} = sum{k in 1..n, l in 1..n} x[i,k]*b[k,l]*x[j,l]; display y;
 reset; param n; set I := 1..n; var x{I,I} binary; var y{I,I,I,I} binary; param a{I,I}; param b{I,I}; minimize obj: sum{i in I, k in I, l in I, m in I} a[i,k]*b[l,m]*y[k,l,i,m]; s.t. c0{i in I}: sum{j in I} x[i,j] = 1; s.t. c1{i in I}: sum{j in I} x[j,i] = 1; s.t. c2{k in I, l in I, i in I, m in I}: y[k,l,i,m] = x[k,l]*x[i,m];
 reset; param n; set I = 1..n; var t; var x{i in I, j in I} binary := 0; param a{I,I}; param b{I,I}; minimize obj: t; s.t. cobj: sum{i in I, k in I, l in I, m in I} a[i,k]*x[k,l]*b[l,m]*x[i,m] <= t; s.t. c0{i in 1..n}: sum{j in 1..n} x[i,j] = 1; s.t. c1{i in 1..n}: sum{j in 1..n} x[j,i] = 1; #data qap10.dat; data nug10.dat; #option solver cplex; #option cplex_options "mipdisplay=2"; #option solver gurobi; #option gurobi_options "outlev=1"; #option solver scip; option solver xpress; option xpress_options "outlev=0"; solve; display x; #var y{i in 1..n, j in 1..n} = sum{k in 1..n, l in 1..n} x[i,k]*b[k,l]*x[j,l]; #display y;
 |------------------| | Solution of ex08 | |------------------| --- 8.1 --- See qap10.dat The idea is that it respresent a possible tour through the locations 1-2-...-10. Then, at the solution the permuation matrix X will find the optimal tour. --- 8.2 --- See qap.mod --- 8.3 --- See qap1.mod --- 8.4 --- See qap2.mod --- 8.5 --- Use the data in nug10.dat (and if you dare, nug12.dat ;-) )
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