Initializing help system before first use

Contract - Semi-continuous variables, predefined constraint functions, combine BCL with Xpress Optimizer


Type: Contract allocation
Rating: 3
Description: A small MIP-problem example demonstrating how to define semi-continuous variables, use predefined constraint functions and retrieve the problem status.
Two modified versions (documented in the 'BCL Reference Manual') show how to (1) combine BCL problem input with problem solving in Xpress Optimizer and (2) use an Xpress Optimizer solution callback with a BCL model.
File(s): xbcontr.java


xbcontr.java
/********************************************************
  Xpress-BCL Java Example Problems
  ================================

  file xbcontr.java
  `````````````````
  Contract allocation example.

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

import java.io.*;
import com.dashoptimization.*;

public class xbcontr
{
 static final int District = 6;   /* Number of districts */
 static final int Contract = 10;  /* Number of contracts */

/**** DATA ****/
 static final int[] OUTPUT = {50, 40, 10, 20, 70, 50};    
                                  /* Max. output per district */
 static final int[] COST   = {50, 20, 25, 30, 45, 40};    
                                  /* Cost per district */
 static final int[] VOLUME = {20, 10, 30, 15, 20, 30, 10, 50, 10, 20};  
                                  /* Volume of contracts */

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

 public static void main(String[] args) throws IOException
 {
  int d,c;
  XPRB bcl;
  XPRBprob p;
  XPRBexpr l1,l2,lobj;
  XPRBvar[][] x;                  /* Variables indicating whether a project 
                                     is chosen */
  XPRBvar[][] y;                  /* Quantities allocated to contractors */

  bcl = new XPRB();               /* Initialize BCL */
  p = bcl.newProb("Contract");    /* Create a new problem in BCL */
 
/**** VARIABLES ****/
  x = new XPRBvar[District][Contract];
  y = new XPRBvar[District][Contract];
  for(d=0;d0)
      System.out.print(y[d][c].getName() + ":" + y[d][c].getSol() + ", ");
    System.out.println();
   }
  } 
 }
}