-
When solving an LP relaxation, I want to terminate the simplex solver early if the objective function reaches a certain threshold, since the node will be cut off anyway. I thought the How can I achieve early termination? As a workaround, I could add the objective as an additional constraint and impose the bound that constraint, but it’s not ideal. Maybe a custom simplex interrupt callback could do it, but that’s also not ideal in Python. Any help is greatly appreciated. |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 4 replies
-
Let's assume that your LP is a minimization. By default, HiGHS uses the dual simplex algorithm. When The In what way have you used the |
Beta Was this translation helpful? Give feedback.
-
Thank you for your prompt response. Here is a minimal reproducible example: from highspy import Highs, ObjSense
h = Highs()
x0 = h.addVariable(ub=10)
x1 = h.addVariable(ub=10)
x2 = h.addVariable(ub=1)
x3 = h.addVariable(ub=7)
h.addConstr( x0 + 2*x1 + 3*x2 + 2*x3 <= 15)
h.addConstr(3*x0 + 4*x1 + 2*x2 + x3 <= 10)
h.addConstr(2*x0 + 2*x1 + 2*x2 + 2*x3 <= 20)
h.addConstr(4*x0 + 3*x1 + x2 + x3 <= 10)
h.setObjective(2*x0 + 2*x1 + x2 + x3, ObjSense.kMaximize)
h.setOptionValue('presolve', 'off')
h.setOptionValue('objective_bound', 0.0)
print('objective_bound:', h.getOptionValue('objective_bound'))
h.run()
print()
print('Model status:', h.getModelStatus())
print('Objective value:', h.getObjectiveValue())
print('Solution:')
print('\n'.join(str(x) for x in h.getSolution().col_value)) No matter how I set the I don't see my mistake. Just to avoid the XY problem, here’s the context: I’m implementing a custom, problem-specific branch-and-bound algorithm that already outperforms general-purpose MILP solvers like HiGHS and SCIP. Each child node inherits the initial basis and LP relaxation solution from its parent, that is, I warm-start the solver from a dual feasible solution. However, there’s no need to solve the LP relaxation to optimality if the node can be cut off because its objective exceeds the current incumbent. Therefore, I want the simplex solver to stop as soon as it reaches this cutoff value. This is currently a real performance bottleneck. |
Beta Was this translation helpful? Give feedback.
-
I see that However, for your example (as a maximizer), the optimal objective value is I've hacked something in, and with an I'll revert this back to an issue, but it won't be fixed soon |
Beta Was this translation helpful? Give feedback.
-
Thank you for your prompt response.
Is there any practical workaround in the meantime? I looked into |
Beta Was this translation helpful? Give feedback.
If you negate the costs and 'objective_bound', and minimize, then it should work as you wish