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

Coco - A full production planning example

Description
The Coco productional planning problem: multi-item, multi-period, multi-site production planning. A sequence of model versions show how the model was developed, to (a) use more sophisticated modeling features and (b) to extend the model, taking it from a simple linear model to one with fixed prices and logical decisions.
1. xbcoco1: initial formulation, data, variables and constraints fixed
2. xbcoco2: use parameters, data tables and subscripted variables.

read data tables in from text data files (short-term planning).
3. xbcoco3: like xbcoco2.c, but several time periods (mid-term planning).
4. xbcoco : complete problem, data defined in the model definition (long-term planning).

Source Files
By clicking on a file name, a preview is opened at the bottom of this page.

Data Files

xbcoco1.java

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

file xbcoco1.java

Coco Problem Phase 1.
Initial formulation: data, variables and constraints fixed.

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

import com.dashoptimization.*;

public class xbcoco1 {
public static void main(String[] args) {
XPRBvar make11,make21,make12,make22;

try (XPRBprob p = new XPRBprob("Coco1")) { /* Initialize BCL and create a new problem */

/****VARIABLES****/
make11 = p.newVar("make11"); /* Amount of prod. 1 to make at factory 1 */
make21 = p.newVar("make21"); /* Amount of prod. 2 to make at factory 1 */
make12 = p.newVar("make12"); /* Amount of prod. 1 to make at factory 2 */
make22 = p.newVar("make22"); /* Amount of prod. 2 to make at factory 2 */

/****OBJECTIVE****/
/* Define & set objective function: maximize total profit */

/****CONSTRAINTS****/
/* Capacity limit at factory 1 */

/* Capacity limit at factory 2 */

/* Limit on the amount of prod. 1 to be sold */

/* Limit on the amount of prod. 2 to be sold */

/****SOLVING + OUTPUT****/
p.setSense(XPRB.MAXIM);      /* Choose the sense of the optimization */
p.lpOptimize("");            /* Solve the LP-problem */
System.out.println("Objective: " + p.getObjVal());  /* Get objective value */

/* Print out the solution values for all variables */
System.out.println(make11.getName() +": " + make11.getSol());
System.out.println(make21.getName() +": " + make21.getSol());
System.out.println(make12.getName() +": " + make12.getSol());
System.out.println(make22.getName() +": " + make22.getSol());
}
}
}

`