| |||||||||||||||||||||||||
Column generation for a cutting stock problem Description
Further explanation of this example: paper.mos, papers.mos, papersn.mos: 'Mosel User Guide', Section 11.2 Column generation, and the Xpress Whitepaper 'Embedding Optimization Algorithms', Section 'Column generation for cutting-stock' (also discusses a generalization to bin-packing problems); for the multiple model versions paperp.mos, paperms.mos see the Xpress Whitepaper 'Multiple models and parallel solving with Mosel', Section 'Column generation: solving different models in sequence'.
Source Files By clicking on a file name, a preview is opened at the bottom of this page.
knapsack.mos (!******************************************************* Mosel User Guide Examples ========================= file knapsack.mos ````````````````` Knapsack (sub)model of the for a paper cutting example, reading data from shared memory. *** Can be run standalone - or run from paperp.mos *** Solve the integer knapsack problem z = max{Cx : Ax<=B, x<=D, x in Z^N} (c) 2008 Fair Isaac Corporation author: S. Heipcke, 2004, rev. Aug. 2011 *******************************************************!) model "Knapsack" uses "mmxprs" parameters NWIDTHS=5 ! Number of different widths INDATA = "knapsack.dat" ! Input data file RESDATA = "knresult.dat" ! Result data file end-parameters declarations WIDTHS = 1..NWIDTHS ! Range of widths A,C: array(WIDTHS) of real ! Constraint + obj. coefficients B: real ! RHS value of knapsack constraint D: array(WIDTHS) of integer ! Variables bounds (demand quantities) KnapCtr, KnapObj: linctr ! Knapsack constraint+objective x: array(WIDTHS) of mpvar ! Knapsack variables xbest: array(WIDTHS) of integer ! Solution values end-declarations initializations from INDATA A B C D end-initializations ! Define the knapsack problem KnapCtr:= sum(j in WIDTHS) A(j)*x(j) <= B KnapObj:= sum(j in WIDTHS) C(j)*x(j) ! Integrality condition and bounds forall(j in WIDTHS) x(j) is_integer forall(j in WIDTHS) x(j) <= D(j) ! These bounds can be omitted maximize(KnapObj) z:=getobjval forall(j in WIDTHS) xbest(j):=round(getsol(x(j))) initializations to RESDATA xbest z as "zbest" end-initializations end-model | |||||||||||||||||||||||||
© Copyright 2024 Fair Isaac Corporation. |