24 #ifndef PPL_MIP_Problem_inlines_hh
25 #define PPL_MIP_Problem_inlines_hh 1
45 : external_space_dim(y.external_space_dim),
46 internal_space_dim(y.internal_space_dim),
48 working_cost(y.working_cost),
53 initialized(y.initialized),
55 inherited_constraints(0),
56 first_pending_constraint(),
57 input_obj_function(y.input_obj_function),
59 last_generator(y.last_generator),
60 i_variables(y.i_variables) {
62 for (Constraint_Sequence::const_iterator i = y.
input_cs.begin(),
63 i_end = y.
input_cs.end(); i != i_end; ++i) {
71 : external_space_dim(y.external_space_dim),
72 internal_space_dim(y.internal_space_dim),
74 working_cost(y.working_cost),
79 initialized(y.initialized),
82 inherited_constraints(y.input_cs.size()),
83 first_pending_constraint(y.first_pending_constraint),
84 input_obj_function(y.input_obj_function),
86 last_generator(y.last_generator),
87 i_variables(y.i_variables) {
97 if (size == max_size) {
98 throw std::length_error(
"MIP_Problem::add_constraint(): "
99 "too many constraints");
114 for (Constraint_Sequence::const_iterator
116 i_end =
input_cs.end(); i != i_end; ++i) {
215 +
tableau.external_memory_in_bytes()
222 for (Constraint_Sequence::const_iterator
224 i_end =
input_cs.end(); i != i_end; ++i) {
225 n += ((*i)->total_memory_in_bytes());
231 n +=
mapping.capacity() *
sizeof(std::pair<dimension_type, dimension_type>);
326 #endif // !defined(PPL_MIP_Problem_inlines_hh)
MIP_Problem & operator=(const MIP_Problem &y)
Assignment operator.
bool operator==(const const_iterator &y) const
Compares *this with y.
Constraint_Sequence::const_iterator Base
void set_optimization_mode(Optimization_Mode mode)
Sets the optimization mode to mode.
A linear equality or inequality.
void swap(CO_Tree &x, CO_Tree &y)
Optimization_Mode
Possible optimization modes.
Optimization_Mode opt_mode
The optimization mode requested.
memory_size_type external_memory_in_bytes() const
Returns the size in bytes of the memory managed by *this.
size_t dimension_type
An unsigned integral type for representing space dimensions.
Linear_Expression input_obj_function
The objective function to be optimized.
An std::set of variables' indexes.
A line, ray, point or closure point.
const_iterator constraints_end() const
Returns a past-the-end read-only iterator to the sequence of constraints defining the feasible region...
const_iterator & operator+=(difference_type n)
Moves iterator forward of n positions.
void swap(MIP_Problem &x, MIP_Problem &y)
Swaps x with y.
~MIP_Problem()
Destructor.
Control_Parameter_Value
Possible values for MIP problem's control parameters.
working_cost_type working_cost
The working cost function.
const_iterator & operator-=(difference_type n)
Moves iterator backward of n positions.
const_iterator & operator++()
Prefix increment.
const_iterator & operator--()
Prefix decrement.
std::vector< Constraint * > input_cs
The sequence of constraints describing the feasible region.
void evaluate_objective_function(const Generator &evaluating_point, Coefficient &numer, Coefficient &denom) const
Sets num and denom so that is the result of evaluating the objective function on evaluating_point...
std::vector< dimension_type > base
The current basic solution.
A tag type to distinguish normal vs. inheriting copy constructor.
const Variables_Set & integer_space_dimensions() const
Returns a set containing all the variables' indexes constrained to be integral.
A read-only iterator on the constraints defining the feasible region.
RA_Container::iterator nth_iter(RA_Container &cont, dimension_type n)
const Linear_Expression & objective_function() const
Returns the objective function.
const Generator & optimizing_point() const
Returns an optimal point for *this, if it exists.
std::vector< std::pair< dimension_type, dimension_type > > mapping
A map between the variables of `input_cs' and `tableau'.
Control_Parameter_Value get_control_parameter(Control_Parameter_Name name) const
Returns the value of the control parameter name.
pointer operator->() const
Returns the address of the "pointed" object.
Variables_Set i_variables
A set containing all the indexes of variables that are constrained to have an integer value...
dimension_type compute_capacity(dimension_type requested_size, dimension_type maximum_size)
Speculative allocation function.
const_iterator(Base b)
Constructor from a Base iterator.
const_iterator constraints_begin() const
Returns a read-only iterator to the first constraint defining the feasible region.
Matrix< Row > tableau
The matrix encoding the current feasible region in tableau form.
bool OK() const
Checks if all the invariants are satisfied.
Optimization_Mode optimization_mode() const
Returns the optimization mode.
const_iterator operator+(difference_type n) const
Returns an iterator n positions forward.
Control_Parameter_Name
Names of MIP problems' control parameters.
The MIP problem is optimized; an optimal solution has been computed.
void optimal_value(Coefficient &numer, Coefficient &denom) const
Sets numer and denom so that is the solution of the optimization problem.
Base itr
The Base iterator on the Constraint_Sequence.
A Mixed Integer (linear) Programming problem.
memory_size_type total_memory_in_bytes() const
Returns the total size in bytes of the memory occupied by *this.
PPL_COEFFICIENT_TYPE Coefficient
An alias for easily naming the type of PPL coefficients.
void m_swap(MIP_Problem &y)
Swaps *this with y.
bool initialized
A Boolean encoding whether or not internal data structures have already been properly sized and popul...
void clear()
Resets *this to be equal to the trivial MIP problem.
Status status
The internal state of the MIP problem.
dimension_type inherited_constraints
The number of constraints that are inherited from our parent in the recursion tree built when solving...
The entire library is confined to this namespace.
memory_size_type external_memory_in_bytes() const
Returns the size in bytes of the memory managed by *this.
bool operator!=(const const_iterator &y) const
Compares *this with y.
void add_constraint_helper(const Constraint &c)
Helper method: implements exception safe addition.
difference_type operator-(const const_iterator &y) const
Iterator difference: computes distances.
Base_Traits::difference_type difference_type
Generator last_generator
The last successfully computed feasible or optimizing point.
dimension_type internal_space_dim
The space dimension of the current (partial) solution of the MIP problem; it may be smaller than exte...
The MIP problem is unbounded; a feasible solution has been computed.
#define PPL_USED(v)
No-op macro that allows to avoid unused variable warnings from the compiler.
Control_Parameter_Value pricing
The pricing method in use.
size_t memory_size_type
An unsigned integral type for representing memory size in bytes.
void set_control_parameter(Control_Parameter_Value value)
Sets control parameter value.
dimension_type external_space_dim
The dimension of the vector space.
memory_size_type external_memory_in_bytes() const
Returns the size in bytes of the memory managed by *this.
static dimension_type max_space_dimension()
Returns the maximum space dimension a Constraint can handle.
dimension_type first_pending_constraint
The first index of `input_cs' containing a pending constraint.
memory_size_type external_memory_in_bytes() const
Returns the size in bytes of the memory managed by *this.
reference operator*() const
Returns a reference to the "pointed" object.
static dimension_type max_space_dimension()
Returns the maximum space dimension an MIP_Problem can handle.
MIP_Problem(dimension_type dim=0)
Builds a trivial MIP problem.
dimension_type space_dimension() const
Returns the space dimension of the MIP problem.
The MIP problem is satisfiable; a feasible solution has been computed.