Page principale | Hiérarchie des classes | Liste des composants | Liste des fichiers | Composants

csproblem.h

00001 
00002 /* Finite domain CSP class */
00003 class CSProblem : public OpProblem
00004 { public :
00005 
00007 /* constraint number */
00008   int nbconst;
00009 
00011 /* domain array : each domain is implemented by a vector of integers */
00012   vector<int>* tabdomains;  
00014 /* maximum domain size */
00015   int domainsize;
00017 /* for each variable, domain number : index in tabdomains array */
00018   int* domains;
00020 /* connections table : for each variable, vector of connected variables */
00021   vector<int>* connections;
00023 /* constructor */
00024   CSProblem (int nbvar, int nbconst);
00026 /* constructor with lower bound (stopping condition when it is reached) */
00027   CSProblem (int nbvar, int nbconst, int lower);
00028   ~CSProblem();
00029   void move_execution(Configuration* configuration, Move* move);
00031 /* the domain size of variable var */
00032   virtual int variable_domainsize (int var);
00033   void random_configuration(Configuration* configuration);
00035 /* a variable randomly chosen */
00036   virtual int random_variable(Configuration* configuration);
00037 /* a variable taking part to a conflict in the configuration */
00038   virtual int random_conflict_variable(Configuration* configuration);
00040 /* a value for variable var, randomly chosen in its domain, if possible distinct with val : returns the index of the value in the domain */
00041   virtual int random_value(int var,int val);
00043 /* a value in the domain minimizing the conflict with the configuration (implementation of Minton min-conflict heuristics) 
00044 returns the index of the value in the domain */
00045   virtual int min_conflict_value(int var,int val, Configuration * configuration);
00047 /* standard domain initialization : a unique domain number 0 for all variables */
00048   virtual void init_domains(int nbvar, int s );
00050 /* standard unique domain : integers from 0 to s-1 */
00051   virtual void init_tabdomains(int s);
00053 /* compute the variables in conflict : rebuilding the vector of conflict variables of the configuration*/
00054   void compute_var_conflict(Configuration* configuration);
00055   void best_config_analysis();
00056   void best_config_write();
00057   int move_evaluation(Configuration* configuration,Move* move);
00058   void init_population (Configuration** population,int populationsize);
00059   Configuration* create_configuration();
00060   Move* create_move();
00061   void adjust_parameters(Configuration* configuration, int & maxneighbors, int & minneighbors);
00062   void next_move(Configuration* configuration, Move* move, NeighborhoodSearch* nbhs);   
00064 /* set the domains and connections of a problem */
00065   virtual  void set_domains_connections( int* dom, vector<int>* tabledom, vector<int> * connect );
00067 /* initialization of the domains : call init_domains and init_tabdomains */
00068   virtual void init_domain_tabdomain();
00069 };
00070 
00071 
00073 /* Binary CSPs : addition of the constraints array */ 
00074 class BinaryCSProblem : public CSProblem
00075 { public :
00079 /* for a couple (i,j) of variables, (i<j) , constraints[i][j] returns the constraint number + 1 if the variables are connected, 0 si the variables are not connected. It is assumed that at most one constraint exists between two variables
00080 (if not use WeightExtensionBinaryCSP class) */
00081   int** constraints;
00082   BinaryCSProblem( int nbvar, int nbconst);
00083   BinaryCSProblem (int nbvar, int nbconst, int lower);
00084   ~BinaryCSProblem() {;};
00085 };
00086 
00087 
00088 
00089 
00090 int** csp_constraintdatastructure(int nbvar);

Généré le Fri Sep 26 16:54:19 2003 pour INCOP par doxygen 1.3.3