PPL  1.2
Parma_Polyhedra_Library::PIP_Problem Class Reference

A Parametric Integer (linear) Programming problem. More...

#include <PIP_Problem_defs.hh>

Collaboration diagram for Parma_Polyhedra_Library::PIP_Problem:

Public Types

enum  Control_Parameter_Name { CUTTING_STRATEGY, PIVOT_ROW_STRATEGY, CONTROL_PARAMETER_NAME_SIZE }
 Possible names for PIP_Problem control parameters. More...
 
enum  Control_Parameter_Value {
  CUTTING_STRATEGY_FIRST, CUTTING_STRATEGY_DEEPEST, CUTTING_STRATEGY_ALL, PIVOT_ROW_STRATEGY_FIRST,
  PIVOT_ROW_STRATEGY_MAX_COLUMN, CONTROL_PARAMETER_VALUE_SIZE
}
 Possible values for PIP_Problem control parameters. More...
 
typedef Constraint_Sequence::const_iterator const_iterator
 A type alias for the read-only iterator on the constraints defining the feasible region. More...
 

Public Member Functions

 PIP_Problem (dimension_type dim=0)
 Builds a trivial PIP problem. More...
 
template<typename In >
 PIP_Problem (dimension_type dim, In first, In last, const Variables_Set &p_vars)
 Builds a PIP problem having space dimension dim from the sequence of constraints in the range $[\mathrm{first}, \mathrm{last})$; those dimensions whose indices occur in p_vars are interpreted as parameters. More...
 
 PIP_Problem (const PIP_Problem &y)
 Ordinary copy-constructor. More...
 
 ~PIP_Problem ()
 Destructor. More...
 
PIP_Problemoperator= (const PIP_Problem &y)
 Assignment operator. More...
 
dimension_type space_dimension () const
 Returns the space dimension of the PIP problem. More...
 
const Variables_Setparameter_space_dimensions () const
 Returns a set containing all the variables' indexes representing the parameters of the PIP problem. More...
 
const_iterator constraints_begin () const
 Returns a read-only iterator to the first constraint defining the feasible region. More...
 
const_iterator constraints_end () const
 Returns a past-the-end read-only iterator to the sequence of constraints defining the feasible region. More...
 
void clear ()
 Resets *this to be equal to the trivial PIP problem. More...
 
void add_space_dimensions_and_embed (dimension_type m_vars, dimension_type m_params)
 Adds m_vars + m_params new space dimensions and embeds the old PIP problem in the new vector space. More...
 
void add_to_parameter_space_dimensions (const Variables_Set &p_vars)
 Sets the space dimensions whose indexes which are in set p_vars to be parameter space dimensions. More...
 
void add_constraint (const Constraint &c)
 Adds a copy of constraint c to the PIP problem. More...
 
void add_constraints (const Constraint_System &cs)
 Adds a copy of the constraints in cs to the PIP problem. More...
 
bool is_satisfiable () const
 Checks satisfiability of *this. More...
 
PIP_Problem_Status solve () const
 Optimizes the PIP problem. More...
 
PIP_Tree solution () const
 Returns a feasible solution for *this, if it exists. More...
 
PIP_Tree optimizing_solution () const
 Returns an optimizing solution for *this, if it exists. More...
 
bool OK () const
 Checks if all the invariants are satisfied. More...
 
void print_solution (std::ostream &s, int indent=0) const
 Prints on s the solution computed for *this. More...
 
void ascii_dump () const
 Writes to std::cerr an ASCII representation of *this. More...
 
void ascii_dump (std::ostream &s) const
 Writes to s an ASCII representation of *this. More...
 
void print () const
 Prints *this to std::cerr using operator<<. More...
 
bool ascii_load (std::istream &s)
 Loads from s an ASCII representation (as produced by ascii_dump(std::ostream&) const) and sets *this accordingly. Returns true if successful, false otherwise. More...
 
memory_size_type total_memory_in_bytes () const
 Returns the total size in bytes of the memory occupied by *this. More...
 
memory_size_type external_memory_in_bytes () const
 Returns the size in bytes of the memory managed by *this. More...
 
void m_swap (PIP_Problem &y)
 Swaps *this with y. More...
 
Control_Parameter_Value get_control_parameter (Control_Parameter_Name name) const
 Returns the value of control parameter name. More...
 
void set_control_parameter (Control_Parameter_Value value)
 Sets control parameter value. More...
 
void set_big_parameter_dimension (dimension_type big_dim)
 Sets the dimension for the big parameter to big_dim. More...
 
dimension_type get_big_parameter_dimension () const
 Returns the space dimension for the big parameter. More...
 

Static Public Member Functions

static dimension_type max_space_dimension ()
 Returns the maximum space dimension a PIP_Problem can handle. More...
 

Private Types

enum  Status { UNSATISFIABLE, OPTIMIZED, PARTIALLY_SATISFIABLE }
 An enumerated type describing the internal status of the PIP problem. More...
 
typedef std::vector< ConstraintConstraint_Sequence
 A type alias for a sequence of constraints. More...
 
typedef Sparse_Row Row
 

Private Member Functions

void control_parameters_init ()
 Initializes the control parameters with default values. More...
 
void control_parameters_copy (const PIP_Problem &y)
 Copies the control parameters from problem object y. More...
 

Private Attributes

dimension_type external_space_dim
 The dimension of the vector space. More...
 
dimension_type internal_space_dim
 The space dimension of the current (partial) solution of the PIP problem; it may be smaller than external_space_dim. More...
 
Status status
 The internal state of the MIP problem. More...
 
PIP_Tree_Nodecurrent_solution
 The current solution decision tree. More...
 
Constraint_Sequence input_cs
 The sequence of constraints describing the feasible region. More...
 
dimension_type first_pending_constraint
 The first index of `input_cs' containing a pending constraint. More...
 
Variables_Set parameters
 A set containing all the indices of space dimensions that are interpreted as problem parameters. More...
 
Matrix< Rowinitial_context
 The initial context. More...
 
Control_Parameter_Value control_parameters [CONTROL_PARAMETER_NAME_SIZE]
 The control parameters for the problem object. More...
 
dimension_type big_parameter_dimension
 The dimension for the big parameter, or not_a_dimension() if not set. More...
 

Friends

class PIP_Solution_Node
 

Related Functions

(Note that these are not member functions.)

std::ostream & operator<< (std::ostream &s, const PIP_Problem &pip)
 
std::ostream & operator<< (std::ostream &s, const PIP_Problem &pip)
 Output operator. More...
 
void swap (PIP_Problem &x, PIP_Problem &y)
 Swaps x with y. More...
 
void swap (PIP_Problem &x, PIP_Problem &y)
 

Detailed Description

A Parametric Integer (linear) Programming problem.

An object of this class encodes a parametric integer (linear) programming problem. The PIP problem is specified by providing:

  • the dimension of the vector space;
  • the subset of those dimensions of the vector space that are interpreted as integer parameters (the other space dimensions are interpreted as non-parameter integer variables);
  • a finite set of linear equality and (strict or non-strict) inequality constraints involving variables and/or parameters; these constraints are used to define:
    • the feasible region, if they involve one or more problem variable (and maybe some parameters);
    • the initial context, if they only involve the parameters;
  • optionally, the so-called big parameter, i.e., a problem parameter to be considered arbitrarily big.

Note that all problem variables and problem parameters are assumed to take non-negative integer values, so that there is no need to specify non-negativity constraints.

The class provides support for the (incremental) solution of the PIP problem based on variations of the revised simplex method and on Gomory cut generation techniques.

The solution for a PIP problem is the lexicographic minimum of the integer points of the feasible region, expressed in terms of the parameters. As the problem to be solved only involves non-negative variables and parameters, the problem will always be either unfeasible or optimizable.

As the feasibility and the solution value of a PIP problem depend on the values of the parameters, the solution is a binary decision tree, dividing the context parameter set into subsets. The tree nodes are of two kinds:

  • Decision nodes. These are internal tree nodes encoding one or more linear tests on the parameters; if all the tests are satisfied, then the solution is the node's true child; otherwise, the solution is the node's false child;
  • Solution nodes. These are leaf nodes in the tree, encoding the solution of the problem in the current context subset, where each variable is defined in terms of a linear expression of the parameters. Solution nodes also optionally embed a set of parameter constraints: if all these constraints are satisfied, the solution is described by the node, otherwise the problem has no solution.

It may happen that a decision node has no false child. This means that there is no solution if at least one of the corresponding constraints is not satisfied. Decision nodes having two or more linear tests on the parameters cannot have a false child. Decision nodes always have a true child.

Both kinds of tree nodes may also contain the definition of extra parameters which are artificially introduced by the solver to enforce an integral solution. Such artificial parameters are defined by the integer division of a linear expression on the parameters by an integer coefficient.

By exploiting the incremental nature of the solver, it is possible to reuse part of the computational work already done when solving variants of a given PIP_Problem: currently, incremental resolution supports the addition of space dimensions, the addition of parameters and the addition of constraints.

Example problem
An example PIP problem can be defined the following:
3*j >= -2*i+8
j <= 4*i - 4
i <= n
j <= m
where i and j are the problem variables and n and m are the problem parameters. This problem can be optimized; the resulting solution tree may be represented as follows:
if 7*n >= 10 then
  if 7*m >= 12 then
    {i = 2 ; j = 2}
  else
    Parameter P = (m) div 2
    if 2*n + 3*m >= 8 then
      {i = -m - P + 4 ; j = m}
    else
      _|_
else
  _|_
The solution tree starts with a decision node depending on the context constraint 7*n >= 10. If this constraint is satisfied by the values assigned to the problem parameters, then the (textually first) then branch is taken, reaching the true child of the root node (which in this case is another decision node); otherwise, the (textually last) else branch is taken, for which there is no corresponding false child.
The $\perp$ notation, also called bottom, denotes the lexicographic minimum of an empty set of solutions, here meaning the corresponding subproblem is unfeasible.
Notice that a tree node may introduce new (non-problem) parameters, as is the case for parameter P in the (textually first) else branch above. These artificial parameters are only meaningful inside the subtree where they are defined and are used to define the parametric values of the problem variables in solution nodes (e.g., the {i,j} vector in the textually third then branch).
Context restriction
The above solution is correct in an unrestricted initial context, meaning all possible values are allowed for the parameters. If we restrict the context with the following parameter inequalities:
m >= n
n >= 5
then the resulting optimizing tree will be a simple solution node:
{i = 2 ; j = 2}
Creating the PIP_Problem object
The PIP_Problem object corresponding to the above example can be created as follows:
Variable i(0);
Variable j(1);
Variable n(2);
Variable m(3);
Variables_Set params(n, m);
Constraint_System cs;
cs.insert(3*j >= -2*i+8);
cs.insert(j <= 4*i - 4);
cs.insert(j <= m);
cs.insert(i <= n);
PIP_Problem pip(cs.space_dimension(), cs.begin(), cs.end(), params);
If you want to restrict the initial context, simply add the parameter constraints the same way as for normal constraints.
cs.insert(m >= n);
cs.insert(n >= 5);
Solving the problem
Once the PIP_Problem object has been created, you can start the resolution of the problem by calling the solve() method:
PIP_Problem_Status status = pip.solve();
where the returned status indicates if the problem has been optimized or if it is unfeasible for any possible configuration of the parameter values. The resolution process is also started if an attempt is made to get its solution, as follows:
const PIP_Tree_Node* node = pip.solution();
In this case, an unfeasible problem will result in an empty solution tree, i.e., assigning a null pointer to node.
Printing the solution tree
A previously computed solution tree may be printed as follows:
pip.print_solution(std::cout);
This will produce the following output (note: variables and parameters are printed according to the default output function; see Variable::set_output_function):
if 7*C >= 10 then
  if 7*D >= 12 then
    {2 ; 2}
  else
    Parameter E = (D) div 2
    if 2*C + 3*D >= 8 then
      {-D - E + 4 ; D}
    else
      _|_
else
  _|_
Spanning the solution tree
A parameter assignment for a PIP problem binds each of the problem parameters to a non-negative integer value. After fixing a parameter assignment, the ``spanning'' of the PIP problem solution tree refers to the process whereby the solution tree is navigated, starting from the root node: the value of artificial parameters is computed according to the parameter assignment and the node's constraints are evaluated, thereby descending in either the true or the false subtree of decision nodes and eventually reaching a solution node or a bottom node. If a solution node is found, each of the problem variables is provided with a parametric expression, which can be evaluated to a fixed value using the given parameter assignment and the computed values for artificial parameters.
The coding of the spanning process can be done as follows. First, the root of the PIP solution tree is retrieved:
const PIP_Tree_Node* node = pip.solution();
If node represents an unfeasible solution (i.e., $\perp$), its value will be 0. For a non-null tree node, the virtual methods PIP_Tree_Node::as_decision() and PIP_Tree_Node::as_solution() can be used to check whether the node is a decision or a solution node:
const PIP_Solution_Node* sol = node->as_solution();
if (sol != 0) {
// The node is a solution node
...
}
else {
// The node is a decision node
const PIP_Decision_Node* dec = node->as_decision();
...
}
The true (resp., false) child node of a Decision Node may be accessed by using method PIP_Decision_Node::child_node(bool), passing true (resp., false) as the input argument.
Artificial parameters
A PIP_Tree_Node::Artificial_Parameter object represents the result of the integer division of a Linear_Expression (on the other parameters, including the previously-defined artificials) by an integer denominator (a Coefficient object). The dimensions of the artificial parameters (if any) in a tree node have consecutive indices starting from dim+1, where the value of dim is computed as follows:
  • for the tree root node, dim is the space dimension of the PIP_Problem;
  • for any other node of the tree, it is recursively obtained by adding the value of dim computed for the parent node to the number of artificial parameters defined in the parent node.
Since the numbering of dimensions for artificial parameters follows the rule above, the addition of new problem variables and/or new problem parameters to an already solved PIP_Problem object (as done when incrementally solving a problem) will result in the systematic renumbering of all the existing artificial parameters.
Node constraints
All kind of tree nodes can contain context constraints. Decision nodes always contain at least one of them. The node's local constraint system can be obtained using method PIP_Tree_Node::constraints. These constraints only involve parameters, including both the problem parameters and the artificial parameters that have been defined in nodes occurring on the path from the root node to the current node. The meaning of these constraints is as follows:
  • On a decision node, if all tests in the constraints are true, then the solution is the true child; otherwise it is the false child.
  • On a solution node, if the (possibly empty) system of constraints evaluates to true for a given parameter assignment, then the solution is described by the node; otherwise the solution is $\perp$ (i.e., the problem is unfeasible for that parameter assignment).
Getting the optimal values for the variables
After spanning the solution tree using the given parameter assignment, if a solution node has been reached, then it is possible to retrieve the parametric expression for each of the problem variables using method PIP_Solution_Node::parametric_values. The retrieved expression will be defined in terms of all the parameters (problem parameters and artificial parameters defined along the path).
Solving maximization problems
You can solve a lexicographic maximization problem by reformulating its constraints using variable substitution. Proceed the following steps:
  • Create a big parameter (see PIP_Problem::set_big_parameter_dimension), which we will call $M$.
  • Reformulate each of the maximization problem constraints by substituting each $x_i$ variable with an expression of the form $M-x'_i$, where the $x'_i$ variables are positive variables to be minimized.
  • Solve the lexicographic minimum for the $x'$ variable vector.
  • In the solution expressions, the values of the $x'$ variables will be expressed in the form: $x'_i = M-x_i$. To get back the value of the expression of each $x_i$ variable, just apply the formula: $x_i = M-x'_i$.
Note that if the resulting expression of one of the $x'_i$ variables is not in the $x'_i = M-x_i$ form, this means that the sign-unrestricted problem is unbounded.
You can choose to maximize only a subset of the variables while minimizing the other variables. In that case, just apply the variable substitution method on the variables you want to be maximized. The variable optimization priority will still be in lexicographic order.
Example: consider you want to find the lexicographic maximum of the $(x,y)$ vector, under the constraints:

\[\left\{\begin{array}{l} y \geq 2x - 4\\ y \leq -x + p \end{array}\right.\]

where $p$ is a parameter.
After variable substitution, the constraints become:

\[\left\{\begin{array}{l} M - y \geq 2M - 2x - 4\\ M - y \leq -M + x + p \end{array}\right.\]

The code for creating the corresponding problem object is the following:
Variable x(0);
Variable y(1);
Variable p(2);
Variable M(3);
Variables_Set params(p, M);
Constraint_System cs;
cs.insert(M - y >= 2*M - 2*x - 4);
cs.insert(M - y <= -M + x + p);
PIP_Problem pip(cs.space_dimension(), cs.begin(), cs.end(), params);
pip.set_big_parameter_dimension(3); // M is the big parameter
Solving the problem provides the following solution:
Parameter E = (C + 1) div 3
{D - E - 1 ; -C + D + E + 1}
Under the notations above, the solution is:

\[ \left\{\begin{array}{l} x' = M - \left\lfloor\frac{p+1}{3}\right\rfloor - 1 \\ y' = M - p + \left\lfloor\frac{p+1}{3}\right\rfloor + 1 \end{array}\right. \]

Performing substitution again provides us with the values of the original variables:

\[ \left\{\begin{array}{l} x = \left\lfloor\frac{p+1}{3}\right\rfloor + 1 \\ y = p - \left\lfloor\frac{p+1}{3}\right\rfloor - 1 \end{array}\right. \]

Allowing variables to be arbitrarily signed
You can deal with arbitrarily signed variables by reformulating the constraints using variable substitution. Proceed the following steps:
  • Create a big parameter (see PIP_Problem::set_big_parameter_dimension), which we will call $M$.
  • Reformulate each of the maximization problem constraints by substituting each $x_i$ variable with an expression of the form $x'_i-M$, where the $x'_i$ variables are positive.
  • Solve the lexicographic minimum for the $x'$ variable vector.
  • The solution expression can be read in the form:
  • In the solution expressions, the values of the $x'$ variables will be expressed in the form: $x'_i = x_i+M$. To get back the value of the expression of each signed $x_i$ variable, just apply the formula: $x_i = x'_i-M$.
Note that if the resulting expression of one of the $x'_i$ variables is not in the $x'_i = x_i+M$ form, this means that the sign-unrestricted problem is unbounded.
You can choose to define only a subset of the variables to be sign-unrestricted. In that case, just apply the variable substitution method on the variables you want to be sign-unrestricted.
Example: consider you want to find the lexicographic minimum of the $(x,y)$ vector, where the $x$ and $y$ variables are sign-unrestricted, under the constraints:

\[\left\{\begin{array}{l} y \geq -2x - 4\\ 2y \leq x + 2p \end{array}\right.\]

where $p$ is a parameter.
After variable substitution, the constraints become:

\[\left\{\begin{array}{l} y' - M \geq -2x' + 2M - 4\\ 2y' - 2M \leq x' - M + 2p \end{array}\right.\]

The code for creating the corresponding problem object is the following:
Variable x(0);
Variable y(1);
Variable p(2);
Variable M(3);
Variables_Set params(p, M);
Constraint_System cs;
cs.insert(y - M >= -2*x + 2*M - 4);
cs.insert(2*y - 2*M <= x - M + 2*p);
PIP_Problem pip(cs.space_dimension(), cs.begin(), cs.end(), params);
pip.set_big_parameter_dimension(3); // M is the big parameter
Solving the problem provides the following solution:
Parameter E = (2*C + 3) div 5
{D - E - 1 ; D + 2*E - 2}
Under the notations above, the solution is:

\[ \left\{\begin{array}{l} x' = M - \left\lfloor\frac{2p+3}{5}\right\rfloor - 1 \\ y' = M + 2\left\lfloor\frac{2p+3}{5}\right\rfloor - 2 \end{array}\right. \]

Performing substitution again provides us with the values of the original variables:

\[ \left\{\begin{array}{l} x = -\left\lfloor\frac{2p+3}{5}\right\rfloor - 1 \\ y = 2\left\lfloor\frac{2p+3}{5}\right\rfloor - 2 \end{array}\right. \]

Allowing parameters to be arbitrarily signed
You can consider a parameter $p$ arbitrarily signed by replacing $p$ with $p^+-p^-$, where both $p^+$ and $p^-$ are positive parameters. To represent a set of arbitrarily signed parameters, replace each parameter $p_i$ with $p^+_i-p^-$, where $-p^-$ is the minimum negative value of all parameters.
Minimizing a linear cost function
Lexicographic solving can be used to find the parametric minimum of a linear cost function.
Suppose the variables are named $x_1, x_2, \dots, x_n$, and the parameters $p_1, p_2, \dots, p_m$. You can minimize a linear cost function $f(x_2, \dots, x_n, p_1, \dots, p_m)$ by simply adding the constraint $x_1 \geq f(x_2, \dots, x_n, p_1, \dots, p_m)$ to the constraint system. As lexicographic minimization ensures $x_1$ is minimized in priority, and because $x_1$ is forced by a constraint to be superior or equal to the cost function, optimal solutions of the problem necessarily ensure that the solution value of $x_1$ is the optimal value of the cost function.

Definition at line 493 of file PIP_Problem_defs.hh.

Member Typedef Documentation

typedef Constraint_Sequence::const_iterator Parma_Polyhedra_Library::PIP_Problem::const_iterator

A type alias for the read-only iterator on the constraints defining the feasible region.

Definition at line 572 of file PIP_Problem_defs.hh.

A type alias for a sequence of constraints.

Definition at line 565 of file PIP_Problem_defs.hh.

Definition at line 805 of file PIP_Problem_defs.hh.

Constructor & Destructor Documentation

Parma_Polyhedra_Library::PIP_Problem::PIP_Problem ( dimension_type  dim = 0)
explicit

Builds a trivial PIP problem.

A trivial PIP problem requires to compute the lexicographic minimum on a vector space under no constraints and with no parameters: due to the implicit non-negativity constraints, the origin of the vector space is an optimal solution.

Parameters
dimThe dimension of the vector space enclosing *this (optional argument with default value $0$).
Exceptions
std::length_errorThrown if dim exceeds max_space_dimension().

Definition at line 50 of file PIP_Problem.cc.

References control_parameters_init(), max_space_dimension(), and OK().

51  : external_space_dim(dim),
55  input_cs(),
57  parameters(),
60  // Check for space dimension overflow.
61  if (dim > max_space_dimension()) {
62  throw std::length_error("PPL::PIP_Problem::PIP_Problem(dim):\n"
63  "dim exceeds the maximum allowed "
64  "space dimension.");
65  }
67  PPL_ASSERT(OK());
68 }
dimension_type internal_space_dim
The space dimension of the current (partial) solution of the PIP problem; it may be smaller than exte...
static dimension_type max_space_dimension()
Returns the maximum space dimension a PIP_Problem can handle.
Variables_Set parameters
A set containing all the indices of space dimensions that are interpreted as problem parameters...
dimension_type not_a_dimension()
Returns a value that does not designate a valid dimension.
dimension_type external_space_dim
The dimension of the vector space.
PIP_Tree_Node * current_solution
The current solution decision tree.
bool OK() const
Checks if all the invariants are satisfied.
Definition: PIP_Problem.cc:277
void control_parameters_init()
Initializes the control parameters with default values.
Definition: PIP_Problem.cc:93
Constraint_Sequence input_cs
The sequence of constraints describing the feasible region.
dimension_type first_pending_constraint
The first index of `input_cs' containing a pending constraint.
Status status
The internal state of the MIP problem.
The feasible region of the PIP problem has been changed by adding new variables, parameters or constr...
dimension_type big_parameter_dimension
The dimension for the big parameter, or not_a_dimension() if not set.
Matrix< Row > initial_context
The initial context.
template<typename In >
Parma_Polyhedra_Library::PIP_Problem::PIP_Problem ( dimension_type  dim,
In  first,
In  last,
const Variables_Set p_vars 
)

Builds a PIP problem having space dimension dim from the sequence of constraints in the range $[\mathrm{first}, \mathrm{last})$; those dimensions whose indices occur in p_vars are interpreted as parameters.

Parameters
dimThe dimension of the vector space (variables and parameters) enclosing *this.
firstAn input iterator to the start of the sequence of constraints.
lastA past-the-end input iterator to the sequence of constraints.
p_varsThe set of variables' indexes that are interpreted as parameters.
Exceptions
std::length_errorThrown if dim exceeds max_space_dimension().
std::invalid_argumentThrown if the space dimension of a constraint in the sequence (resp., the parameter variables) is strictly greater than dim.

Definition at line 32 of file PIP_Problem_templates.hh.

References control_parameters_init(), external_space_dim, input_cs, max_space_dimension(), OK(), and Parma_Polyhedra_Library::Variables_Set::space_dimension().

35  : external_space_dim(dim),
39  input_cs(),
41  parameters(p_vars),
44  // Check that integer Variables_Set does not exceed the space dimension
45  // of the problem.
46  if (p_vars.space_dimension() > external_space_dim) {
47  std::ostringstream s;
48  s << "PPL::PIP_Problem::PIP_Problem(dim, first, last, p_vars):\n"
49  << "dim == " << external_space_dim
50  << " and p_vars.space_dimension() == "
51  << p_vars.space_dimension()
52  << " are dimension incompatible.";
53  throw std::invalid_argument(s.str());
54  }
55 
56  // Check for space dimension overflow.
57  if (dim > max_space_dimension()) {
58  throw std::length_error("PPL::PIP_Problem::"
59  "PIP_Problem(dim, first, last, p_vars):\n"
60  "dim exceeds the maximum allowed "
61  "space dimension.");
62  }
63  // Check the constraints.
64  for (In i = first; i != last; ++i) {
65  if (i->space_dimension() > dim) {
66  std::ostringstream s;
67  s << "PPL::PIP_Problem::"
68  << "PIP_Problem(dim, first, last, p_vars):\n"
69  << "range [first, last) contains a constraint having space "
70  << "dimension == " << i->space_dimension()
71  << " that exceeds this->space_dimension == " << dim << ".";
72  throw std::invalid_argument(s.str());
73  }
74  input_cs.push_back(*i);
75  }
77  PPL_ASSERT(OK());
78 }
dimension_type internal_space_dim
The space dimension of the current (partial) solution of the PIP problem; it may be smaller than exte...
static dimension_type max_space_dimension()
Returns the maximum space dimension a PIP_Problem can handle.
Variables_Set parameters
A set containing all the indices of space dimensions that are interpreted as problem parameters...
dimension_type not_a_dimension()
Returns a value that does not designate a valid dimension.
dimension_type external_space_dim
The dimension of the vector space.
PIP_Tree_Node * current_solution
The current solution decision tree.
bool OK() const
Checks if all the invariants are satisfied.
Definition: PIP_Problem.cc:277
void control_parameters_init()
Initializes the control parameters with default values.
Definition: PIP_Problem.cc:93
Constraint_Sequence input_cs
The sequence of constraints describing the feasible region.
dimension_type first_pending_constraint
The first index of `input_cs' containing a pending constraint.
Status status
The internal state of the MIP problem.
The feasible region of the PIP problem has been changed by adding new variables, parameters or constr...
dimension_type big_parameter_dimension
The dimension for the big parameter, or not_a_dimension() if not set.
Matrix< Row > initial_context
The initial context.
Parma_Polyhedra_Library::PIP_Problem::PIP_Problem ( const PIP_Problem y)

Ordinary copy-constructor.

Definition at line 70 of file PIP_Problem.cc.

References Parma_Polyhedra_Library::PIP_Tree_Node::clone(), control_parameters_copy(), current_solution, OK(), and Parma_Polyhedra_Library::PIP_Tree_Node::set_owner().

71  : external_space_dim(y.external_space_dim),
72  internal_space_dim(y.internal_space_dim),
73  status(y.status),
75  input_cs(y.input_cs),
76  first_pending_constraint(y.first_pending_constraint),
77  parameters(y.parameters),
78  initial_context(y.initial_context),
79  big_parameter_dimension(y.big_parameter_dimension) {
80  if (y.current_solution != 0) {
81  current_solution = y.current_solution->clone();
83  }
85  PPL_ASSERT(OK());
86 }
dimension_type internal_space_dim
The space dimension of the current (partial) solution of the PIP problem; it may be smaller than exte...
Variables_Set parameters
A set containing all the indices of space dimensions that are interpreted as problem parameters...
virtual void set_owner(const PIP_Problem *owner)=0
Sets the pointer to the PIP_Problem owning object.
dimension_type external_space_dim
The dimension of the vector space.
PIP_Tree_Node * current_solution
The current solution decision tree.
bool OK() const
Checks if all the invariants are satisfied.
Definition: PIP_Problem.cc:277
virtual PIP_Tree_Node * clone() const =0
Returns a pointer to a dynamically-allocated copy of *this.
Constraint_Sequence input_cs
The sequence of constraints describing the feasible region.
dimension_type first_pending_constraint
The first index of `input_cs' containing a pending constraint.
void control_parameters_copy(const PIP_Problem &y)
Copies the control parameters from problem object y.
Definition: PIP_Problem.cc:99
Status status
The internal state of the MIP problem.
dimension_type big_parameter_dimension
The dimension for the big parameter, or not_a_dimension() if not set.
Matrix< Row > initial_context
The initial context.
Parma_Polyhedra_Library::PIP_Problem::~PIP_Problem ( )

Destructor.

Definition at line 88 of file PIP_Problem.cc.

88  {
89  delete current_solution;
90 }
PIP_Tree_Node * current_solution
The current solution decision tree.

Member Function Documentation

void Parma_Polyhedra_Library::PIP_Problem::add_constraint ( const Constraint c)

Adds a copy of constraint c to the PIP problem.

Exceptions
std::invalid_argumentThrown if the space dimension of c is strictly greater than the space dimension of *this.

Definition at line 697 of file PIP_Problem.cc.

References Parma_Polyhedra_Library::Constraint::space_dimension().

697  {
698  if (c.space_dimension() > external_space_dim) {
699  std::ostringstream s;
700  s << "PPL::PIP_Problem::add_constraint(c):\n"
701  << "dim == "<< external_space_dim << " and c.space_dimension() == "
702  << c.space_dimension() << " are dimension incompatible.";
703  throw std::invalid_argument(s.str());
704  }
705  input_cs.push_back(c);
706  // Update problem status.
707  if (status != UNSATISFIABLE) {
709  }
710 }
dimension_type external_space_dim
The dimension of the vector space.
Constraint_Sequence input_cs
The sequence of constraints describing the feasible region.
Status status
The internal state of the MIP problem.
The feasible region of the PIP problem has been changed by adding new variables, parameters or constr...
Coefficient c
Definition: PIP_Tree.cc:64
void Parma_Polyhedra_Library::PIP_Problem::add_constraints ( const Constraint_System cs)

Adds a copy of the constraints in cs to the PIP problem.

Exceptions
std::invalid_argumentThrown if the space dimension of constraint system cs is strictly greater than the space dimension of *this.

Definition at line 713 of file PIP_Problem.cc.

References Parma_Polyhedra_Library::Constraint_System::begin(), and Parma_Polyhedra_Library::Constraint_System::end().

713  {
714  for (Constraint_System::const_iterator ci = cs.begin(),
715  ci_end = cs.end(); ci != ci_end; ++ci) {
716  add_constraint(*ci);
717  }
718 }
void add_constraint(const Constraint &c)
Adds a copy of constraint c to the PIP problem.
Definition: PIP_Problem.cc:697
Constraint_System_const_iterator const_iterator
void Parma_Polyhedra_Library::PIP_Problem::add_space_dimensions_and_embed ( dimension_type  m_vars,
dimension_type  m_params 
)

Adds m_vars + m_params new space dimensions and embeds the old PIP problem in the new vector space.

Parameters
m_varsThe number of space dimensions to add that are interpreted as PIP problem variables (i.e., non parameters). These are added before adding the m_params parameters.
m_paramsThe number of space dimensions to add that are interpreted as PIP problem parameters. These are added after having added the m_vars problem variables.
Exceptions
std::length_errorThrown if adding m_vars + m_params new space dimensions would cause the vector space to exceed dimension max_space_dimension().

The new space dimensions will be those having the highest indexes in the new PIP problem; they are initially unconstrained.

Definition at line 632 of file PIP_Problem.cc.

References Parma_Polyhedra_Library::max_space_dimension().

633  {
634  // Adding no space dims at all is a no-op:
635  // this avoids invalidating problem status (if it was optimized).
636  if (m_vars == 0 && m_params == 0) {
637  return;
638  }
639 
640  // The space dimension of the resulting PIP problem should not
641  // overflow the maximum allowed space dimension.
643  bool should_throw = (m_vars > available);
644  if (!should_throw) {
645  available -= m_vars;
646  should_throw = (m_params > available);
647  }
648  if (should_throw) {
649  throw std::length_error("PPL::PIP_Problem::"
650  "add_space_dimensions_and_embed(m_v, m_p):\n"
651  "adding m_v+m_p new space dimensions exceeds "
652  "the maximum allowed space dimension.");
653  }
654  // First add PIP variables ...
655  external_space_dim += m_vars;
656  // ... then add PIP parameters.
657  for (dimension_type i = m_params; i-- > 0; ) {
660  }
661  // Update problem status.
662  if (status != UNSATISFIABLE) {
664  }
665  PPL_ASSERT(OK());
666 }
static dimension_type max_space_dimension()
Returns the maximum space dimension a PIP_Problem can handle.
size_t dimension_type
An unsigned integral type for representing space dimensions.
Variables_Set parameters
A set containing all the indices of space dimensions that are interpreted as problem parameters...
dimension_type external_space_dim
The dimension of the vector space.
bool OK() const
Checks if all the invariants are satisfied.
Definition: PIP_Problem.cc:277
dimension_type space_dimension() const
Returns the space dimension of the PIP problem.
Status status
The internal state of the MIP problem.
The feasible region of the PIP problem has been changed by adding new variables, parameters or constr...
void insert(Variable v)
Inserts the index of variable v into the set.
void Parma_Polyhedra_Library::PIP_Problem::add_to_parameter_space_dimensions ( const Variables_Set p_vars)

Sets the space dimensions whose indexes which are in set p_vars to be parameter space dimensions.

Exceptions
std::invalid_argumentThrown if some index in p_vars does not correspond to a space dimension in *this.

Definition at line 670 of file PIP_Problem.cc.

References Parma_Polyhedra_Library::Variables_Set::space_dimension().

670  {
671  if (p_vars.space_dimension() > external_space_dim) {
672  throw std::invalid_argument("PPL::PIP_Problem::"
673  "add_to_parameter_space_dimension(p_vars):\n"
674  "*this and p_vars are dimension "
675  "incompatible.");
676  }
677  const dimension_type original_size = parameters.size();
678  parameters.insert(p_vars.begin(), p_vars.end());
679  // Do not allow to turn variables into parameters.
680  for (Variables_Set::const_iterator p = p_vars.begin(),
681  end = p_vars.end(); p != end; ++p) {
682  if (*p < internal_space_dim) {
683  throw std::invalid_argument("PPL::PIP_Problem::"
684  "add_to_parameter_space_dimension(p_vars):"
685  "p_vars contain variable indices.");
686  }
687  }
688 
689  // If a new parameter was inserted, set the internal status to
690  // PARTIALLY_SATISFIABLE.
691  if (parameters.size() != original_size && status != UNSATISFIABLE) {
693  }
694 }
dimension_type internal_space_dim
The space dimension of the current (partial) solution of the PIP problem; it may be smaller than exte...
size_t dimension_type
An unsigned integral type for representing space dimensions.
Variables_Set parameters
A set containing all the indices of space dimensions that are interpreted as problem parameters...
dimension_type external_space_dim
The dimension of the vector space.
Status status
The internal state of the MIP problem.
The feasible region of the PIP problem has been changed by adding new variables, parameters or constr...
void insert(Variable v)
Inserts the index of variable v into the set.
void Parma_Polyhedra_Library::PIP_Problem::ascii_dump ( ) const

Writes to std::cerr an ASCII representation of *this.

void Parma_Polyhedra_Library::PIP_Problem::ascii_dump ( std::ostream &  s) const

Writes to s an ASCII representation of *this.

Definition at line 372 of file PIP_Problem.cc.

References Parma_Polyhedra_Library::PIP_Decision_Node::as_decision(), Parma_Polyhedra_Library::PIP_Solution_Node::as_solution(), Parma_Polyhedra_Library::PIP_Solution_Node::ascii_dump(), and value.

372  {
373  using namespace IO_Operators;
374  s << "\nexternal_space_dim: " << external_space_dim << "\n";
375  s << "\ninternal_space_dim: " << internal_space_dim << "\n";
376 
377  const dimension_type input_cs_size = input_cs.size();
378 
379  s << "\ninput_cs( " << input_cs_size << " )\n";
380  for (dimension_type i = 0; i < input_cs_size; ++i) {
381  input_cs[i].ascii_dump(s);
382  }
383 
384  s << "\nfirst_pending_constraint: " << first_pending_constraint << "\n";
385 
386  s << "\nstatus: ";
387  switch (status) {
388  case UNSATISFIABLE:
389  s << "UNSATISFIABLE";
390  break;
391  case OPTIMIZED:
392  s << "OPTIMIZED";
393  break;
395  s << "PARTIALLY_SATISFIABLE";
396  break;
397  }
398  s << "\n";
399 
400  s << "\nparameters";
402 
403  s << "\ninitial_context\n";
404  initial_context.ascii_dump(s);
405 
406  s << "\ncontrol_parameters\n";
407  for (dimension_type i = 0; i < CONTROL_PARAMETER_NAME_SIZE; ++i) {
409  switch (value) {
411  s << "CUTTING_STRATEGY_FIRST";
412  break;
414  s << "CUTTING_STRATEGY_DEEPEST";
415  break;
417  s << "CUTTING_STRATEGY_ALL";
418  break;
420  s << "PIVOT_ROW_STRATEGY_FIRST";
421  break;
423  s << "PIVOT_ROW_STRATEGY_MAX_COLUMN";
424  break;
425  default:
426  s << "Invalid control parameter value";
427  }
428  s << "\n";
429  }
430 
431  s << "\nbig_parameter_dimension: " << big_parameter_dimension << "\n";
432 
433  s << "\ncurrent_solution: ";
434  if (current_solution == 0) {
435  s << "BOTTOM\n";
436  }
437  else if (const PIP_Decision_Node* const dec
439  s << "DECISION\n";
440  dec->ascii_dump(s);
441  }
442  else {
443  const PIP_Solution_Node* const sol = current_solution->as_solution();
444  PPL_ASSERT(sol != 0);
445  s << "SOLUTION\n";
446  sol->ascii_dump(s);
447  }
448 }
dimension_type internal_space_dim
The space dimension of the current (partial) solution of the PIP problem; it may be smaller than exte...
virtual const PIP_Decision_Node * as_decision() const =0
Returns this if *this is a decision node, 0 otherwise.
size_t dimension_type
An unsigned integral type for representing space dimensions.
Variables_Set parameters
A set containing all the indices of space dimensions that are interpreted as problem parameters...
dimension_type external_space_dim
The dimension of the vector space.
PIP_Tree_Node * current_solution
The current solution decision tree.
Choose the first row with negative parameter sign.
Constraint_Sequence input_cs
The sequence of constraints describing the feasible region.
Control_Parameter_Value control_parameters[CONTROL_PARAMETER_NAME_SIZE]
The control parameters for the problem object.
Control_Parameter_Value
Possible values for PIP_Problem control parameters.
dimension_type first_pending_constraint
The first index of `input_cs' containing a pending constraint.
Status status
The internal state of the MIP problem.
The PIP problem is optimized; the solution tree has been computed.
Choose a row that generates a lexicographically maximal pivot column.
Coefficient value
Definition: PIP_Tree.cc:618
virtual const PIP_Solution_Node * as_solution() const =0
Returns this if *this is a solution node, 0 otherwise.
void ascii_dump() const
Writes to std::cerr an ASCII representation of *this.
The feasible region of the PIP problem has been changed by adding new variables, parameters or constr...
dimension_type big_parameter_dimension
The dimension for the big parameter, or not_a_dimension() if not set.
Matrix< Row > initial_context
The initial context.
bool Parma_Polyhedra_Library::PIP_Problem::ascii_load ( std::istream &  s)

Loads from s an ASCII representation (as produced by ascii_dump(std::ostream&) const) and sets *this accordingly. Returns true if successful, false otherwise.

Definition at line 453 of file PIP_Problem.cc.

References Parma_Polyhedra_Library::PIP_Solution_Node::ascii_load(), Parma_Polyhedra_Library::Constraint::ascii_load(), Parma_Polyhedra_Library::PIP_Decision_Node::ascii_load(), c, Parma_Polyhedra_Library::PIP_Solution_Node::set_owner(), Parma_Polyhedra_Library::PIP_Decision_Node::set_owner(), value, and Parma_Polyhedra_Library::Constraint::zero_dim_positivity().

453  {
454  std::string str;
455  if (!(s >> str) || str != "external_space_dim:") {
456  return false;
457  }
458 
459  if (!(s >> external_space_dim)) {
460  return false;
461  }
462 
463  if (!(s >> str) || str != "internal_space_dim:") {
464  return false;
465  }
466 
467  if (!(s >> internal_space_dim)) {
468  return false;
469  }
470 
471  if (!(s >> str) || str != "input_cs(") {
472  return false;
473  }
474 
475  dimension_type input_cs_size;
476 
477  if (!(s >> input_cs_size)) {
478  return false;
479  }
480 
481  if (!(s >> str) || str != ")") {
482  return false;
483  }
484 
485  Constraint c(Constraint::zero_dim_positivity());
486  for (dimension_type i = 0; i < input_cs_size; ++i) {
487  if (!c.ascii_load(s)) {
488  return false;
489  }
490  input_cs.push_back(c);
491  }
492 
493  if (!(s >> str) || str != "first_pending_constraint:") {
494  return false;
495  }
496 
497  if (!(s >> first_pending_constraint)) {
498  return false;
499  }
500 
501  if (!(s >> str) || str != "status:") {
502  return false;
503  }
504 
505  if (!(s >> str)) {
506  return false;
507  }
508 
509  if (str == "UNSATISFIABLE") {
511  }
512  else if (str == "OPTIMIZED") {
513  status = OPTIMIZED;
514  }
515  else if (str == "PARTIALLY_SATISFIABLE") {
517  }
518  else {
519  return false;
520  }
521 
522  if (!(s >> str) || str != "parameters") {
523  return false;
524  }
525 
526  if (!parameters.ascii_load(s)) {
527  return false;
528  }
529 
530  if (!(s >> str) || str != "initial_context") {
531  return false;
532  }
533 
534  if (!initial_context.ascii_load(s)) {
535  return false;
536  }
537 
538  if (!(s >> str) || str != "control_parameters") {
539  return false;
540  }
541 
542  for (dimension_type i = 0; i < CONTROL_PARAMETER_NAME_SIZE; ++i) {
543  if (!(s >> str)) {
544  return false;
545  }
547  if (str == "CUTTING_STRATEGY_FIRST") {
548  value = CUTTING_STRATEGY_FIRST;
549  }
550  else if (str == "CUTTING_STRATEGY_DEEPEST") {
551  value = CUTTING_STRATEGY_DEEPEST;
552  }
553  else if (str == "CUTTING_STRATEGY_ALL") {
554  value = CUTTING_STRATEGY_ALL;
555  }
556  else if (str == "PIVOT_ROW_STRATEGY_FIRST") {
557  value = PIVOT_ROW_STRATEGY_FIRST;
558  }
559  else if (str == "PIVOT_ROW_STRATEGY_MAX_COLUMN") {
561  }
562  else {
563  return false;
564  }
566  }
567 
568  if (!(s >> str) || str != "big_parameter_dimension:") {
569  return false;
570  }
571  if (!(s >> big_parameter_dimension)) {
572  return false;
573  }
574 
575  // Release current_solution tree (if any).
576  delete current_solution;
577  current_solution = 0;
578  // Load current_solution (if any).
579  if (!(s >> str) || str != "current_solution:") {
580  return false;
581  }
582  if (!(s >> str)) {
583  return false;
584  }
585  if (str == "BOTTOM") {
586  current_solution = 0;
587  }
588  else if (str == "DECISION") {
589  PIP_Decision_Node* const dec = new PIP_Decision_Node(0, 0, 0);
590  current_solution = dec;
591  if (!dec->ascii_load(s)) {
592  return false;
593  }
594  dec->set_owner(this);
595  }
596  else if (str == "SOLUTION") {
597  PIP_Solution_Node* const sol = new PIP_Solution_Node(0);
598  current_solution = sol;
599  if (!sol->ascii_load(s)) {
600  return false;
601  }
602  sol->set_owner(this);
603  }
604  else {
605  // Unknown node kind.
606  return false;
607  }
608 
609  PPL_ASSERT(OK());
610  return true;
611 }
dimension_type internal_space_dim
The space dimension of the current (partial) solution of the PIP problem; it may be smaller than exte...
size_t dimension_type
An unsigned integral type for representing space dimensions.
Variables_Set parameters
A set containing all the indices of space dimensions that are interpreted as problem parameters...
virtual void set_owner(const PIP_Problem *owner)=0
Sets the pointer to the PIP_Problem owning object.
dimension_type external_space_dim
The dimension of the vector space.
PIP_Tree_Node * current_solution
The current solution decision tree.
bool OK() const
Checks if all the invariants are satisfied.
Definition: PIP_Problem.cc:277
Choose the first row with negative parameter sign.
Constraint_Sequence input_cs
The sequence of constraints describing the feasible region.
Control_Parameter_Value control_parameters[CONTROL_PARAMETER_NAME_SIZE]
The control parameters for the problem object.
Control_Parameter_Value
Possible values for PIP_Problem control parameters.
dimension_type first_pending_constraint
The first index of `input_cs' containing a pending constraint.
Status status
The internal state of the MIP problem.
The PIP problem is optimized; the solution tree has been computed.
Choose a row that generates a lexicographically maximal pivot column.
Coefficient value
Definition: PIP_Tree.cc:618
bool ascii_load(std::istream &s)
Loads from s an ASCII representation (as produced by ascii_dump(std::ostream&) const) and sets *this ...
The feasible region of the PIP problem has been changed by adding new variables, parameters or constr...
dimension_type big_parameter_dimension
The dimension for the big parameter, or not_a_dimension() if not set.
Matrix< Row > initial_context
The initial context.
static const Constraint & zero_dim_positivity()
The true (zero-dimension space) constraint , also known as positivity constraint. ...
Coefficient c
Definition: PIP_Tree.cc:64
void Parma_Polyhedra_Library::PIP_Problem::clear ( )

Resets *this to be equal to the trivial PIP problem.

The space dimension is reset to $0$.

Definition at line 614 of file PIP_Problem.cc.

References Parma_Polyhedra_Library::not_a_dimension().

614  {
615  external_space_dim = 0;
616  internal_space_dim = 0;
618  if (current_solution != 0) {
619  delete current_solution;
620  current_solution = 0;
621  }
622  input_cs.clear();
624  parameters.clear();
625  initial_context.clear();
628 }
dimension_type internal_space_dim
The space dimension of the current (partial) solution of the PIP problem; it may be smaller than exte...
Variables_Set parameters
A set containing all the indices of space dimensions that are interpreted as problem parameters...
dimension_type not_a_dimension()
Returns a value that does not designate a valid dimension.
dimension_type external_space_dim
The dimension of the vector space.
PIP_Tree_Node * current_solution
The current solution decision tree.
void control_parameters_init()
Initializes the control parameters with default values.
Definition: PIP_Problem.cc:93
Constraint_Sequence input_cs
The sequence of constraints describing the feasible region.
dimension_type first_pending_constraint
The first index of `input_cs' containing a pending constraint.
Status status
The internal state of the MIP problem.
The feasible region of the PIP problem has been changed by adding new variables, parameters or constr...
dimension_type big_parameter_dimension
The dimension for the big parameter, or not_a_dimension() if not set.
Matrix< Row > initial_context
The initial context.
PIP_Problem::const_iterator Parma_Polyhedra_Library::PIP_Problem::constraints_begin ( ) const
inline

Returns a read-only iterator to the first constraint defining the feasible region.

Definition at line 40 of file PIP_Problem_inlines.hh.

References input_cs.

Referenced by operator<<().

40  {
41  return input_cs.begin();
42 }
Constraint_Sequence input_cs
The sequence of constraints describing the feasible region.
PIP_Problem::const_iterator Parma_Polyhedra_Library::PIP_Problem::constraints_end ( ) const
inline

Returns a past-the-end read-only iterator to the sequence of constraints defining the feasible region.

Definition at line 45 of file PIP_Problem_inlines.hh.

References input_cs.

Referenced by operator<<().

45  {
46  return input_cs.end();
47 }
Constraint_Sequence input_cs
The sequence of constraints describing the feasible region.
void Parma_Polyhedra_Library::PIP_Problem::control_parameters_copy ( const PIP_Problem y)
private

Copies the control parameters from problem object y.

Definition at line 99 of file PIP_Problem.cc.

References control_parameters.

Referenced by PIP_Problem().

99  {
100  for (dimension_type i = CONTROL_PARAMETER_NAME_SIZE; i-- > 0; ) {
101  control_parameters[i] = y.control_parameters[i];
102  }
103 }
size_t dimension_type
An unsigned integral type for representing space dimensions.
Control_Parameter_Value control_parameters[CONTROL_PARAMETER_NAME_SIZE]
The control parameters for the problem object.
void Parma_Polyhedra_Library::PIP_Problem::control_parameters_init ( )
private

Initializes the control parameters with default values.

Definition at line 93 of file PIP_Problem.cc.

Referenced by PIP_Problem().

PPL::memory_size_type Parma_Polyhedra_Library::PIP_Problem::external_memory_in_bytes ( ) const

Returns the size in bytes of the memory managed by *this.

Definition at line 766 of file PIP_Problem.cc.

766  {
767  memory_size_type n = initial_context.external_memory_in_bytes();
768  // Adding the external memory for `current_solution'.
769  if (current_solution != 0) {
771  }
772  // Adding the external memory for `input_cs'.
773  n += input_cs.capacity() * sizeof(Constraint);
774  for (const_iterator i = input_cs.begin(),
775  i_end = input_cs.end(); i != i_end; ++i) {
776  n += (i->external_memory_in_bytes());
777  }
778  // FIXME: Adding the external memory for `parameters'.
779  n += parameters.size() * sizeof(dimension_type);
780 
781  return n;
782 }
size_t dimension_type
An unsigned integral type for representing space dimensions.
Variables_Set parameters
A set containing all the indices of space dimensions that are interpreted as problem parameters...
PIP_Tree_Node * current_solution
The current solution decision tree.
Constraint_Sequence::const_iterator const_iterator
A type alias for the read-only iterator on the constraints defining the feasible region.
Constraint_Sequence input_cs
The sequence of constraints describing the feasible region.
Matrix< Row > initial_context
The initial context.
size_t memory_size_type
An unsigned integral type for representing memory size in bytes.
virtual memory_size_type total_memory_in_bytes() const =0
Returns the total size in bytes of the memory occupied by *this.
dimension_type Parma_Polyhedra_Library::PIP_Problem::get_big_parameter_dimension ( ) const
inline

Returns the space dimension for the big parameter.

If a big parameter was not set, returns not_a_dimension().

Definition at line 85 of file PIP_Problem_inlines.hh.

References big_parameter_dimension.

Referenced by operator<<().

85  {
87 }
dimension_type big_parameter_dimension
The dimension for the big parameter, or not_a_dimension() if not set.
PIP_Problem::Control_Parameter_Value Parma_Polyhedra_Library::PIP_Problem::get_control_parameter ( Control_Parameter_Name  name) const
inline

Returns the value of control parameter name.

Definition at line 79 of file PIP_Problem_inlines.hh.

References CONTROL_PARAMETER_NAME_SIZE, and control_parameters.

79  {
80  PPL_ASSERT(name >= 0 && name < CONTROL_PARAMETER_NAME_SIZE);
81  return control_parameters[name];
82 }
Control_Parameter_Value control_parameters[CONTROL_PARAMETER_NAME_SIZE]
The control parameters for the problem object.
bool Parma_Polyhedra_Library::PIP_Problem::is_satisfiable ( ) const

Checks satisfiability of *this.

Returns
true if and only if the PIP problem is satisfiable.

Definition at line 721 of file PIP_Problem.cc.

721  {
722  if (status == PARTIALLY_SATISFIABLE) {
723  solve();
724  }
725  return status == OPTIMIZED;
726 }
Status status
The internal state of the MIP problem.
The PIP problem is optimized; the solution tree has been computed.
The feasible region of the PIP problem has been changed by adding new variables, parameters or constr...
PIP_Problem_Status solve() const
Optimizes the PIP problem.
Definition: PIP_Problem.cc:106
void Parma_Polyhedra_Library::PIP_Problem::m_swap ( PIP_Problem y)
inline

Swaps *this with y.

Definition at line 55 of file PIP_Problem_inlines.hh.

References big_parameter_dimension, CONTROL_PARAMETER_NAME_SIZE, control_parameters, current_solution, external_space_dim, first_pending_constraint, initial_context, input_cs, internal_space_dim, parameters, status, swap(), and Parma_Polyhedra_Library::swap().

Referenced by operator=(), and swap().

55  {
56  using std::swap;
57  swap(external_space_dim, y.external_space_dim);
58  swap(internal_space_dim, y.internal_space_dim);
59  swap(status, y.status);
60  swap(current_solution, y.current_solution);
61  swap(input_cs, y.input_cs);
62  swap(first_pending_constraint, y.first_pending_constraint);
63  swap(parameters, y.parameters);
64  swap(initial_context, y.initial_context);
65  for (dimension_type i = CONTROL_PARAMETER_NAME_SIZE; i-- > 0; ) {
66  swap(control_parameters[i], y.control_parameters[i]);
67  }
68  swap(big_parameter_dimension, y.big_parameter_dimension);
69 }
dimension_type internal_space_dim
The space dimension of the current (partial) solution of the PIP problem; it may be smaller than exte...
void swap(CO_Tree &x, CO_Tree &y)
size_t dimension_type
An unsigned integral type for representing space dimensions.
Variables_Set parameters
A set containing all the indices of space dimensions that are interpreted as problem parameters...
dimension_type external_space_dim
The dimension of the vector space.
PIP_Tree_Node * current_solution
The current solution decision tree.
Constraint_Sequence input_cs
The sequence of constraints describing the feasible region.
Control_Parameter_Value control_parameters[CONTROL_PARAMETER_NAME_SIZE]
The control parameters for the problem object.
dimension_type first_pending_constraint
The first index of `input_cs' containing a pending constraint.
Status status
The internal state of the MIP problem.
void swap(PIP_Problem &x, PIP_Problem &y)
Swaps x with y.
dimension_type big_parameter_dimension
The dimension for the big parameter, or not_a_dimension() if not set.
Matrix< Row > initial_context
The initial context.
dimension_type Parma_Polyhedra_Library::PIP_Problem::max_space_dimension ( )
inlinestatic

Returns the maximum space dimension a PIP_Problem can handle.

Definition at line 35 of file PIP_Problem_inlines.hh.

References Parma_Polyhedra_Library::Constraint::max_space_dimension().

Referenced by PIP_Problem().

35  {
37 }
static dimension_type max_space_dimension()
Returns the maximum space dimension a Constraint can handle.
bool Parma_Polyhedra_Library::PIP_Problem::OK ( ) const

Checks if all the invariants are satisfied.

Definition at line 277 of file PIP_Problem.cc.

References Parma_Polyhedra_Library::ascii_dump(), and Parma_Polyhedra_Library::not_a_dimension().

Referenced by PIP_Problem().

277  {
278 #ifndef NDEBUG
279  using std::endl;
280  using std::cerr;
281 #endif
282 
284 #ifndef NDEBUG
285  cerr << "The internal space dimension of the PIP_Problem is "
286  << "greater than its external space dimension."
287  << endl;
288  ascii_dump(cerr);
289 #endif
290  return false;
291  }
292 
293  // Constraint system should be space dimension compatible.
294  const dimension_type input_cs_num_rows = input_cs.size();
295  for (dimension_type i = input_cs_num_rows; i-- > 0; ) {
297 #ifndef NDEBUG
298  cerr << "The space dimension of the PIP_Problem is smaller than "
299  << "the space dimension of one of its constraints."
300  << endl;
301  ascii_dump(cerr);
302 #endif
303  return false;
304  }
305  }
306 
307  // Test validity of control parameter values.
309  if (strategy != CUTTING_STRATEGY_FIRST
310  && strategy != CUTTING_STRATEGY_DEEPEST
311  && strategy != CUTTING_STRATEGY_ALL) {
312 #ifndef NDEBUG
313  cerr << "Invalid value for the CUTTING_STRATEGY control parameter."
314  << endl;
315  ascii_dump(cerr);
316 #endif
317  return false;
318  }
319 
321  if (strategy < PIVOT_ROW_STRATEGY_FIRST
322  || strategy > PIVOT_ROW_STRATEGY_MAX_COLUMN) {
323 #ifndef NDEBUG
324  cerr << "Invalid value for the PIVOT_ROW_STRATEGY control parameter."
325  << endl;
326  ascii_dump(cerr);
327 #endif
328  return false;
329  }
330 
332  && parameters.count(big_parameter_dimension) == 0) {
333 #ifndef NDEBUG
334  cerr << "The big parameter is set, but it is not a parameter." << endl;
335  ascii_dump(cerr);
336 #endif
337  return false;
338  }
339 
340  if (!parameters.OK()) {
341  return false;
342  }
343  if (!initial_context.OK()) {
344  return false;
345  }
346 
347  if (current_solution != 0) {
348  // Check well formedness of the solution tree.
349  if (!current_solution->OK()) {
350 #ifndef NDEBUG
351  cerr << "The computed solution tree is broken.\n";
352  ascii_dump(cerr);
353 #endif
354  return false;
355  }
356  // Check that all nodes in the solution tree belong to *this.
357  if (!current_solution->check_ownership(this)) {
358 #ifndef NDEBUG
359  cerr << "There are nodes in the solution tree "
360  << "that are not owned by *this.\n";
361  ascii_dump(cerr);
362 #endif
363  return false;
364  }
365  }
366 
367  // All checks passed.
368  return true;
369 }
dimension_type internal_space_dim
The space dimension of the current (partial) solution of the PIP problem; it may be smaller than exte...
size_t dimension_type
An unsigned integral type for representing space dimensions.
Variables_Set parameters
A set containing all the indices of space dimensions that are interpreted as problem parameters...
dimension_type not_a_dimension()
Returns a value that does not designate a valid dimension.
dimension_type external_space_dim
The dimension of the vector space.
bool OK() const
Checks if all the invariants are satisfied.
PIP_Tree_Node * current_solution
The current solution decision tree.
dimension_type space_dimension() const
Returns the space dimension of the PIP problem.
Choose the first row with negative parameter sign.
void ascii_dump() const
Writes to std::cerr an ASCII representation of *this.
virtual bool check_ownership(const PIP_Problem *owner) const =0
Returns true if and only if all the nodes in the subtree rooted in *this are owned by *owner...
Constraint_Sequence input_cs
The sequence of constraints describing the feasible region.
Control_Parameter_Value control_parameters[CONTROL_PARAMETER_NAME_SIZE]
The control parameters for the problem object.
Control_Parameter_Value
Possible values for PIP_Problem control parameters.
virtual bool OK() const =0
Returns true if and only if *this is well formed.
Definition: PIP_Tree.cc:1197
Choose a row that generates a lexicographically maximal pivot column.
dimension_type big_parameter_dimension
The dimension for the big parameter, or not_a_dimension() if not set.
Matrix< Row > initial_context
The initial context.
PIP_Problem & Parma_Polyhedra_Library::PIP_Problem::operator= ( const PIP_Problem y)
inline

Assignment operator.

Definition at line 72 of file PIP_Problem_inlines.hh.

References m_swap().

72  {
73  PIP_Problem tmp(y);
74  m_swap(tmp);
75  return *this;
76 }
PIP_Problem(dimension_type dim=0)
Builds a trivial PIP problem.
Definition: PIP_Problem.cc:50
void m_swap(PIP_Problem &y)
Swaps *this with y.
PPL::PIP_Tree Parma_Polyhedra_Library::PIP_Problem::optimizing_solution ( ) const

Returns an optimizing solution for *this, if it exists.

A null pointer is returned for an unfeasible PIP problem.

Definition at line 269 of file PIP_Problem.cc.

269  {
270  if (status == PARTIALLY_SATISFIABLE) {
271  solve();
272  }
273  return current_solution;
274 }
PIP_Tree_Node * current_solution
The current solution decision tree.
Status status
The internal state of the MIP problem.
The feasible region of the PIP problem has been changed by adding new variables, parameters or constr...
PIP_Problem_Status solve() const
Optimizes the PIP problem.
Definition: PIP_Problem.cc:106
const Variables_Set & Parma_Polyhedra_Library::PIP_Problem::parameter_space_dimensions ( ) const
inline

Returns a set containing all the variables' indexes representing the parameters of the PIP problem.

Definition at line 50 of file PIP_Problem_inlines.hh.

References parameters.

Referenced by operator<<(), Parma_Polyhedra_Library::PIP_Solution_Node::parametric_values(), Parma_Polyhedra_Library::PIP_Tree_Node::print(), and Parma_Polyhedra_Library::PIP_Solution_Node::update_solution().

50  {
51  return parameters;
52 }
Variables_Set parameters
A set containing all the indices of space dimensions that are interpreted as problem parameters...
void Parma_Polyhedra_Library::PIP_Problem::print ( ) const

Prints *this to std::cerr using operator<<.

void Parma_Polyhedra_Library::PIP_Problem::print_solution ( std::ostream &  s,
int  indent = 0 
) const

Prints on s the solution computed for *this.

Parameters
sThe output stream.
indentAn indentation parameter (default value 0).
Exceptions
std::logic_errorThrown if trying to print the solution when the PIP problem still has to be solved.

Definition at line 790 of file PIP_Problem.cc.

References Parma_Polyhedra_Library::PIP_Tree_Node::indent_and_print().

790  {
791  switch (status) {
792 
793  case UNSATISFIABLE:
794  PPL_ASSERT(current_solution == 0);
795  PIP_Tree_Node::indent_and_print(s, indent, "_|_\n");
796  break;
797 
798  case OPTIMIZED:
799  PPL_ASSERT(current_solution != 0);
800  current_solution->print(s, indent);
801  break;
802 
804  throw std::logic_error("PIP_Problem::print_solution():\n"
805  "the PIP problem has not been solved.");
806  }
807 }
PIP_Tree_Node * current_solution
The current solution decision tree.
Status status
The internal state of the MIP problem.
The PIP problem is optimized; the solution tree has been computed.
The feasible region of the PIP problem has been changed by adding new variables, parameters or constr...
static void indent_and_print(std::ostream &s, int indent, const char *str)
A helper function used when printing PIP trees.
Definition: PIP_Tree.cc:3803
void print(std::ostream &s, int indent=0) const
Prints on s the tree rooted in *this.
Definition: PIP_Tree.cc:3811
void Parma_Polyhedra_Library::PIP_Problem::set_big_parameter_dimension ( dimension_type  big_dim)

Sets the dimension for the big parameter to big_dim.

Definition at line 750 of file PIP_Problem.cc.

750  {
751  if (parameters.count(big_dim) == 0) {
752  throw std::invalid_argument("PPL::PIP_Problem::"
753  "set_big_parameter_dimension(big_dim):\n"
754  "dimension 'big_dim' is not a parameter.");
755  }
756  if (big_dim < internal_space_dim) {
757  throw std::invalid_argument("PPL::PIP_Problem::"
758  "set_big_parameter_dimension(big_dim):\n"
759  "only newly-added parameters can be"
760  "converted into the big parameter.");
761  }
762  big_parameter_dimension = big_dim;
763 }
dimension_type internal_space_dim
The space dimension of the current (partial) solution of the PIP problem; it may be smaller than exte...
Variables_Set parameters
A set containing all the indices of space dimensions that are interpreted as problem parameters...
dimension_type big_parameter_dimension
The dimension for the big parameter, or not_a_dimension() if not set.
void Parma_Polyhedra_Library::PIP_Problem::set_control_parameter ( Control_Parameter_Value  value)

Sets control parameter value.

Definition at line 729 of file PIP_Problem.cc.

References value.

729  {
730  switch (value) {
732  // Intentionally fall through.
734  // Intentionally fall through.
737  break;
739  // Intentionally fall through.
742  break;
743  default:
744  throw std::invalid_argument("PPL::PIP_Problem::set_control_parameter(v)"
745  ":\ninvalid value.");
746  }
747 }
Choose the first row with negative parameter sign.
Control_Parameter_Value control_parameters[CONTROL_PARAMETER_NAME_SIZE]
The control parameters for the problem object.
Choose a row that generates a lexicographically maximal pivot column.
Coefficient value
Definition: PIP_Tree.cc:618
PPL::PIP_Tree Parma_Polyhedra_Library::PIP_Problem::solution ( ) const

Returns a feasible solution for *this, if it exists.

A null pointer is returned for an unfeasible PIP problem.

Definition at line 261 of file PIP_Problem.cc.

261  {
262  if (status == PARTIALLY_SATISFIABLE) {
263  solve();
264  }
265  return current_solution;
266 }
PIP_Tree_Node * current_solution
The current solution decision tree.
Status status
The internal state of the MIP problem.
The feasible region of the PIP problem has been changed by adding new variables, parameters or constr...
PIP_Problem_Status solve() const
Optimizes the PIP problem.
Definition: PIP_Problem.cc:106
PPL::PIP_Problem_Status Parma_Polyhedra_Library::PIP_Problem::solve ( ) const

Optimizes the PIP problem.

Returns
A PIP_Problem_Status flag indicating the outcome of the optimization attempt (unfeasible or optimized problem).

Definition at line 106 of file PIP_Problem.cc.

References Parma_Polyhedra_Library::Expression_Hide_Last< T >::all_zeroes_except(), Parma_Polyhedra_Library::Sparse_Row::begin(), c, Parma_Polyhedra_Library::Constraint::coefficient(), Parma_Polyhedra_Library::PIP_Tree_Node::compatibility_check(), current_solution, Parma_Polyhedra_Library::Sparse_Row::end(), Parma_Polyhedra_Library::Constraint::expression(), first_pending_constraint, Parma_Polyhedra_Library::Constraint::inhomogeneous_term(), initial_context, Parma_Polyhedra_Library::Sparse_Row::insert(), internal_space_dim, Parma_Polyhedra_Library::Constraint::is_equality(), Parma_Polyhedra_Library::Constraint::is_strict_inequality(), Parma_Polyhedra_Library::neg_assign(), Parma_Polyhedra_Library::nth_iter(), Parma_Polyhedra_Library::OPTIMIZED_PIP_PROBLEM, Parma_Polyhedra_Library::PIP_Tree_Node::solve(), Parma_Polyhedra_Library::Constraint::space_dimension(), status, Parma_Polyhedra_Library::UNFEASIBLE_PIP_PROBLEM, and Parma_Polyhedra_Library::PIP_Tree_Node::update_tableau().

106  {
107  switch (status) {
108 
109  case UNSATISFIABLE:
110  PPL_ASSERT(OK());
111  return UNFEASIBLE_PIP_PROBLEM;
112 
113  case OPTIMIZED:
114  PPL_ASSERT(OK());
115  return OPTIMIZED_PIP_PROBLEM;
116 
118  {
119  PIP_Problem& x = const_cast<PIP_Problem&>(*this);
120  // Allocate PIP solution tree root, if needed.
121  if (current_solution == 0) {
122  x.current_solution = new PIP_Solution_Node(this);
123  }
124 
125  // Properly resize context matrix.
126  const dimension_type new_num_cols = parameters.size() + 1;
127  const dimension_type old_num_cols = initial_context.num_columns();
128  if (old_num_cols < new_num_cols) {
129  x.initial_context.add_zero_columns(new_num_cols - old_num_cols);
130  }
131 
132  // Computed once for all (to be used inside loop).
133  const Variables_Set::const_iterator param_begin = parameters.begin();
134  const Variables_Set::const_iterator param_end = parameters.end();
135 
136  // This flag will be set if we insert a pending constraint
137  // in the initial context.
138  bool check_feasible_context = false;
139 
140  // Go through all pending constraints.
141  for (Constraint_Sequence::const_iterator
143  cs_end = input_cs.end(); cs_i != cs_end; ++cs_i) {
144  const Constraint& c = *cs_i;
145  const dimension_type c_space_dim = c.space_dimension();
146  PPL_ASSERT(external_space_dim >= c_space_dim);
147 
148  // Constraints having a non-zero variable coefficient
149  // should not be inserted in context.
150  if (!c.expression().all_zeroes_except(parameters, 1, c_space_dim + 1)) {
151  continue;
152  }
153 
154  check_feasible_context = true;
155 
156  x.initial_context.add_zero_rows(1);
157 
158  Row& row = x.initial_context[x.initial_context.num_rows()-1];
159 
160  {
161  Row::iterator itr = row.end();
162 
163  if (c.inhomogeneous_term() != 0) {
164  itr = row.insert(0, c.inhomogeneous_term());
165  // Adjust inhomogeneous term if strict.
166  if (c.is_strict_inequality()) {
167  --(*itr);
168  }
169  }
170  else {
171  // Adjust inhomogeneous term if strict.
172  if (c.is_strict_inequality()) {
173  itr = row.insert(0, -1);
174  }
175  }
176  dimension_type i = 1;
177 
178  // TODO: This loop may be optimized more, if needed.
179  // If the size of param_end is expected to be greater than the
180  // number of nonzeroes of c in most cases, then this implementation
181  // can't be optimized further.
182  // itr may still be end(), but it can still be used as hint.
183  for (Variables_Set::const_iterator
184  pi = param_begin; pi != param_end; ++pi, ++i) {
185  if (*pi < c_space_dim) {
186  Coefficient_traits::const_reference coeff_pi
187  = c.coefficient(Variable(*pi));
188  if (coeff_pi != 0) {
189  itr = row.insert(itr, i, coeff_pi);
190  }
191  }
192  else {
193  break;
194  }
195  }
196  }
197 
198  // If it is an equality, also insert its negation.
199  if (c.is_equality()) {
200  x.initial_context.add_zero_rows(1);
201 
202  // The reference `row' has been invalidated.
203 
204  Row& last_row = x.initial_context[x.initial_context.num_rows()-1];
205 
206  last_row = x.initial_context[x.initial_context.num_rows()-2];
207 
208  for (Row::iterator i = last_row.begin(),
209  i_end = last_row.end(); i != i_end; ++i) {
210  neg_assign(*i);
211  }
212  }
213  }
214 
215  if (check_feasible_context) {
216  // Check for feasibility of initial context.
217  Matrix<Row> ctx_copy(initial_context);
219  // Problem found to be unfeasible.
220  delete x.current_solution;
221  x.current_solution = 0;
222  x.status = UNSATISFIABLE;
223  PPL_ASSERT(OK());
224  return UNFEASIBLE_PIP_PROBLEM;
225  }
226  }
227 
228  // Update tableau and mark constraints as no longer pending.
229  x.current_solution->update_tableau(*this,
232  input_cs,
233  parameters);
234  x.internal_space_dim = external_space_dim;
235  x.first_pending_constraint = input_cs.size();
236 
237  // Actually solve problem.
238  x.current_solution = x.current_solution->solve(*this,
239  check_feasible_context,
241  parameters,
243  /*indent_level=*/ 0);
244  // Update problem status.
245  x.status = (x.current_solution != 0) ? OPTIMIZED : UNSATISFIABLE;
246 
247  PPL_ASSERT(OK());
248  return (x.current_solution != 0)
251  } // End of handler for PARTIALLY_SATISFIABLE case.
252 
253  } // End of switch.
254 
255  // We should not be here!
256  PPL_UNREACHABLE;
257  return UNFEASIBLE_PIP_PROBLEM;
258 }
static bool compatibility_check(Matrix< Row > &s)
Checks whether a context matrix is satisfiable.
Definition: PIP_Tree.cc:2195
size_t dimension_type
An unsigned integral type for representing space dimensions.
PIP_Problem(dimension_type dim=0)
Builds a trivial PIP problem.
Definition: PIP_Problem.cc:50
Variables_Set parameters
A set containing all the indices of space dimensions that are interpreted as problem parameters...
dimension_type external_space_dim
The dimension of the vector space.
CO_Tree::iterator iterator
An iterator on the row elements.
PIP_Tree_Node * current_solution
The current solution decision tree.
bool OK() const
Checks if all the invariants are satisfied.
Definition: PIP_Problem.cc:277
The problem has an optimal solution.
RA_Container::iterator nth_iter(RA_Container &cont, dimension_type n)
Constraint_Sequence input_cs
The sequence of constraints describing the feasible region.
dimension_type first_pending_constraint
The first index of `input_cs' containing a pending constraint.
Status status
The internal state of the MIP problem.
The PIP problem is optimized; the solution tree has been computed.
The feasible region of the PIP problem has been changed by adding new variables, parameters or constr...
void neg_assign(GMP_Integer &x)
Matrix< Row > initial_context
The initial context.
Coefficient c
Definition: PIP_Tree.cc:64
dimension_type Parma_Polyhedra_Library::PIP_Problem::space_dimension ( ) const
inline

Returns the space dimension of the PIP problem.

Definition at line 30 of file PIP_Problem_inlines.hh.

References external_space_dim.

Referenced by operator<<(), Parma_Polyhedra_Library::PIP_Solution_Node::parametric_values(), Parma_Polyhedra_Library::PIP_Tree_Node::print(), and Parma_Polyhedra_Library::PIP_Solution_Node::update_solution().

30  {
31  return external_space_dim;
32 }
dimension_type external_space_dim
The dimension of the vector space.
PPL::memory_size_type Parma_Polyhedra_Library::PIP_Problem::total_memory_in_bytes ( ) const

Returns the total size in bytes of the memory occupied by *this.

Definition at line 785 of file PIP_Problem.cc.

References Parma_Polyhedra_Library::external_memory_in_bytes().

785  {
786  return sizeof(*this) + external_memory_in_bytes();
787 }
memory_size_type external_memory_in_bytes() const
Returns the size in bytes of the memory managed by *this.
Definition: PIP_Problem.cc:766

Friends And Related Function Documentation

std::ostream & operator<< ( std::ostream &  s,
const PIP_Problem pip 
)
related

Definition at line 32 of file PIP_Problem.cc.

References constraints_begin(), constraints_end(), get_big_parameter_dimension(), Parma_Polyhedra_Library::not_a_dimension(), parameter_space_dimensions(), and space_dimension().

32  {
33  s << "Space dimension: " << pip.space_dimension();
34  s << "\nConstraints:";
35  for (PIP_Problem::const_iterator i = pip.constraints_begin(),
36  i_end = pip.constraints_end(); i != i_end; ++i) {
37  s << "\n" << *i;
38  }
39  s << "\nProblem parameters: " << pip.parameter_space_dimensions();
40  if (pip.get_big_parameter_dimension() == not_a_dimension()) {
41  s << "\nNo big-parameter set.\n";
42  }
43  else {
44  s << "\nBig-parameter: " << Variable(pip.get_big_parameter_dimension());
45  }
46  s << "\n";
47  return s;
48 }
dimension_type not_a_dimension()
Returns a value that does not designate a valid dimension.
Constraint_Sequence::const_iterator const_iterator
A type alias for the read-only iterator on the constraints defining the feasible region.
std::ostream & operator<< ( std::ostream &  s,
const PIP_Problem pip 
)
related

Output operator.

friend class PIP_Solution_Node
friend

Definition at line 827 of file PIP_Problem_defs.hh.

void swap ( PIP_Problem x,
PIP_Problem y 
)
related

Swaps x with y.

Referenced by m_swap().

void swap ( PIP_Problem x,
PIP_Problem y 
)
related

Definition at line 91 of file PIP_Problem_inlines.hh.

References m_swap().

91  {
92  x.m_swap(y);
93 }

Member Data Documentation

dimension_type Parma_Polyhedra_Library::PIP_Problem::big_parameter_dimension
private

The dimension for the big parameter, or not_a_dimension() if not set.

Definition at line 825 of file PIP_Problem_defs.hh.

Referenced by get_big_parameter_dimension(), m_swap(), and Parma_Polyhedra_Library::PIP_Solution_Node::update_tableau().

Control_Parameter_Value Parma_Polyhedra_Library::PIP_Problem::control_parameters[CONTROL_PARAMETER_NAME_SIZE]
private

The control parameters for the problem object.

Definition at line 819 of file PIP_Problem_defs.hh.

Referenced by control_parameters_copy(), get_control_parameter(), m_swap(), and Parma_Polyhedra_Library::PIP_Solution_Node::solve().

PIP_Tree_Node* Parma_Polyhedra_Library::PIP_Problem::current_solution
private

The current solution decision tree.

Definition at line 790 of file PIP_Problem_defs.hh.

Referenced by m_swap(), PIP_Problem(), and solve().

dimension_type Parma_Polyhedra_Library::PIP_Problem::external_space_dim
private

The dimension of the vector space.

Definition at line 764 of file PIP_Problem_defs.hh.

Referenced by m_swap(), PIP_Problem(), space_dimension(), and Parma_Polyhedra_Library::PIP_Solution_Node::update_tableau().

dimension_type Parma_Polyhedra_Library::PIP_Problem::first_pending_constraint
private

The first index of `input_cs' containing a pending constraint.

Definition at line 796 of file PIP_Problem_defs.hh.

Referenced by m_swap(), and solve().

Matrix<Row> Parma_Polyhedra_Library::PIP_Problem::initial_context
private

The initial context.

Contains problem constraints on parameters only

Definition at line 815 of file PIP_Problem_defs.hh.

Referenced by m_swap(), and solve().

Constraint_Sequence Parma_Polyhedra_Library::PIP_Problem::input_cs
private

The sequence of constraints describing the feasible region.

Definition at line 793 of file PIP_Problem_defs.hh.

Referenced by constraints_begin(), constraints_end(), m_swap(), and PIP_Problem().

dimension_type Parma_Polyhedra_Library::PIP_Problem::internal_space_dim
private

The space dimension of the current (partial) solution of the PIP problem; it may be smaller than external_space_dim.

Definition at line 770 of file PIP_Problem_defs.hh.

Referenced by m_swap(), solve(), and Parma_Polyhedra_Library::PIP_Solution_Node::update_tableau().

Variables_Set Parma_Polyhedra_Library::PIP_Problem::parameters
private

A set containing all the indices of space dimensions that are interpreted as problem parameters.

Definition at line 802 of file PIP_Problem_defs.hh.

Referenced by m_swap(), and parameter_space_dimensions().

Status Parma_Polyhedra_Library::PIP_Problem::status
private

The internal state of the MIP problem.

Definition at line 787 of file PIP_Problem_defs.hh.

Referenced by m_swap(), and solve().


The documentation for this class was generated from the following files: