Delivery - Data input from file; infeasibility analysis
|
|
Type: | Network flow |
Rating: | 2 |
Description: | A simple supply and demand network example showing data input from file and the use of "views": incremental definition of arrays of variables. Also uses constraint templates with the arrays of variables. A second version of this model (file xbdlvriis) has modified data making the problem infeasible. This example shows how to analyze infeasibility with the help of IIS (irreducible infeasible sets), it retrieves the IIS and prints out their contents. It is possible to retrieve more detailed information on the IIS, such as isolation rows or bounds, using Xpress Optimizer functions (file xbdlvriis2iso) or to use the infeasibility repair functionality of the Optimizer (file xbdlvriis2rep) with models defined in BCL. |
File(s): | xbdelvr.java, xbdlvriis.java, xbdlvriis2iso.java, xbdlvriis2rep.java |
Data file(s): | ifvan.dat, cost.dat |
|
xbdelvr.java |
/******************************************************** Xpress-BCL Java Example Problems ================================ file xbdelvr.java ````````````````` Transportation problem. (c) 2008 Fair Isaac Corporation author: S.Heipcke, Jan. 2000, rev. Mar. 2011 ********************************************************/ import java.io.*; import com.dashoptimization.*; public class xbdelvr { static final int NSupp = 10; /* Number of suppliers */ static final int NCust = 7; /* Number of customers */ static final int MaxArcs = 100; /* Max. num. of non-zero cost values */ static final String VANFILE = System.getProperty("XPRBDATA") + "/delivery/ifvan.dat"; static final String COSTFILE = System.getProperty("XPRBDATA") + "/delivery/cost.dat"; /****DATA****/ /* Supplier: London Luton B'ham Bristl Derby Stckpt */ static final double SUPPLY[] = {140.0, 600.0, 50.0, 10.0, 400.0, 200.0, /* Supplier: York Derby Soton Scnthp */ 20.0, 90.0, 30.0, 12.0}; /* Customer: London Livpol Doncst York Hull Manchr */ static final double DEMAND[] = {123.3, 56.4, 17.1, 192.8, 310.0, 47.0, /* Customer: Shffld */ 86.0}; static double[][] COST; /* Cost per supplier-customer pair */ static double[][] IFVAN; /* Non-zero if route uses vans instead of lorries */ static final double VANCAP=40.0; /* Capacity on routes that use vans */ static XPRB bcl; static XPRBprob p; /***********************************************************************/ static void modDelivery() throws IOException { XPRBexpr lobj, lc; int s,c; XPRBvar[][] x; bcl = new XPRB(); /* Initialize BCL */ p = bcl.newProb("Delivery"); /* Create a new problem in BCL */ /****VARIABLES****/ x = new XPRBvar[NSupp][NCust]; for(s=0;s |
xbdlvriis.java |
/******************************************************** Xpress-BCL Java Example Problems ================================ file xbdlvriis.java ``````````````````` Transportation problem (infeasible data). Retrieving and printing IIS. (c) 2008 Fair Isaac Corporation author: S.Heipcke, 2005, rev. Mar. 2011 ********************************************************/ import java.io.*; import java.util.*; import com.dashoptimization.*; public class xbdlvriis { static final int NSupp = 10; /* Number of suppliers */ static final int NCust = 7; /* Number of customers */ static final int MaxArcs = 100; /* Max. num. of non-zero cost values */ static final String VANFILE = System.getProperty("XPRBDATA") + "/delivery/ifvan.dat"; static final String COSTFILE = System.getProperty("XPRBDATA") + "/delivery/cost.dat"; /****DATA****/ /* Supplier: London Luton B'ham Bristl Derby Stckpt */ static final double SUPPLY[] = {140.0, 200.0, 50.0, 10.0, 400.0, 200.0, /* Supplier: York Derby Soton Scnthp */ 20.0, 90.0, 30.0, 12.0}; /* Customer: London Livpol Doncst York Hull Manchr */ static final double DEMAND[] = {1230.3, 560.4, 117.1, 592.8, 310.0, 1247.0, /* Customer: Shffld */ 86.0}; static double[][] COST; /* Cost per supplier-customer pair */ static double[][] IFVAN; /* Non-zero if route uses vans instead of lorries */ static final double VANCAP=40.0; /* Capacity on routes that use vans */ static XPRB bcl; static XPRBprob p; /***********************************************************************/ static void modDelivery() { XPRBexpr lobj, lc; int s,c,i; XPRBvar[][] x; ArrayList iisctr,iisvar; int numv, numc, numiis, ct; bcl = new XPRB(); /* Initialize BCL */ p = bcl.newProb("Delivery"); /* Create a new problem in BCL */ /****VARIABLES****/ x = new XPRBvar[NSupp][NCust]; for(s=0;s |
xbdlvriis2iso.java |
/******************************************************** Xpress-BCL Java Example Problems ================================ file xbdlvriis2iso.java ``````````````````````` Transportation problem (infeasible data). Retrieving and printing IIS. - Using Optimizer functions to retrieve detailed IIS information including isolation rows/bounds - (c) 2008 Fair Isaac Corporation author: S.Heipcke, Jan. 2008, rev. Mar. 2011 ********************************************************/ import java.io.*; import java.util.*; import java.text.DecimalFormat; import com.dashoptimization.*; public class xbdlvriis2iso { static final int NSupp = 10; /* Number of suppliers */ static final int NCust = 7; /* Number of customers */ static final int MaxArcs = 100; /* Max. num. of non-zero cost values */ static final String VANFILE = System.getProperty("XPRBDATA") + "/delivery/ifvan.dat"; static final String COSTFILE = System.getProperty("XPRBDATA") + "/delivery/cost.dat"; /****DATA****/ /* Supplier: London Luton B'ham Bristl Derby Stckpt */ static final double SUPPLY[] = {140.0, 200.0, 50.0, 10.0, 400.0, 200.0, /* Supplier: York Derby Soton Scnthp */ 20.0, 90.0, 30.0, 12.0}; /* Customer: London Livpol Doncst York Hull Manchr */ static final double DEMAND[] = {1230.3, 560.4, 117.1, 592.8, 310.0, 1247.0, /* Customer: Shffld */ 86.0}; static double[][] COST; /* Cost per supplier-customer pair */ static double[][] IFVAN; /* Non-zero if route uses vans instead of lorries */ static final double VANCAP=40.0; /* Capacity on routes that use vans */ static XPRB bcl; static XPRBprob p; static XPRSprob op; private static DecimalFormat form = new DecimalFormat ("####.0"); /***********************************************************************/ static void modDelivery() { XPRBexpr lobj, lc; int s,c,i; XPRBvar[][] x; XPRBctr[] CSupply, CDemand; int numv, numc, numiis, ncol, nrow; IntHolder inumv, inumc, inumiis; int[] viis, ciis; double[] duals, rdcs, bnd, rhs; byte[] ctrtype, bndtype, isolationrows, isolationbnds; java.lang.String[] cnames, vnames; java.lang.String isotype[] = {"N/A", "No ", "Yes"}; bcl = new XPRB(); /* Initialize BCL */ p = bcl.newProb("Delivery"); /* Create a new problem in BCL */ XPRS.init(); /* Initialize Xpress-Optimizer */ /****VARIABLES****/ x = new XPRBvar[NSupp][NCust]; for(s=0;s |
xbdlvriis2rep.java |
/******************************************************** Xpress-BCL Java Example Problems ================================ file xbdlvriis2rep.java ``````````````````````` Transportation problem (infeasible data). Repairing infeasibility. - Using Optimizer functions - (c) 2008 Fair Isaac Corporation author: S.Heipcke, Jan. 2008, rev. Mar. 2011 ********************************************************/ import java.io.*; import java.util.*; import java.text.DecimalFormat; import com.dashoptimization.*; public class xbdlvriis2rep { static final int NSupp = 10; /* Number of suppliers */ static final int NCust = 7; /* Number of customers */ static final int MaxArcs = 100; /* Max. num. of non-zero cost values */ static final String VANFILE = System.getProperty("XPRBDATA") + "/delivery/ifvan.dat"; static final String COSTFILE = System.getProperty("XPRBDATA") + "/delivery/cost.dat"; /****DATA****/ /* Supplier: London Luton B'ham Bristl Derby Stckpt */ static final double SUPPLY[] = {140.0, 200.0, 50.0, 10.0, 400.0, 200.0, /* Supplier: York Derby Soton Scnthp */ 20.0, 90.0, 30.0, 12.0}; /* Customer: London Livpol Doncst York Hull Manchr */ static final double DEMAND[] = {1230.3, 560.4, 117.1, 592.8, 310.0, 1247.0, /* Customer: Shffld */ 86.0}; static double[][] COST; /* Cost per supplier-customer pair */ static double[][] IFVAN; /* Non-zero if route uses vans instead of lorries */ static final double VANCAP=40.0; /* Capacity on routes that use vans */ static XPRB bcl; static XPRBprob p; static XPRSprob op; /***********************************************************************/ static void modDelivery() { XPRBexpr lobj, lc; int s,c,i; XPRBvar[][] x; XPRBctr[] CSupply, CDemand; int nrow, ncol; IntHolder iscode; double[] lrp, grp, lbp, ubp; bcl = new XPRB(); /* Initialize BCL */ p = bcl.newProb("Delivery"); /* Create a new problem in BCL */ XPRS.init(); /* Initialize Xpress-Optimizer */ /****VARIABLES****/ x = new XPRBvar[NSupp][NCust]; for(s=0;s |