/******************************************************** Xpress-BCL Java Example Problems ================================ file xbsetops.java `````````````````` Set operations. (c) 2008 Fair Isaac Corporation author: S.Heipcke, Jan. 2000 ********************************************************/ import com.dashoptimization.*; public class xbsetops { /* Define arrays with index names: note that the restriction to 8 characters does not apply for BCL */ static final String city_names[] = {"rome", "bristol", "london", "paris", "liverpool"}; static final String port_names[] = {"plymouth", "bristol", "glasgow", "london", "calais", "liverpool"}; /***********************************************************************/ /**** Create the union of two index sets ****/ static XPRBindexSet createUnion(XPRBprob p, XPRBindexSet a, XPRBindexSet b, String name) { int i; XPRBindexSet c; c=p.newIndexSet(name,a.getSize()+b.getSize()); for(i=0;i=0) c.addElement(a.getIndexName(i)); return c; } /***********************************************************************/ public static void main(String[] args) { XPRBindexSet ports,cities,both,places; int i; try (XPRBprob p = new XPRBprob("Setops")) { /* Initialize BCL and create a new problem */ /* Create sets "cities" and "ports" and add the indices */ cities=p.newIndexSet("cities", city_names.length); for(i=0; i