Multi problems in GMPL

Domingo Alvarez Duarte <[email protected]> Wed, 26 Aug 2020 19:57:36 +0200
Newsgroups gmane.comp.gnu.glpk
Message-ID <[email protected]>
Hello !

Thinking in how to have multiple problem in GMPL I'm asking for other 
user opinions about how that could be expressed, one example can be like 
the one bellow where we have common elements and namespaced problems.

If you have any other idea that you want to share let me know !

====

param roll_width;
set WIDTHS;

problem Cutting_Opt {
     # ----------------------------------------
     param nPAT integer >= 0, default 0;
     set PATTERNS := 1..nPAT;
     param orders {WIDTHS} > 0;
     param nbr {WIDTHS,PATTERNS} integer >= 0;

     check {j in PATTERNS}: sum {i in WIDTHS} i * nbr[i,j] <= roll_width;

     var Cut {PATTERNS} integer >= 0;

     minimize Number: sum {j in PATTERNS} Cut[j];

     subject to Fill {i in WIDTHS}:
        sum {j in PATTERNS} nbr[i,j] * Cut[j] >= orders[i];
}

problem Pattern_Gen {
     # ----------------------------------------
     param price {WIDTHS} default 0;

     var Use {WIDTHS} integer >= 0;

     minimize Reduced_Cost:
        1 - sum {i in WIDTHS} price[i] * Use[i];

     subject to Width_Limit:
        sum {i in WIDTHS} i * Use[i] <= roll_width;
}
solve Cutting_Opt;
solve Pattern_Gen;

====

Cheers !