00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef PPL_PIP_Problem_templates_hh
00025 #define PPL_PIP_Problem_templates_hh 1
00026
00027 #include "Variables_Set.defs.hh"
00028
00029 namespace Parma_Polyhedra_Library {
00030
00031 template <typename In>
00032 PIP_Problem::PIP_Problem(dimension_type dim,
00033 In first,
00034 In last,
00035 const Variables_Set& p_vars)
00036 : external_space_dim(dim),
00037 internal_space_dim(0),
00038 status(PARTIALLY_SATISFIABLE),
00039 current_solution(0),
00040 input_cs(),
00041 first_pending_constraint(0),
00042 parameters(p_vars),
00043 initial_context(),
00044 big_parameter_dimension(not_a_dimension()) {
00045
00046
00047 if (p_vars.space_dimension() > external_space_dim) {
00048 std::ostringstream s;
00049 s << "PPL::PIP_Problem::PIP_Problem(dim, first, last, p_vars):\n"
00050 << "dim == " << external_space_dim
00051 << " and p_vars.space_dimension() == "
00052 << p_vars.space_dimension()
00053 << " are dimension incompatible.";
00054 throw std::invalid_argument(s.str());
00055 }
00056
00057
00058 if (dim > max_space_dimension())
00059 throw std::length_error("PPL::PIP_Problem::"
00060 "PIP_Problem(dim, first, last, p_vars):\n"
00061 "dim exceeds the maximum allowed "
00062 "space dimension.");
00063
00064 for (In i = first; i != last; ++i) {
00065 if (i->space_dimension() > dim) {
00066 std::ostringstream s;
00067 s << "PPL::PIP_Problem::"
00068 << "PIP_Problem(dim, first, last, p_vars):\n"
00069 << "range [first, last) contains a constraint having space "
00070 << "dimension == " << i->space_dimension()
00071 << " that exceeds this->space_dimension == " << dim << ".";
00072 throw std::invalid_argument(s.str());
00073 }
00074 input_cs.push_back(*i);
00075 }
00076 control_parameters_init();
00077 PPL_ASSERT(OK());
00078 }
00079
00080 }
00081
00082 #endif // !defined(PPL_PIP_Problem_templates_hh)