FICO
FICO Xpress Optimization Examples Repository
FICO Optimization Community FICO Xpress Optimization Home
Back to examples browserPrevious exampleNext example

Apply a primal heuristic to a knapsack problem

Description

The program demonstrates the use of the MIP log callback.

We take the knapsack problem stored in burglar.mps and initiate a tree search. At each node, so long as the current solution is both LP optimal and integer infeasible, we truncate the solution values to create a feasible integer solution. We then update the cutoff, if the new objective value has improved it, and continue the search.



Source Files
By clicking on a file name, a preview is opened at the bottom of this page.
knapsack.c[download]

Data Files





burglar.mps

NAME          burglar 
ROWS
 N  ValMax  
 L  Wmax    
COLUMNS
    x_____01  ValMax       15.000000   Wmax          2.000000
    x_____02  ValMax      100.000000   Wmax         20.000000
    x_____03  ValMax       90.000000   Wmax         20.000000
    x_____04  ValMax       60.000000   Wmax         30.000000
    x_____05  ValMax       40.000000   Wmax         40.000000
    x_____06  ValMax       15.000000   Wmax         30.000000
    x_____07  ValMax       10.000000   Wmax         60.000000
    x_____08  ValMax        1.000000   Wmax         10.000000
RHS
    RHS00001  Wmax        102.000000
BOUNDS
 BV BOUND001  x_____01
 BV BOUND001  x_____02
 BV BOUND001  x_____03
 BV BOUND001  x_____04
 BV BOUND001  x_____05
 BV BOUND001  x_____06
 BV BOUND001  x_____07
 BV BOUND001  x_____08
ENDATA

Back to examples browserPrevious exampleNext example