coin-or/SHOT 是一个托管在 GitHub 上的开源项目,主要使用 C++ 编写,采用 Eclipse Public License 2.0 许可证,目前获得 145 个 Star、28 次 Fork。
仓库全名
coin-or/SHOT
README 摘要
The Supporting Hyperplane Optimization Toolkit SHOT is a software for solving mathematical optimization problems of the mixed-integer nonlinear programming (MINLP) class. In addition to MINLP problems, SHOT can also be used for subclasses such as NLP and MI(QC)QP. SHOT is global for convex MINLP, and mainly a heuristic for nonconvex MINLP, where the bounds on the objective value are still guaranteed. A reformulation…
SHOT is a software for solving mathematical optimization problems of the mixed-integer nonlinear programming (MINLP) class. In addition to MINLP problems, SHOT can also be used for subclasses such as NLP and MI(QC)QP.
SHOT is global for convex MINLP, and mainly a heuristic for nonconvex MINLP, where the bounds on the objective value are still guaranteed. A reformulation engine rewrites each problem into a form that suits the method, and some nonconvex problem types are reformulated into convex ones and solved to global optimality.
Install SHOTpy, built with the open-source solvers Cbc, Ipopt and HiGHS, from PyPI:
pip install SHOTpy
import SHOTpy
solver = SHOTpy.Solver()
problem = SHOTpy.Problem(solver)
x = problem.addVariable("x", SHOTpy.VariableType.Real, 0.0, 10.0)
y = problem.addVariable("y", SHOTpy.VariableType.Integer, 0.0, 10.0)
problem.setObjective(SHOTpy.exp(x) + (y - 2.5)**2)
problem.addConstraint(x + y >= 3, "c")
problem.finalize()
solver.setProblem(problem)
solver.solveProblem()
print(solver.getModelReturnStatus())
if solver.hasPrimalSolution():
print(solver.getPrimalSolution().point)
The package also installs the SHOT executable as the command SHOT, which
solves problem files and can be used as an AMPL solver, e.g., from Pyomo,
JuMP, or AMPL. To get only the command, install it as a tool with
pipx install SHOTpy or uv tool install SHOTpy:
The same executable, with the same solvers, can also be downloaded without
Python from the GitHub releases as an archive for
Linux x86_64 and ARM64, macOS ARM64 and Windows x64. Extract the whole
archive and run ./SHOT (or SHOT.exe on Windows) in its directory.
The public wheels do not include CPLEX, Gurobi, GAMS, CONOPT or Uno. To use them,
build SHOTpy from source as described in
SHOTpy with proprietary solvers.
SHOT builds on Linux, macOS, and natively on Windows x64 with MSVC.
using its API implemented in C++ (C++ integration), both of which support callbacks for customizing SHOT’s behavior (e.g. injecting primal solutions, warm-starting, or adding custom cuts).
SHOT requires a MILP solver: Cplex, Gurobi, Cbc, HiGHS or SCIP. NLP subproblems can use Ipopt, Uno, the optional CONOPT C++ API, or SHOT’s built-in NLP solver. If SHOT is interfaced with GAMS, any licensed NLP solver can be used.
Dual bound through polyhedral (outer) approximation
SHOT is based on iteratively creating a tighter polyhedral approximation of the nonlinear feasible set by generating supporting hyperplanes or cutting planes. These linearized problems are then solved with a mixed-integer linear programming (MILP) solver such as CPLEX, Gurobi, Cbc, HiGHS or SCIP. If CPLEX, Gurobi or SCIP is used, the subproblems can also include quadratic and bilinear nonlinearities directly; then MIQP or MIQCQP subproblems are solved. The dual strategy can be run either as a multi-tree search (repeatedly re-solving the MIP relaxation) or, with CPLEX or Gurobi, as a single-tree (branch-and-cut) search that adds cuts via callbacks during one search tree; Cbc, HiGHS and SCIP currently only support the multi-tree strategy.
The problem types that can be solved to global optimality depend on which MIP solver is used:
Problem type
CPLEX
Gurobi
Cbc
HiGHS
SCIP
Convex MIQP
✓*
✓*
✓
✓
✓*
Convex MIQCQP
✓*
✓*
✓
✓
✓*
Convex MINLP
✓
✓
✓
✓
✓
Nonconvex MIQP
✓*
✓*
?
?
✓*
Nonconvex MIQCQP
?
✓*
?
?
✓*
Nonconvex MINLP
?
?
?
?
?
✓ = solved to global optimality, ? = no guarantee that a solution is found, * = the problem can be handled directly by the subsolver (native quadratic/bilinear support).
Primal bound using heuristics
The solution to the outer approximation problem provides a lower (dual) bound (when solving a minimization problem) to the original problem if the problem is convex. If the problem is nonconvex, convergence to the global optimal solution cannot be guaranteed (but might be achieved for certain classes of problems, cf. this paper).
To get an upper (primal) bound (when solving a minimization problem) on the optimal solution SHOT utilizes the following heuristics:
Solving nonlinear programming (NLP) problems where the integer variables have been fixed to valid values. This is done by calling an external NLP solver (e.g. Ipopt).
By checking solutions from the MIP solver’s solution pool for points that fulfill also the nonlinearities in the original MINLP problem.
By performing root searches.
Termination
When the relative or absolute difference (objective gap) between the primal and dual bounds is less than a user-specified value, SHOT terminates with the current primal solution. If the original problem is convex, this is a global solution to the problem. If it is nonconvex, there is normally no guarantee that such a solution can be found, however SHOT will always in addition to the primal solution give a valid lower bound on the solution.
The features for solving nonconvex MINLP problems are described in the papers:
Lundell, A. and Kronqvist, J., Polyhedral approximation strategies for nonconvex mixed-integer nonlinear programming in SHOT. Journal of Global Optimization (2021). https://doi.org/10.1007/s10898-021-01006-1
Lundell, A. and Kronqvist, J. On Solving Nonconvex MINLP Problems with SHOT (2019). In: Le Thi H., Le H., Pham Dinh T. (editors) Optimization of Complex Systems: Theory, Models, Algorithms and Applications. WCGO 2019. Advances in Intelligent Systems and Computing, vol 991. Springer, Cham.
Reformulation of nonseparable convex quadratic expressions (preprint):
Blomqvist, J., Tamm, E., Kronqvist, J. and Lundell, A. Decomposition-Based Reformulation of Nonseparable Quadratic Expressions in Convex MINLP. Optimization Online (2026). https://optimization-online.org/?p=34367
The software itself is archived on Zenodo:
Lundell, A., Kronqvist, J., Blomqvist, J. and Vigerske, S. SHOT: The Supporting Hyperplane Optimization Toolkit. Zenodo. https://doi.org/10.5281/zenodo.24161046
This DOI refers to all versions and resolves to the latest; each release also has a DOI of its own, listed on its Zenodo page.
评论