FICO Xpress Optimization Examples Repository
 FICO Optimization Community FICO Xpress Optimization Home

Workshop - Displaying solution information

Description
A small planning problem. The example composes constraints, LP solves the problem and then prints the variables.

Model version 'xbworkrng' shows how to retrieve ranging information for variables and constraints and how to change the number-printing format.

Source Files

xbworks.java

/********************************************************
Xpress-BCL Java Example Problems
================================

file xbworks.java
`````````````````
Workshop planning example.

(c) 2008 Fair Isaac Corporation
author: S.Heipcke, Jan. 2000, rev. Mar. 2011
********************************************************/

import com.dashoptimization.*;

public class xbworks
{
static final int NProd = 2;     /* Number of products */
static final int NShop = 3;     /* Number of workshops */
static final int WMAX = 40;     /* Maximum weekly working time */

/****DATA****/
static final int[][] DUR = {{5, 9, 7},
{10, 2, 5}};  /* Duration of product p on shop s */
static final int[] RES   = {10, 8};      /* Man hours per unit */
static final int[] PRICE = {108, 84};    /* Selling price per unit */

/***********************************************************************/

public static void main(String[] args)
{
int p,s;
XPRB bcl;
XPRBexpr l;
XPRBvar[] x;                   /* Amount of product p */
XPRBprob pb;

bcl = new XPRB();              /* Initialize BCL */
pb = bcl.newProb("Workshop");  /* Create a new problem in BCL */

/****VARIABLES****/
x = new XPRBvar[NProd];
for(p=0;p<NProd;p++)  x[p] = pb.newVar("x");

/****OBJECTIVE****/
l = new XPRBexpr();
for(p=0;p<NProd;p++)
pb.setObj(l);                  /* Set obj. function: maximize benefit */

/****CONSTRAINTS****/
for(s=0;s<NShop;s++)           /* Limit on weekly working hours */
{
l = new XPRBexpr();