linopy.solvers.cuOpt

linopy.solvers.cuOpt#

class linopy.solvers.cuOpt(model=None, io_api=None, options=<factory>, track_updates=False)#

Solver subclass for the NVIDIA cuOpt solver. cuOpt must be installed with working GPU support for usage. Install it with pip install "linopy[gpu]" (Linux only, CUDA 12 driver >= 525.60.13, compute capability >= 7.0).

The full list of solver options is documented at https://docs.nvidia.com/cuopt/ and can be listed at runtime with cuopt.linear_programming.solver_settings.get_solver_parameter_names(). Option names are lower-case and snake_case.

Some example options are:

  • method : 3 (Barrier) by default in linopy - 0 (Concurrent), 1 (PDLP) and 2 (DualSimplex) are alternatives. cuOpt’s own default of 0 crashes the process on repeated solves and is not used.

  • time_limit : inf by default.

  • log_to_console : True by default.

  • absolute_primal_tolerance, relative_primal_tolerance, … : 1e-4 by default.

\*\*solver_options

options for the given solver

Notes

Maximisation problems are handed to cuOpt as the equivalent minimisation, never via set_maximize(True): on that path cuOpt’s presolve returns negated duals for models it solves outright. The sign flip in _solve (objective, duals and MIP bound) is thus a pure sense conversion; no dual-convention fix-up is needed.

__init__(model=None, io_api=None, options=<factory>, track_updates=False)#

Methods

__init__([model, io_api, options, track_updates])

apply_update(diff, var_label_index, ...)

Apply an in-place ModelDiff to the built native model.

close()

Dispose the native solver model and env, releasing any held license.

from_model(model[, io_api, options, ...])

Instantiate and build the solver against model.

from_name(name[, model, io_api, options, ...])

Construct the solver subclass registered as name.

is_available()

Return True if this solver's package/binary is importable.

license_status()

Probe license/runtime availability.

runtime_features()

Features whose availability depends on the installed solver version or runtime environment.

safe_get_solution(status, func)

Get solution from function call, if status is unknown still try to run it.

solve([model, assign, ignore_dims, ...])

Run the prepared solver and return a Result.

solve_problem([model, problem_fn, ...])

Deprecated.

solve_problem_from_file(problem_fn[, ...])

Deprecated shim that caches problem_fn and runs via _run_file.

solve_problem_from_model(model[, ...])

Deprecated shim that builds via _build_direct and runs via _run_direct.

supported_features()

All features supported by this solver, static plus runtime.

supports(feature)

Check if this solver supports a given feature.

update(model[, apply, ignore_dims])

Diff model against the solver state and optionally apply it.

update_solver_model(model, **kwargs)

Attributes

accepted_io_apis

display_name

env

features

io_api

model

report

sense

snapshot

solution

solver_model

solver_name

solver_options

status

supports_persistent_update

supports_sign_update

track_updates

options