aGrUM
3.2.0
a C++ library for (probabilistic) graphical models
Toggle main menu visibility
decisionTensor.h
Go to the documentation of this file.
1
/****************************************************************************
2
* This file is part of the aGrUM/pyAgrum library. *
3
* *
4
* Copyright (c) 2005-2026 by *
5
* - Pierre-Henri WUILLEMIN(_at_LIP6) *
6
* - Christophe GONZALES(_at_AMU) *
7
* *
8
* The aGrUM/pyAgrum library is free software; you can redistribute it *
9
* and/or modify it under the terms of either : *
10
* *
11
* - the GNU Lesser General Public License as published by *
12
* the Free Software Foundation, either version 3 of the License, *
13
* or (at your option) any later version, *
14
* - the MIT license (MIT), *
15
* - or both in dual license, as here. *
16
* *
17
* (see https://agrum.gitlab.io/articles/dual-licenses-lgplv3mit.html) *
18
* *
19
* This aGrUM/pyAgrum library is distributed in the hope that it will be *
20
* useful, but WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
21
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES MERCHANTABILITY or FITNESS *
22
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
23
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
24
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, *
25
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR *
26
* OTHER DEALINGS IN THE SOFTWARE. *
27
* *
28
* See LICENCES for more details. *
29
* *
30
* SPDX-FileCopyrightText: Copyright 2005-2026 *
31
* - Pierre-Henri WUILLEMIN(_at_LIP6) *
32
* - Christophe GONZALES(_at_AMU) *
33
* SPDX-License-Identifier: LGPL-3.0-or-later OR MIT *
34
* *
35
* Contact : info_at_agrum_dot_org *
36
* homepage : http://agrum.gitlab.io *
37
* gitlab : https://gitlab.com/agrumery/agrum *
38
* *
39
****************************************************************************/
40
41
49
#ifndef GUM_DECISIONTENSOR_H
50
#define GUM_DECISIONTENSOR_H
51
52
#include <
agrum/base/multidim/tensor.h
>
53
54
#include <string_view>
55
56
namespace
gum
{
62
template
< GUM_Numeric GUM_SCALAR >
63
class
DecisionTensor
{
64
public
:
65
Tensor< GUM_SCALAR >
probPot
;
66
Tensor< GUM_SCALAR >
utilPot
;
67
68
explicit
DecisionTensor
();
69
70
~DecisionTensor
();
71
72
DecisionTensor
(
const
Tensor< GUM_SCALAR >& prob,
const
Tensor< GUM_SCALAR >& util);
73
74
DecisionTensor
(
const
DecisionTensor< GUM_SCALAR >
& dp);
75
76
void
clear
();
77
78
DecisionTensor< GUM_SCALAR >
&
operator=
(
const
DecisionTensor< GUM_SCALAR >
& src);
79
80
DecisionTensor
(
DecisionTensor< GUM_SCALAR >
&& dp);
81
82
DecisionTensor< GUM_SCALAR >
&
operator=
(
DecisionTensor< GUM_SCALAR >
&& src);
83
84
bool
operator==
(
const
DecisionTensor< GUM_SCALAR >
& p)
const
;
85
86
const
DiscreteVariable
*
variable
(std::string_view name)
const
;
87
88
void
insertProba
(
const
gum::Tensor< GUM_SCALAR >
& proba);
89
90
void
insertUtility
(
const
gum::Tensor< GUM_SCALAR >
& util);
91
92
DecisionTensor< GUM_SCALAR >
operator*
(
const
DecisionTensor< GUM_SCALAR >
& dp1)
const
;
93
94
DecisionTensor< GUM_SCALAR >
operator*=
(
const
DecisionTensor< GUM_SCALAR >
& dp1);
95
96
DecisionTensor< GUM_SCALAR >
operator^
(
const
gum::VariableSet
& onto)
const
;
97
98
DecisionTensor< GUM_SCALAR >
operator^
(
const
std::vector< std::string >& ontonames)
const
;
99
100
static
Tensor< GUM_SCALAR >
divideEvenZero
(
const
Tensor< GUM_SCALAR >& p1,
101
const
Tensor< GUM_SCALAR >& p2);
102
103
static
DecisionTensor< GUM_SCALAR >
combination
(
const
DecisionTensor< GUM_SCALAR >
& dp1,
104
const
DecisionTensor< GUM_SCALAR >
& dp2);
105
106
static
DecisionTensor< GUM_SCALAR >
marginalization
(
const
DecisionTensor< GUM_SCALAR >
& dp,
107
const
gum::VariableSet
& onto);
108
109
static
DecisionTensor< GUM_SCALAR >
110
marginalization
(
const
DecisionTensor< GUM_SCALAR >
& dp,
111
const
std::vector< std::string >& ontonames);
112
113
std::pair< GUM_SCALAR, GUM_SCALAR >
meanVar
();
114
115
virtual
std::string
toString
()
const
;
116
};
117
118
template
< GUM_Numeric GUM_SCALAR >
119
std::ostream&
operator<<
(std::ostream& out,
const
DecisionTensor< GUM_SCALAR >
& array);
120
}
// namespace gum
121
122
#include <
agrum/ID/inference/tools/decisionTensor_tpl.h
>
123
124
#endif
// GUM_DECISIONTENSOR_H
gum::DecisionTensor
<agrum/ID/inference/decisionTensor.h>
Definition
decisionTensor.h:63
gum::DecisionTensor::operator==
bool operator==(const DecisionTensor< GUM_SCALAR > &p) const
Definition
decisionTensor_tpl.h:109
gum::DecisionTensor::marginalization
static DecisionTensor< GUM_SCALAR > marginalization(const DecisionTensor< GUM_SCALAR > &dp, const gum::VariableSet &onto)
Definition
decisionTensor_tpl.h:183
gum::DecisionTensor::insertProba
void insertProba(const gum::Tensor< GUM_SCALAR > &proba)
Definition
decisionTensor_tpl.h:128
gum::DecisionTensor::meanVar
std::pair< GUM_SCALAR, GUM_SCALAR > meanVar()
Definition
decisionTensor_tpl.h:201
gum::DecisionTensor::divideEvenZero
static Tensor< GUM_SCALAR > divideEvenZero(const Tensor< GUM_SCALAR > &p1, const Tensor< GUM_SCALAR > &p2)
Definition
decisionTensor_tpl.h:164
gum::DecisionTensor::toString
virtual std::string toString() const
Definition
decisionTensor_tpl.h:212
gum::DecisionTensor::DecisionTensor
DecisionTensor()
Definition
decisionTensor_tpl.h:48
gum::DecisionTensor::operator=
DecisionTensor< GUM_SCALAR > & operator=(const DecisionTensor< GUM_SCALAR > &src)
Definition
decisionTensor_tpl.h:90
gum::DecisionTensor::clear
void clear()
Definition
decisionTensor_tpl.h:80
gum::DecisionTensor::insertUtility
void insertUtility(const gum::Tensor< GUM_SCALAR > &util)
Definition
decisionTensor_tpl.h:133
gum::DecisionTensor::operator^
DecisionTensor< GUM_SCALAR > operator^(const gum::VariableSet &onto) const
Definition
decisionTensor_tpl.h:152
gum::DecisionTensor::variable
const DiscreteVariable * variable(std::string_view name) const
Definition
decisionTensor_tpl.h:116
gum::DecisionTensor::operator*
DecisionTensor< GUM_SCALAR > operator*(const DecisionTensor< GUM_SCALAR > &dp1) const
Definition
decisionTensor_tpl.h:139
gum::DecisionTensor::utilPot
Tensor< GUM_SCALAR > utilPot
Definition
decisionTensor.h:66
gum::DecisionTensor::operator*=
DecisionTensor< GUM_SCALAR > operator*=(const DecisionTensor< GUM_SCALAR > &dp1)
Definition
decisionTensor_tpl.h:145
gum::DecisionTensor::probPot
Tensor< GUM_SCALAR > probPot
Definition
decisionTensor.h:65
gum::DecisionTensor::combination
static DecisionTensor< GUM_SCALAR > combination(const DecisionTensor< GUM_SCALAR > &dp1, const DecisionTensor< GUM_SCALAR > &dp2)
Definition
decisionTensor_tpl.h:176
gum::DiscreteVariable
Base class for discrete random variable.
Definition
discreteVariable.h:80
gum::Tensor
aGrUM's Tensor is a multi-dimensional array with tensor operators.
Definition
tensor.h:85
decisionTensor_tpl.h
gum
gum is the global namespace for all aGrUM entities
Definition
agrum.h:46
gum::VariableSet
Set< const DiscreteVariable * > VariableSet
Definition
discreteVariable.h:192
gum::operator<<
std::ostream & operator<<(std::ostream &stream, const AVLTree< Val, Cmp > &tree)
display the content of a tree
tensor.h
Header of the Tensor class.
aGrUM
3.2.0
© PHW&CG&others - 2022
DoXyGeN 1.18.0