reset; model cuttingstock.mod; data cuttingstock.dat; for {i in V} let a[i,i] := floor(Length/l[i]); # each roll has just one piece, the i-th problem Master: L, rolls, cover_all; problem Pricing: x, reduced_cost, length; #display a; repeat { problem Master; #expand Master; option solver gurobi; option relax_integrality 1; solve; #display L; #display cover_all.dual; # the dual value for each constraint for {i in V} let pi[i]:= cover_all.dual[i]; problem Pricing; #display pi; option solver gurobi; option relax_integrality 0; solve; if (reduced_cost > -1e-16) then break; let p := p+1; let {i in V} a[i,p] := x[i]; } until 0; problem Master; option solver gurobi; option relax_integrality 1; solve; display L; problem Master; option solver gurobi; option relax_integrality 0; solve; for {j in P: L[j]>=1} { printf"Pattern %d is used %d times with",j, L[j]; for {i in V: a[i,j]>=1} printf", %dx '%d' (length %d)", a[i,j], i, l[i]; printf".\n"; }