如何检索优化问题class

How to retrieve the optimization problem class

有什么方法可以显示我们有什么 class 优化问题吗?例如。 SOCP、SDP 还是完全非凸的?

或者我们只需要尝试一堆求解器,看看它们何时失败? SNOPT是唯一支持非凸优化的吗?

如果程序是LP,QP,SDP等可以参考GetProgramType其中returns

Is SNOPT the only one that supports nonconvex optimization?

不,我们还有 IPOPT 和 NLOpt 用于 non-convex 非线性优化。

Or do we just need to try a bunch of solvers and see when they fail?

您可以使用 ChooseBestSolver 找到程序的 best-suited 求解器。

from pydrake.solvers import mathematicalprogram as mp

# Make a program.
prog = mp.MathematicalProgram()
x = prog.NewContinuousVariables(2, "x")
prog.AddLinearConstraint(x[0] + x[1] == 0)
prog.AddLinearConstraint(2*x[0] - x[1] == 1)

# Find the best solver.
solver_id = mp.ChooseBestSolver(prog)
solver = mp.MakeSolver(solver_id)
assert solver.solver_id().name() == "Linear system"

# Solve.
result = solver.Solve(prog)

还有一个 mp.Solve 函数可以同时完成所有这些。

Is SNOPT the only one that supports nonconvex optimization?

documentation 有完整的求解器列表。目前 SNOPT、Ipopt、NLopt 是可用的 non-linear 求解器。