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.

Classes

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

Bases: picos.containers.RecordTree

Statistics on an optimization problem.

__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[source]

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[source]

Whether an integral variable type is present.

property nonconvex_quadratic_objective[source]

Whether the problem has a nonconvex quadratic objective.

property nondefault_options[source]

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[source]

An Options object.

Warning

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

property size[source]

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

property variables[source]

A dictionary mapping detailed variable types to their quantity.

class picos.modeling.footprint.Specification(objectives=None, variables=None, constraints=None, nondefault_options=None)[source]

Bases: object

Representation of a mathematical class of optimization problems.

__init__(objectives=None, variables=None, constraints=None, nondefault_options=None)[source]

Create a specification from the given features.

The token None means no requirement.

mismatch_reason(footprint)[source]

Give one string reason why the given footprint does not match.