Skip to content

NLopt Fails for Unbounded Contraint Rows #24960

Description

@cohnt

What happened?

If the bounds for a row of a constraint are vacuous (-∞,∞), then NLopt terminates with kSolverSpecificError. Simple replication below:

import numpy as np
from pydrake.solvers import IpoptSolver, MathematicalProgram, NloptSolver

def f(x):
    return np.array([x[0] + x[1], x[0] - x[1]])

prog = MathematicalProgram()
x = prog.NewContinuousVariables(2)
prog.AddCost(x.dot(x))
prog.AddConstraint(f, lb=[1.0, -np.inf], ub=[1.0, np.inf], vars=x)
prog.SetInitialGuess(x, [0.0, 0.0])

print(NloptSolver().Solve(prog).get_solution_result())
print(IpoptSolver().Solve(prog).get_solution_result())

Version

e45193f

What operating system are you using?

Other, Ubuntu 24.04 (Noble)

What installation option are you using?

compiled from source code using Bazel

Relevant log output

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

component: mathematical programFormulating and solving mathematical programs; our autodiff and symbolic librariestype: bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions