Go to the documentation of this file.00001 #ifndef mmn_csp_solver_h_
00002 #define mmn_csp_solver_h_
00003
00004
00005
00006
00007
00008 #include <vcl_vector.h>
00009 #include <vcl_set.h>
00010 #include <mmn/mmn_arc.h>
00011 #include <mmn/mmn_dependancy.h>
00012 #include <mmn/mmn_graph_rep1.h>
00013 #include <mbl/mbl_stl_pred.h>
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 class mmn_csp_solver
00024 {
00025 public:
00026
00027 typedef vcl_set<unsigned> label_subset_t;
00028
00029
00030
00031
00032
00033 typedef vcl_set<vcl_pair<unsigned ,unsigned >, mbl_stl_pred_pair_order<unsigned ,unsigned > > arc_labels_subset_t;
00034
00035 typedef vcl_multiset<vcl_pair<unsigned ,unsigned >,
00036 mbl_stl_pred_pair_key_order<vcl_pair<unsigned ,unsigned > > > arc_labels_subset_t1;
00037
00038 typedef vcl_multiset<vcl_pair<unsigned ,unsigned >,
00039 mbl_stl_pred_pair_value_order<vcl_pair<unsigned ,unsigned > > > arc_labels_subset_t2;
00040
00041 private:
00042 unsigned nnodes_;
00043
00044 bool verbose_;
00045
00046
00047 vcl_vector<label_subset_t > node_labels_present_;
00048
00049
00050
00051
00052
00053 vcl_vector<arc_labels_subset_t1 > arc_labels_linked1_;
00054 vcl_vector<arc_labels_subset_t2 > arc_labels_linked2_;
00055
00056 mmn_graph_rep1 graph_;
00057
00058
00059 vcl_vector<mmn_arc> arcs_;
00060
00061
00062
00063 bool check_for_node_deletions();
00064
00065
00066
00067 bool check_for_arc_deletions();
00068
00069 void initialise_arc_labels_linked(const vcl_vector<mmn_csp_solver:: arc_labels_subset_t >& links_subset);
00070
00071 void init();
00072 public:
00073
00074 mmn_csp_solver();
00075
00076
00077 mmn_csp_solver(unsigned num_nodes,const vcl_vector<mmn_arc>& arcs);
00078
00079
00080 void set_arcs(unsigned num_nodes,const vcl_vector<mmn_arc>& arcs);
00081
00082 bool operator()(const vcl_vector<mmn_csp_solver::label_subset_t >& node_labels_subset,
00083 const vcl_vector<mmn_csp_solver::arc_labels_subset_t >& links_subset);
00084
00085 void set_verbose(bool verbose) {verbose_=verbose;}
00086 const vcl_vector<label_subset_t >& kernel_node_labels() const {return node_labels_present_;}
00087 };
00088
00089 #endif // mmn_csp_solver_h_