aGrUM  0.14.2
variableselector.h
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) 2005 by Christophe GONZALES and Pierre-Henri WUILLEMIN *
3  * {prenom.nom}_at_lip6.fr *
4  * *
5  * This program is free software; you can redistribute it and/or modify *
6  * it under the terms of the GNU General Public License as published by *
7  * the Free Software Foundation; either version 2 of the License, or *
8  * (at your option) any later version. *
9  * *
10  * This program is distributed in the hope that it will be useful, *
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13  * GNU General Public License for more details. *
14  * *
15  * You should have received a copy of the GNU General Public License *
16  * along with this program; if not, write to the *
17  * Free Software Foundation, Inc., *
18  * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19  ***************************************************************************/
27 // =========================================================================
28 #ifndef GUM_VARIABLE_SELECTOR_H
29 #define GUM_VARIABLE_SELECTOR_H
30 // =========================================================================
32 #include <agrum/core/set.h>
33 // =========================================================================
35 // =========================================================================
36 
37 namespace gum {
38 
50  public:
51  // ==========================================================================
53  // ==========================================================================
55 
56  // ###################################################################
58  // ###################################################################
60 
61  // ###################################################################
63  // ###################################################################
65 
67 
68  // ==========================================================================
70  // ==========================================================================
72 
73  // ###################################################################
75  // ###################################################################
76  void updateScore(const DiscreteVariable* var,
77  double score,
78  double secondaryscore);
79  void downdateScore(const DiscreteVariable* var,
80  double score,
81  double secondaryscore);
82 
83 
84  // ###################################################################
86  // ###################################################################
87  const DiscreteVariable* select();
88 
89  bool isEmpty() { return __remainingVars.empty(); }
90 
91  void begin() { __rvi = __remainingVars.beginSafe(); }
92  bool hasNext() { return __rvi != __remainingVars.endSafe(); }
93  void next() { ++__rvi; }
94  const DiscreteVariable* current() { return *__rvi; }
95 
96  private:
97  void __addVar(const DiscreteVariable* var);
98  void __removeVar(const DiscreteVariable* var);
99 
103 
106 
110 
113 
116  };
117 
118 } // namespace gum
119 
120 #endif // GUM_VARIABLE_SELECTOR_H
Priority queues in which the same element can appear several times.
HashTable< const DiscreteVariable *, double > __remainingVarsScore
HashTable associating to each variable its score.
Base class for discrete random variable.
HashTable< const DiscreteVariable *, double > __remainingVarsOtherScore
HashTable associating to each variable its 2nd score.
Sets of elements (i.e.
Safe iterators for the Set classDevelopers may consider using Set<x>::iterator_safe instead of SetIte...
Definition: set.h:808
void downdateScore(const DiscreteVariable *var, double score, double secondaryscore)
The set of remaining vars to select among.
Base class for discrete random variable.
gum is the global namespace for all aGrUM entities
Definition: agrum.h:25
SetIteratorSafe< const DiscreteVariable *> __rvi
The set of remaining vars to select among.
MultiPriorityQueue< double, double, std::greater< double > > __remainingScores
Heap keeping best score on top for immediate access.
The class for generic Hash Tables.
Definition: hashTable.h:676
Representation of a setA Set is a structure that contains arbitrary elements.
Definition: set.h:162
void begin()
The set of remaining vars to select among.
~VariableSelector()
Default destructor.
Set< const DiscreteVariable *> __remainingVars
The set of remaining vars to select among.
void __removeVar(const DiscreteVariable *var)
The set of remaining vars to select among.
bool hasNext()
The set of remaining vars to select among.
const DiscreteVariable * select()
Select the most relevant variable.
void __addVar(const DiscreteVariable *var)
The set of remaining vars to select among.
<agrum/FMDP/planning/FunctionGraph/variableselector.h>
bool isEmpty()
The set of remaining vars to select among.
void updateScore(const DiscreteVariable *var, double score, double secondaryscore)
The set of remaining vars to select among.
void next()
The set of remaining vars to select among.
HashTable< double, Set< const DiscreteVariable *> *> __remainingVarsByScore
HashTable associating to each score the set of variable having that score.
const DiscreteVariable * current()
The set of remaining vars to select among.
VariableSelector(Set< const DiscreteVariable * > &startingSet)
Default constructor.
A MultiPriorityQueue is a heap in which each element has a mutable priority and duplicates are allowe...