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.c


xbcontr.c
/********************************************************
  BCL Example Problems
  ====================

  file xbcontr.c
  ``````````````
  Contract allocation example.

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

#include 
#include "xprb.h"

#define District 6                 /* Number of districts */
#define Contract 10                /* Number of contracts */

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

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

int main(int argc, char **argv)
{
 int d,c;
 XPRBctr c1,c2,cobj;
 XPRBvar x[District][Contract];    /* Variables indicating whether a project 
                                      is chosen */
 XPRBvar y[District][Contract];    /* Quantities allocated to contractors */
 XPRBprob prob;

 prob=XPRBnewprob("Contract");     /* Initialize a new problem in BCL */

/**** VARIABLES ****/
 for(d=0;d0)
     printf("%s:%g, ", XPRBgetvarname(y[d][c]), XPRBgetsol(y[d][c]));
   printf("\n");
  }
 } 
 return 0;
}