user3180
user3180

Reputation: 1497

How to retrieve the optimization problem class

Is there any way to show what class of optimization problem we have? E.g. SOCP, SDP, or totally nonconvex?

Or do we just need to try a bunch of solvers and see when they fail? Is SNOPT the only one that supports nonconvex optimization?

Upvotes: 0

Views: 68

Answers (2)

jwnimmer-tri
jwnimmer-tri

Reputation: 2449

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

You can use ChooseBestSolver to find the best-suited solver to the program.

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)

There is also a mp.Solve function that does all of that at once.

Is SNOPT the only one that supports nonconvex optimization?

The documentation has the full list of solvers. At the moment SNOPT, Ipopt, NLopt are the available non-linear solvers.

Upvotes: 0

Hongkai Dai
Hongkai Dai

Reputation: 2766

You can refer to GetProgramType which returns if the program is LP, QP, SDP, etc.

Is SNOPT the only one that supports nonconvex optimization?

No, we also have IPOPT and NLOpt for non-convex nonlinear optimization.

Upvotes: 1

Related Questions