aGrUM  0.14.2
orderedTriangulation.cpp
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 #include <agrum/agrum.h>
28 
30 
31 namespace gum {
32 
36  const JunctionTreeStrategy& JTStrategy,
37  bool minimality) :
38  StaticTriangulation(elimSeq, JTStrategy, minimality) {
39  // for debugging purposes
40  GUM_CONSTRUCTOR(OrderedTriangulation);
41  }
42 
45  const UndiGraph* theGraph,
46  const NodeProperty< Size >* dom,
47  const std::vector< NodeId >* order,
49  const JunctionTreeStrategy& JTStrategy,
50  bool minimality) :
51  StaticTriangulation(theGraph, dom, elimSeq, JTStrategy, minimality),
52  __order(order) {
53  static_cast< OrderedEliminationSequenceStrategy* >(
55  ->setOrder(__order);
56 
57  // for debugging purposes
58  GUM_CONSTRUCTOR(OrderedTriangulation);
59  }
60 
61  // copy constructor
63  StaticTriangulation(from), __order(from.__order) {
64  // for debugging purposes
65  GUM_CONS_CPY(OrderedTriangulation);
66  }
67 
68  // move constructor
70  StaticTriangulation(std::move(from)), __order(from.__order) {
71  // for debugging purposes
72  GUM_CONS_MOV(OrderedTriangulation);
73  }
74 
77  return new OrderedTriangulation(
78  static_cast< const OrderedEliminationSequenceStrategy& >(
81  }
82 
85  return new OrderedTriangulation(*this);
86  }
87 
90  // for debugging purposes
91  GUM_DESTRUCTOR(OrderedTriangulation);
92  }
93 
96  const NodeProperty< Size >* domsizes) {
97  StaticTriangulation::setGraph(graph, domsizes);
98  static_cast< OrderedEliminationSequenceStrategy* >(
100  ->setOrder(__order);
101  }
102 
104  void OrderedTriangulation::setOrder(const std::vector< NodeId >* order) {
105  __order = order;
106  static_cast< OrderedEliminationSequenceStrategy* >(
108  ->setOrder(__order);
109  }
110 
114  static_cast< OrderedEliminationSequenceStrategy* >(
116  elim->setGraph(&graph, _domain_sizes);
117  elim->setOrder(__order);
118  }
119 
120 } /* namespace gum */
virtual ~OrderedTriangulation()
destructor
An Elimination sequence algorithm that imposes a given complete ordering on the nodes elimination seq...
EliminationSequenceStrategy * _elimination_sequence_strategy
the elimination sequence strategy used by the triangulation
STL namespace.
virtual bool setGraph(UndiGraph *graph, const NodeProperty< Size > *dom_sizes) final
sets a new graph to be triangulated
virtual bool setOrder(const std::vector< NodeId > *order) final
sets the sequence of elimination
JunctionTreeStrategy * _junction_tree_strategy
the junction tree strategy used by the triangulation
gum is the global namespace for all aGrUM entities
Definition: agrum.h:25
OrderedTriangulation(const OrderedEliminationSequenceStrategy &elimSeq=OrderedEliminationSequenceStrategy(), const JunctionTreeStrategy &JTStrategy=DefaultJunctionTreeStrategy(), bool minimality=false)
default constructor
The class for generic Hash Tables.
Definition: hashTable.h:676
const NodeProperty< Size > * _domain_sizes
the domain sizes of the variables/nodes of the graph
virtual OrderedTriangulation * copyFactory() const final
virtual copy constructor
Base Class for all the algorithms producing a junction given a set of cliques/subcliques resulting fr...
const std::vector< NodeId > * __order
the elimination sequence to apply
class for graph triangulations for which we enforce a given complete ordering on the nodes eliminatio...
virtual void setOrder(const std::vector< NodeId > *order) final
sets the sequence of elimination (only the reference is stored)
virtual void _initTriangulation(UndiGraph &graph) final
the function called to initialize the triangulation process
virtual OrderedTriangulation * newFactory() const final
returns a fresh triangulation over the same graph and of the same type as the current object (using t...
class for graph triangulations for which we enforce a given complete ordering on the nodes eliminatio...
base class for all non-incremental triangulation methods
Base class for undirected graphs.
Definition: undiGraph.h:106
virtual void setGraph(const UndiGraph *graph, const NodeProperty< Size > *domsizes)
initialize the triangulation data structures for a new graph
virtual void setGraph(const UndiGraph *graph, const NodeProperty< Size > *domsizes) final
initialize the triangulation data structures for a new graph