I'm experimenting with the AMPL cutting stock example "cut.run" as discussed in Figure 14-3 of the AMPL book.
The example includes a column generation example, which I understand and works well.
But for the data that I'm working with, I wanted to see what happens if I removed unused columns....if there is any advantage to doing so.
It seems like it would be advantageous to reduce the size of the problem for unproductive patterns.
In the AMPL book example notation, if a term in the variable "Cut" is zero, then I want to remove
that entry, and the corresponding column in the variable "nbr", which corresponds to the pattern in question.
I don't see any easy way to delete a column. Column generation only appends a column to the end of the matrix/list.
It seems like I have to copy the whole thing, and then copy it back to the original matrix, or have a double buffer type of solution.
So my question is, is there an easy way to remove a column (or row) from an AMPL matrlx/List?
(or any matrix operations in general).
It looks like maybe the redeclare command could be used for this by redefining "PATTERN" and then using redeclare on nbr.
#------------------------------------AMPL example code
model cut.mod;
data cut.dat;
option solver cplex, solution_round 6;
option display_1col 0, display_transpose -10;
problem Cutting_Opt: Cut, Number, Fill;
option relax_integrality 1;
problem Pattern_Gen: Use, Reduced_Cost, Width_Limit;
option relax_integrality 0;
let nPAT := 0;
for {i in WIDTHS}
{ let nPAT := nPAT + 1;
let nbr[i,nPAT] := floor (roll_width/i);
let {i2 in WIDTHS: i2 <> i} nbr[i2,nPAT] := 0;
}
repeat
{ solve Cutting_Opt;
let {i in WIDTHS} price[i] := Fill[i].dual;
solve Pattern_Gen;
if Reduced_Cost < -0.00001 then
{ #======================Something like this
# if a particular pattern isn't used, then remove it.
#for{nbr in PATTERNS}
#{ if Cut[nbr] == 0
# { delete Fill[nbr]
# delete nbr[nbr]
# nPAT := nPAT-1;
# }
#======================
let nPAT := nPAT + 1;
let {i in WIDTHS} nbr[i,nPAT] := Use[i];
}
else break;
}
Figure 14-3: Gilmore-Gomory procedure for cutting-stock problem (cut.run).
____________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________