Compact formulation
The interface allows for a more compact problem formulation where xpress.problem is passed all components of the problem: for instance, consider the code below:
import xpress as xp x = xp.var(vartype=xp.integer, name='x1', lb=-10, ub=10) y = xp.var(name='x2') p = xp.problem(x, y, x**2 + 2*y, x + 3*y <= 4, name='myexample', sense=xp.maximize) p.solve()
The declaration of p is equivalent to the following:
import xpress as xp x = xp.var(vartype=xp.integer, name='x1', lb=-10, ub=10) y = xp.var(name='x2') p = xp.problem(name='myexample') p.addVariable(x, y) p.setObjective(x**2 + 2*y, sense=xp.maximize) p.addConstraint(x + 3*y <= 4) p.solve()