# Optimization Problem¶

template<typename Alloc>
class BasicProblem : public ExprFactory, public SuffixManager

An optimization problem.

Public Types

typedef Range<Variable> VarRange

A range of variables.

typedef Range<Objective> ObjRange

A range of objectives.

typedef Range<AlgebraicCon> AlgebraicConRange

A range of algebraic constraints.

typedef Range<LogicalCon> LogicalConRange

A range of logical constraints.

Public Functions

BasicProblem()

Constructs an empty optimization problem.

int num_vars() const

Returns the number of variables.

int num_objs() const

Returns the number of objectives.

int num_algebraic_cons() const

Returns the number of algebraic constraints.

int num_logical_cons() const

Returns the number of logical constraints.

int num_common_exprs() const

Returns the number of common expressions.

VarRange vars() const

Returns a range representing all variables in this optimization problem. It can be used for iterating over variables:

for (auto var: problem.vars()) {
...
}


ObjRange objs() const

Returns a range representing all objectives in this optimization problem. It can be used for iterating over objectives:

for (auto obj: problem.objs()) {
...
}


AlgebraicConRange algebraic_cons() const

Returns a range representing all algebraic constraints in this optimization problem. It can be used for iterating over algebraic constraints:

for (auto con: problem.algebraic_cons()) {
...
}


LogicalConRange logical_cons() const

Returns a range representing all logical constraints in this optimization problem. It can be used for iterating over logical constraints:

for (auto con: problem.logical_cons()) {
...
}


template<typename T>
class Range

A pair of iterators to problem elements.

Public Functions

template<>
iterator begin() const

Returns an iterator to the first element in the range.

template<>
iterator end() const

Returns an iterator to the element following the last element in the range.

An attempt to access this element will result in assertion failure if assertions are enabled and undefined behavior otherwise.