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_defs_hh
00025 #define PPL_PIP_Problem_defs_hh 1
00026
00027 #include "PIP_Problem.types.hh"
00028 #include "PIP_Tree.types.hh"
00029 #include "globals.types.hh"
00030 #include "Linear_Expression.defs.hh"
00031 #include "Constraint.defs.hh"
00032 #include "Constraint_System.types.hh"
00033 #include "Generator.defs.hh"
00034 #include "Variables_Set.defs.hh"
00035 #include <vector>
00036 #include <deque>
00037 #include <iosfwd>
00038
00039 namespace Parma_Polyhedra_Library {
00040
00041 namespace IO_Operators {
00042
00044
00045 std::ostream&
00046 operator<<(std::ostream& s, const PIP_Problem& p);
00047
00048 }
00049
00050 }
00051
00053
00488 class Parma_Polyhedra_Library::PIP_Problem {
00489 public:
00491
00504 explicit PIP_Problem(dimension_type dim = 0);
00505
00533 template <typename In>
00534 PIP_Problem(dimension_type dim, In first, In last,
00535 const Variables_Set& p_vars);
00536
00538 PIP_Problem(const PIP_Problem& y);
00539
00541 ~PIP_Problem();
00542
00544 PIP_Problem& operator=(const PIP_Problem& y);
00545
00547 static dimension_type max_space_dimension();
00548
00550 dimension_type space_dimension() const;
00551
00556 const Variables_Set& parameter_space_dimensions() const;
00557
00558 private:
00560 typedef std::vector<Constraint> Constraint_Sequence;
00561
00562 public:
00567 typedef Constraint_Sequence::const_iterator const_iterator;
00568
00573 const_iterator constraints_begin() const;
00574
00579 const_iterator constraints_end() const;
00580
00582
00585 void clear();
00586
00609 void add_space_dimensions_and_embed(dimension_type m_vars,
00610 dimension_type m_params);
00611
00620 void add_to_parameter_space_dimensions(const Variables_Set& p_vars);
00621
00629 void add_constraint(const Constraint& c);
00630
00638 void add_constraints(const Constraint_System& cs);
00639
00641
00645 bool is_satisfiable() const;
00646
00648
00653 PIP_Problem_Status solve() const;
00654
00656
00659 PIP_Tree solution() const;
00660
00662
00665 PIP_Tree optimizing_solution() const;
00666
00668 bool OK() const;
00669
00671
00682 void print_solution(std::ostream& s, unsigned indent = 0) const;
00683
00684 PPL_OUTPUT_DECLARATIONS
00685
00691 bool ascii_load(std::istream& s);
00692
00694 memory_size_type total_memory_in_bytes() const;
00695
00697 memory_size_type external_memory_in_bytes() const;
00698
00700 void swap(PIP_Problem& y);
00701
00703 enum Control_Parameter_Name {
00705 CUTTING_STRATEGY,
00707 PIVOT_ROW_STRATEGY,
00708 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00709
00710 #endif // PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00711 CONTROL_PARAMETER_NAME_SIZE
00712 };
00713
00715 enum Control_Parameter_Value {
00717 CUTTING_STRATEGY_FIRST,
00719 CUTTING_STRATEGY_DEEPEST,
00721 CUTTING_STRATEGY_ALL,
00722
00724 PIVOT_ROW_STRATEGY_FIRST,
00726 PIVOT_ROW_STRATEGY_MAX_COLUMN,
00727
00728 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00729
00730 #endif // PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00731 CONTROL_PARAMETER_VALUE_SIZE
00732 };
00733
00735 Control_Parameter_Value
00736 get_control_parameter(Control_Parameter_Name name) const;
00737
00739 void set_control_parameter(Control_Parameter_Value value);
00740
00742 void set_big_parameter_dimension(dimension_type big_dim);
00743
00749 dimension_type get_big_parameter_dimension() const;
00750
00751 private:
00753 void control_parameters_init();
00754
00756 void control_parameters_copy(const PIP_Problem& y);
00757
00759 dimension_type external_space_dim;
00760
00765 dimension_type internal_space_dim;
00766
00768 enum Status {
00770 UNSATISFIABLE,
00772 OPTIMIZED,
00778 PARTIALLY_SATISFIABLE
00779 };
00780
00782 Status status;
00783
00785 PIP_Tree_Node* current_solution;
00786
00788 Constraint_Sequence input_cs;
00789
00791 dimension_type first_pending_constraint;
00792
00797 Variables_Set parameters;
00798
00804 Matrix initial_context;
00805
00807 Control_Parameter_Value
00808 control_parameters[CONTROL_PARAMETER_NAME_SIZE];
00809
00814 dimension_type big_parameter_dimension;
00815
00816 friend class PIP_Solution_Node;
00817 };
00818
00819 namespace std {
00820
00822
00823 void swap(Parma_Polyhedra_Library::PIP_Problem& x,
00824 Parma_Polyhedra_Library::PIP_Problem& y);
00825
00826 }
00827
00828 #include "PIP_Problem.inlines.hh"
00829 #include "PIP_Problem.templates.hh"
00830
00831 #endif // !defined(PPL_PIP_Problem_defs_hh)