Skip to main content

Uno, a highly customizable SQP & barrier solver for nonlinearly constrained optimization

Project description

Uno

Uno is a solver for nonlinearly constrained optimization that unifies Lagrange-Newton (essentially SQP and interior-point) methods. It breaks them down into a set of building blocks (e.g., strategies to compute descent directions and techniques to enforce globalization).

unopy, Uno's Python interface, allows you to solve an optimization model described by callback functions.

Example

An implementation example of the Hock-Schittkowski model hs015 is available in the file example_hs015.py.

Building an optimization model

Building an optimization model is incremental and starts with the information about the variables:

model = unopy.Model(problem_type, number_variables,
   variables_lower_bounds, variables_upper_bounds, base_indexing)

The following optional elements can be added to the model separately:

  • the objective function (and its gradient). It is 0 otherwise;
model.set_objective(optimization_sense, objective_function, objective_gradient)
  • constraint functions (and their Jacobian);
model.set_constraints(number_constraints, constraint_functions,
   constraints_lower_bounds, constraints_upper_bounds, number_jacobian_nonzeros,
   jacobian_row_indices, jacobian_column_indices, constraint_jacobian)
  • the Lagrangian Hessian;
model.set_lagrangian_hessian(number_hessian_nonzeros, hessian_triangular_part, 
   hessian_row_indices, hessian_column_indices, lagrangian_hessian, lagrangian_sign_convention)
  • a Jacobian operator (performs Jacobian-vector products);
model.set_jacobian_operator(jacobian_operator)
  • a Jacobian-transposed operator (performs Jacobian-transposed-vector products);
model.set_jacobian_transposed_operator(jacobian_transposed_operator)
  • a Hessian operator (performs Hessian-vector products);
model.set_lagrangian_hessian_operator(lagrangian_hessian_operator, lagrangian_sign_convention)
  • user data of an arbitrary type;
model.set_user_data(user_data)
  • an initial primal point;
model.set_initial_primal_iterate(initial_primal_iterate)
  • an initial dual point.
model.set_initial_dual_iterate(initial_dual_iterate)

Each of these functions throws an exception upon failure.

Creating an instance of the Uno solver

Create an instance of the Uno solver with a simple function call:

uno_solver = unopy.UnoSolver()

Passing options to the Uno solver

Options can be passed to the Uno solver:

uno_solver.set_option("print_solution", True)

Uno mimics the state-of-the-art solvers filterSQP and IPOPT via presets:

uno_solver.set_preset("filtersqp")
# or
uno_solver.set_preset("ipopt")

Solving the model

The model can then be solved by Uno:

result = uno_solver.optimize(model)

Inspecting the result

To inspect the result of the optimization, read the attributes of the result object:

  • the optimization status (UNO_SUCCESS, UNO_ITERATION_LIMIT, UNO_TIME_LIMIT, UNO_EVALUATION_ERROR, UNO_ALGORITHMIC_ERROR): result.optimization_status
  • the solution status (UNO_NOT_OPTIMAL, UNO_FEASIBLE_KKT_POINT, UNO_FEASIBLE_FJ_POINT, UNO_INFEASIBLE_STATIONARY_POINT, UNO_FEASIBLE_SMALL_STEP, UNO_INFEASIBLE_SMALL_STEP, UNO_UNBOUNDED): result.solution_status
  • the objective value of the solution: result.solution_objective
  • the primal solution: result.primal_solution
  • the dual solution associated with the general constraints: result.constraint_dual_solution
  • the dual solution associated with the lower bounds: result.lower_bound_dual_solution
  • the dual solution associated with the upper bounds: result.upper_bound_dual_solution
  • the primal feasibility residual at the solution: result.solution_primal_feasibility
  • the stationarity residual at the solution: result.solution_stationarity
  • the complementarity residual at the solution: result.solution_complementarity
  • the number of (outer) iterations: result.number_iterations
  • the CPU time (in seconds): result.cpu_time
  • the number of objective evaluations: result.number_objective_evaluations
  • the number of constraint evaluations: result.number_constraint_evaluations
  • the number of objective gradient evaluations: result.number_objective_gradient_evaluations
  • the number of Jacobian evaluations: result.number_jacobian_evaluations
  • the number of Hessian evaluations: result.number_hessian_evaluations
  • the number of subproblems solved: result.number_subproblems_solved

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

unopy-0.1.0.tar.gz (28.1 MB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

unopy-0.1.0-cp39-cp39-musllinux_1_2_x86_64.whl (9.6 MB view details)

Uploaded CPython 3.9musllinux: musl 1.2+ x86-64

unopy-0.1.0-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (8.5 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

unopy-0.1.0-cp39-cp39-macosx_15_0_arm64.whl (9.3 MB view details)

Uploaded CPython 3.9macOS 15.0+ ARM64

unopy-0.1.0-cp38-cp38-musllinux_1_2_x86_64.whl (9.6 MB view details)

Uploaded CPython 3.8musllinux: musl 1.2+ x86-64

unopy-0.1.0-cp38-cp38-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (8.5 MB view details)

Uploaded CPython 3.8manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

unopy-0.1.0-cp38-cp38-macosx_15_0_arm64.whl (9.3 MB view details)

Uploaded CPython 3.8macOS 15.0+ ARM64

File details

Details for the file unopy-0.1.0.tar.gz.

File metadata

  • Download URL: unopy-0.1.0.tar.gz
  • Upload date:
  • Size: 28.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for unopy-0.1.0.tar.gz
Algorithm Hash digest
SHA256 74761f7aadbeb09e67f76e660c35d554165d3d677f4810d425e04695000f0d7f
MD5 59ef0d75f7272b1c799bddf931b715f4
BLAKE2b-256 7eb3cceda527a051b3c42bef77e185453fcb377a3272f0ca0f62d67541753c7e

See more details on using hashes here.

Provenance

The following attestation bundles were made for unopy-0.1.0.tar.gz:

Publisher: build-python-wheels.yml on cvanaret/Uno

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file unopy-0.1.0-cp39-cp39-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for unopy-0.1.0-cp39-cp39-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 d7d83393c29818294b70bdb6b3e1fbf344ca140e1930afd784a5edd54876af94
MD5 4aafd16e63bb61b3cb479359bd7e4df6
BLAKE2b-256 30f4e7ff6dcdcbf83d02eef22ed752596870e58f7d92888f12ef6a5d7eb9f00b

See more details on using hashes here.

Provenance

The following attestation bundles were made for unopy-0.1.0-cp39-cp39-musllinux_1_2_x86_64.whl:

Publisher: build-python-wheels.yml on cvanaret/Uno

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file unopy-0.1.0-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for unopy-0.1.0-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 777c975220ea501757c68a8515160218b15f2c3d983ffeb47c165d0f02850e3f
MD5 1a58ce1bf6e74dce817f8a14ee599b4e
BLAKE2b-256 76dc2e46d48a3a541b043bc9691f1d308858aa9615bf5a6ccb6978e3ca2d1221

See more details on using hashes here.

Provenance

The following attestation bundles were made for unopy-0.1.0-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: build-python-wheels.yml on cvanaret/Uno

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file unopy-0.1.0-cp39-cp39-macosx_15_0_arm64.whl.

File metadata

  • Download URL: unopy-0.1.0-cp39-cp39-macosx_15_0_arm64.whl
  • Upload date:
  • Size: 9.3 MB
  • Tags: CPython 3.9, macOS 15.0+ ARM64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for unopy-0.1.0-cp39-cp39-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 21a53c41ee08d3ce3d0158def348d8a505895694062a25d64d0d4f1bb1e323d5
MD5 e1bc13c88b02cc90df32f4d64bc7c5b7
BLAKE2b-256 7ebb13293a24775fd816918070eaa4bb7af17f49082e968727ba6b27beee1f0a

See more details on using hashes here.

Provenance

The following attestation bundles were made for unopy-0.1.0-cp39-cp39-macosx_15_0_arm64.whl:

Publisher: build-python-wheels.yml on cvanaret/Uno

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file unopy-0.1.0-cp38-cp38-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for unopy-0.1.0-cp38-cp38-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 cc6e5f904158b6a2c019560c4ceef47e6704bd6e6b3157c0b22c57540a6f0ae9
MD5 b20d5d060fd8a9485bc9b2280fa7e3dc
BLAKE2b-256 a365ecafc387cb614deb80bad0306652d6fb20138fcb7f017f08fa8d13ad192c

See more details on using hashes here.

Provenance

The following attestation bundles were made for unopy-0.1.0-cp38-cp38-musllinux_1_2_x86_64.whl:

Publisher: build-python-wheels.yml on cvanaret/Uno

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file unopy-0.1.0-cp38-cp38-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for unopy-0.1.0-cp38-cp38-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 6672d9984c18b9c8b1b3a5784ba0657b2e488e551fb3a22789c3e0cdade342e5
MD5 870b42e35b696405686db7686f138ef0
BLAKE2b-256 c09f7792ab6b97800d2d17a54c608f0d77f58c2edaafb1767295f42a92da2d59

See more details on using hashes here.

Provenance

The following attestation bundles were made for unopy-0.1.0-cp38-cp38-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: build-python-wheels.yml on cvanaret/Uno

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file unopy-0.1.0-cp38-cp38-macosx_15_0_arm64.whl.

File metadata

  • Download URL: unopy-0.1.0-cp38-cp38-macosx_15_0_arm64.whl
  • Upload date:
  • Size: 9.3 MB
  • Tags: CPython 3.8, macOS 15.0+ ARM64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for unopy-0.1.0-cp38-cp38-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 c6643090e2b4d5cb8f018d722185c26ff48305a18a033381fd2346233c2079d8
MD5 d8101c4d9cdf67e036649b16a46f4717
BLAKE2b-256 1693064049bdb8d86d815339f5443bae3603917c4941d6d3056812b87a7c77b1

See more details on using hashes here.

Provenance

The following attestation bundles were made for unopy-0.1.0-cp38-cp38-macosx_15_0_arm64.whl:

Publisher: build-python-wheels.yml on cvanaret/Uno

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page