picos.modeling.strategy

Optimization problem solution strategy search.

Exceptions

exception picos.modeling.strategy.NoStrategyFound[source]

Bases: RuntimeError

No solution strategy found.

Raised when no viable combination of reformulations and solver to tackle the problem could be found.

Classes

class picos.modeling.strategy.Strategy(problem, solver, *reforms)[source]

Bases: object

Optimization problem solution strategy.

__init__(problem, solver, *reforms)[source]

Construct a Strategy.

Parameters
  • problem (Problem) – The first step in the solution pipeline; the problem to be solved.

  • solver (type) – The last step in the solution pipeline; the solver class to be used.

  • reforms (list(Reformulation)) – Intermediate steps in the pipeline; reformulations to be applied. May not include ExtraOptions which is automatically made the first reformulation.

execute(**extra_options)[source]

Execute the solution strategy.

Parameters

extra_options – A keyword parameter sequence of additional options (in addition to those of the problem) to use for this search.

Returns

Solution to the problem.

classmethod from_problem(problem, **extra_options)[source]

Create a solution strategy for the given problem.

Parameters
  • problem (Problem) – The optimization problem to search a strategy for.

  • extra_options – A keyword parameter sequence of additional options (in addition to those of the problem) to assume used.

valid(**extra_options)[source]

Whether the solution strategy can be executed.

Parameters

extra_options – A keyword parameter sequence of additional options (in addition to those of the problem) to assume used.

property problem

The problem to be solved.

property reforms

All reformulations in use.

This includes the implicit ExtraOptions.

property solver

The solver instance in use.