coin-or / coin-or/python-mip

objective_values[k] returns the wrong value

Open
#196 3 comments 0 reactions 0 assignees View on GitHub
bug cbc-interface reproducible
Dominant language
Linear Programming
Stars
600
Forks
108
PR merge metrics
No merged PRs in 30d

Description

`import mip, time;`
`mip.version`
'1.13.0'
`model = mip.Model()`
`x = model.add_var(name='x', var_type=mip.INTEGER);`
`y = model.add_var(name='y', var_type=mip.INTEGER);`
`y.ub = 2`
` `
`model += ( 2*x + 3*y <= 13);`
` `
`model.objective = ( 2*x + 3*y );`
`model.sense = mip.MAXIMIZE;`
`status = model.optimize(max_seconds=300);`
`for k in range(model.num_solutions):`
` print('solution {} objective {} x = {} y = {}'.format(k, model.objective_values[k], x.xi(k), y.xi(k)))`

solution 0 objective 13.0 x = 5.0 y = 1.0
solution 1 objective -12.0 x = 6.0 y = 0.0

Obviously the objective of solution 1 is +12, not -12 :)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.