picos.modeling.footprint

Optimization problem description classes.

This module implements a footprint of a single problem, storing number and types of expressions and constraints, and the specification of a problem class.

Outline

Classes

Footprint

Statistics on an optimization problem.

Specification

Representation of a mathematical class of optimization problems.

Classes

Footprint

class picos.modeling.footprint.Footprint(recordsOrDict)[source]

Bases: picos.containers.RecordTree

Statistics on an optimization problem.

Subtree comparison (<<) can be used to check if a specific problem represented by a Footprint instance is contained in a problem class represented by a Specification instance.

__init__(recordsOrDict)[source]

Construct a Footprint from raw data.

See picos.containers.RecordTree.__init__. The addValues argument is fixed; only variable and constraint paths are added.

classmethod from_problem(problem)[source]

Create a footprint from a problem instance.

classmethod from_types(obj_dir, obj_func, vars=[], cons=[], nd_opts={})[source]

Create a footprint from collections of detailed types.

Parameters
  • obj_dir (str) – Objective direction.

  • obj_func – Detailed objective function type.

  • nd_opts (list(str)) – A dictionary mapping option names to nondefault values.

Parm list(tuple) vars

A list of pairs of detailed variable type and occurence count.

Parm list(tuple) cons

A list of pairs of detailed constraint type and occurence count.

updated(recordsOrDict)[source]

Override updated.

This method, just like __init__, does not take the additional addValues argument.

with_extra_options(**extra_options)[source]

Return a copy with additional solution search options applied.

property constraints

A dictionary mapping detailed constraint types to their quantity.

property continuous

Whether no integral variable type is present.

property cost

A very rough measure on how expensive solving such a problem is.

This is logarithmic in the estimated size of the constraint matrix.

property direction

Objective function optimization direction.

property integer

Whether an integral variable type is present.

property nonconvex_quadratic_objective

Whether the problem has a nonconvex quadratic objective.

property nondefault_options

A dictionary mapping option names to their nondefault values.

Warning

This property is cached for performance reasons, do not modify any mutable option value (make a deep copy instead)!

property objective

Detailed type of the objective function.

property options

An Options object.

Warning

This property is cached for performance reasons, do not modify the returned object (make a copy instead)!

property size

Return the estimated size of the (dense) scalar constraint matrix.

property variables

A dictionary mapping detailed variable types to their quantity.

Specification

class picos.modeling.footprint.Specification(recordsOrDict)[source]

Bases: picos.containers.RecordTree

Representation of a mathematical class of optimization problems.

Subtree comparison (<<) can be used to check if a specific problem represented by a Footprint instance is contained in a problem class represented by a Specification instance.

__init__(recordsOrDict)[source]

Construct a Specification from raw data.

See picos.containers.RecordTree.__init__.

classmethod compile(directions=(), objectives=(), variables=(), constraints=(), nondefault_options=<class 'picos.containers.RecordTree.ALL'>)[source]

Create a specification from the given features.