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

Blend: A model for mineral blending

Description
Several ores are blended to a final product that must have a certain quality ('grade'). We wish to determine the quantity of every ore to be used in the blend with the objective to maximize the total profit (calculated as sales revenues - raw material cost).

Further explanation of this example: 'Xpress Python Reference Manual'

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

Data Files

blend2.py

'''*******************************************************
* Python Example Problems                             *
*                                                     *
* file blend2.py                                      *
* Example for the use of the Python language          *
* (Blending problem from XPRESS-MP User Guide)        *
*                                                     *
* Data given in the model.                            *
*                                                     *
* (c) 2018-2024 Fair Isaac Corporation                *
*******************************************************'''

import xpress as xp

p = xp.problem()

ROres = range(2)
REV = 125                     # Unit revenue of product

COST = [85.00, 93.00]
AVAIL = [60.00, 45.00]

x = [p.addVariable(ub=AVAIL[o]) for o in ROres]

# Objective: maximize total profit
p.setObjective(xp.Sum((REV - COST[o]) * x[o] for o in ROres),
sense=xp.maximize)

# Lower and upper bounds on ore quality