Skip to content

Built-in Algorithms

ScipAlgorithm

Bases: BaseAlgorithmSync

Classical exact optimization algorithm using SCIP (Solving Constraint Integer Programs).

This algorithm wraps the SCIP solver to provide exact solutions for optimization problems using classical branch-and-bound methods. It translates Luna quantum models to LP format, solves them with SCIP, and translates the results back.

Parameters:

  • max_runtime

    Defines the maximum runtime for the SCIP solver in seconds, defaults to 1 hour.

  • quiet_output

    Defines the verbosity of the SCIP solver output.

  • _logger

    Class-level logger for tracking algorithm execution.

Raises:

  • InfeasibleModelError: If the model has no feasible solution.
Requires

Install the 'pre-defined' extra: pip install luna-bench[pre-defined]

run(model: Model) -> Solution

Solve an optimization model using the SCIP classical solver.

Parameters:

  • model (Model) –

    The Luna optimization model to solve.

Returns:

  • Solution

    Solution object containing the optimal variable assignments, objective value, and timing information.

Raises:

  • InfeasibleModelError

    If SCIP determines the model is infeasible.

Examples:

>>> scip_algo = ScipAlgorithm()
>>> solution = scip_algo.run(my_model)

FakeAlgorithm

Bases: BaseAlgorithmSync

Fake algorithm that does nothing.

This algorithm is used in the development process.

run(model: Model) -> Solution

Run a fake algorithm, which will sleep for a random amount of time.