/******************************************************** Xpress-BCL Java Example Problems ================================ file xbels.java ``````````````` Economic lot sizing, ELS, problem, solved by adding (l,S)-inequalities) in several rounds looping over the root node. ELS considers production planning over a horizon of T periods. In period t, t=1,...,T, there is a given demand DEMAND[t] that must be satisfied by production prod[t] in period t and by inventory carried over from previous periods. There is a set-up up cost SETUPCOST[t] associated with production in period t. The unit production cost in period t is PRODCOST[t]. There is no inventory or stock-holding cost. (c) 2008-2024 Fair Isaac Corporation author: S.Heipcke, 2001, rev. Mar. 2011 ********************************************************/ import com.dashoptimization.*; public class xbels { static final double EPS = 1e-6; static final int T = 6; /* Number of time periods */ /****DATA****/ static final int[] DEMAND = { 1, 3, 5, 3, 4, 2}; /* Demand per period */ static final int[] SETUPCOST = {17,16,11, 6, 9, 6}; /* Setup cost / period */ static final int[] PRODCOST = { 5, 3, 2, 1, 3, 1}; /* Prod. cost / period */ static int[][] D; /* Total demand in periods t1 - t2 */ static XPRBvar[] prod; /* Production in period t */ static XPRBvar[] setup; /* Setup in period t */ /***********************************************************************/ static void modEls(XPRBprob p) throws XPRSexception { int s,t,k; XPRBexpr cobj,le; D = new int[T][T]; for(s=0;s= D[0][l] */ if(ds < D[0][l] - EPS) { le = new XPRBexpr(); for(t=0;t<=l;t++) { if (solprod[t] < D[t][l]*solsetup[t] + EPS) le .add(prod[t]); else le .add(setup[t].mul(D[t][l])); } p.newCtr("cut" +(ncut+1), le.gEql(D[0][l]) ); ncut++; npcut++; } } System.out.println("Pass " +npass + " (" +(XPRB.getTime()-starttime)/1.000 + " sec), objective value " + objval + ", cuts added: " + npcut + " (total " + ncut +")"); if(npcut==0) System.out.println("Optimal integer solution found:"); else { p.loadMat(); /* Reload the problem */ p.loadBasis(basis); /* Load the saved basis */ basis = null; /* No need to keep the basis any longer */ } } while(npcut>0); /* Print out the solution: */ for(t=0;t