![]() |
aGrUM 2.3.2
a C++ library for (probabilistic) graphical models
|
a Projection operator class used for scheduling inferences More...
#include <agrum/graphicalModels/inference/scheduleProjection.h>
Public Member Functions | |
Constructors / Destructors | |
| ScheduleProjection (const ScheduleMultiDim< TABLE > &table, const gum::VariableSet &del_vars, TABLE(*project)(const TABLE &, const gum::VariableSet &), const bool is_result_persistent=false) | |
| default constructor | |
| ScheduleProjection (const ScheduleProjection< TABLE > &from) | |
| copy constructor | |
| ScheduleProjection (ScheduleProjection< TABLE > &&from) | |
| move constructor | |
| ScheduleProjection< TABLE > * | clone () const final |
| virtual copy constructor | |
| virtual | ~ScheduleProjection () |
| destructor | |
Operators | |
| ScheduleProjection< TABLE > & | operator= (const ScheduleProjection< TABLE > &) |
| copy operator | |
| ScheduleProjection< TABLE > & | operator= (ScheduleProjection< TABLE > &&) |
| move operator | |
| bool | operator== (const ScheduleOperator &) const final |
| operator == | |
| bool | operator!= (const ScheduleOperator &) const final |
| operator != | |
| virtual bool | operator== (const ScheduleProjection< TABLE > &) const |
| operator == | |
| virtual bool | operator!= (const ScheduleProjection< TABLE > &) const |
| operator != | |
Accessors/Modifiers | |
| bool | hasSameArguments (const ScheduleOperator &) const final |
| checks whether two ScheduleProjection have the same parameters (same variables, including the set of variables to delete, and same content) | |
| bool | hasSameArguments (const ScheduleProjection< TABLE > &) const |
| checks whether two ScheduleProjection have the same parameters (same variables, including the set of variables to delete, and same content) | |
| bool | hasSimilarArguments (const ScheduleOperator &) const final |
| checks whether two ScheduleProjection have similar parameters (same variables, including the set of variables to delete) | |
| bool | hasSimilarArguments (const ScheduleProjection< TABLE > &) const |
| checks whether two ScheduleProjection have similar parameters (same variables, including the set of variables to delete) | |
| bool | isSameOperator (const ScheduleOperator &) const final |
| checks whether two ScheduleOperator perform the same projection | |
| bool | isSameOperator (const ScheduleProjection< TABLE > &) const |
| checks whether two ScheduleOperator perform the same projection | |
| const ScheduleMultiDim< TABLE > & | arg () const |
| returns the argument of the projection | |
| const Sequence< const IScheduleMultiDim * > & | args () const final |
| returns the sequence of arguments passed to the operator | |
| const ScheduleMultiDim< TABLE > & | result () const |
| returns the result of the projection | |
| const Sequence< const IScheduleMultiDim * > & | results () const final |
| returns the sequence of ScheduleMultidim output by the operator | |
| void | updateArgs (const Sequence< const IScheduleMultiDim * > &new_args) final |
| modifies the arguments of the operator | |
| bool | isExecuted () const final |
| indicates whether the operator has been executed | |
| void | execute () final |
| executes the operator | |
| void | undo () final |
| undo a previous execution, if any | |
| double | nbOperations () const final |
| returns an estimation of the number of elementary operations needed to perform the ScheduleOperator | |
| std::pair< double, double > | memoryUsage () const final |
| returns the memory consumption used during the execution of the operator | |
| std::string | toString () const final |
| displays the content of the operator | |
| void | setProjectionFunction (TABLE(*project)(const TABLE &, const gum::VariableSet &)) |
| use a new projection function | |
Accessors/Modifiers | |
| ScheduleOperatorType | type () const |
| returns the type of the operator | |
| bool | implyDeletion () const |
| indicates whether the operator deletes some of its arguments | |
| void | makeResultsPersistent (const bool is_persistent) |
| makes the results of the operator persistent or not | |
| bool | hasPersistentResults () const |
| shows whether the operator has persistent results | |
Private Attributes | |
| const ScheduleMultiDim< TABLE > * | _arg_ {nullptr} |
| the argument to be projected | |
| Sequence< const IScheduleMultiDim * > | _args_ |
| the sequence of arguments passed to the operator | |
| ScheduleMultiDim< TABLE > * | _result_ {nullptr} |
| the result of the projection | |
| Sequence< const IScheduleMultiDim * > | _results_ |
| the sequence of ScheduleMultidim output by the operator | |
| gum::VariableSet | _del_vars_ |
| the set of variables that should be removed from the arg table | |
| TABLE(* | _project_ )(const TABLE &, const gum::VariableSet &) |
| the projection operator | |
| ScheduleOperatorType | _op_type_ |
| the name of the operator to perform | |
| bool | _imply_deletion_ |
| indicates whether the operator will delete some of the ScheduleMultiDim passed as its arguments | |
| bool | _result_persistent_ |
| is the result persistent | |
a Projection operator class used for scheduling inferences
ScheduleProjection is a generic wrapper designed to project efficiently a ScheduleMultiDim objects over a subset of its variables.
To be quite generic, the ScheduleProjection takes in argument the function that produces the result of the projection of the object contained inside the ScheduleMultiDim. Note that executing a ScheduleProjection will always produce a freshly allocated table. The following code gives an example of the usage of ScheduleProjection:
Definition at line 103 of file scheduleProjection.h.
|
explicit |
default constructor
| table | the ScheduleMultiDim containing the table that will be projected |
| del_vars | the set of variables that will be removed from table. Note that variables in del_vars that do not belong to table are simply not taken into account. They do not raise any exception. |
| project | the function that will actually perform the projection |
| is_result_persistent | this boolean indicates whether the result of the projection is persistent, i.e., whether it should be kept in memory when the operator itself is deleted from memory. |
Referenced by ScheduleProjection(), ScheduleProjection(), ~ScheduleProjection(), clone(), hasSameArguments(), hasSimilarArguments(), isSameOperator(), operator!=(), operator=(), operator=(), and operator==().
| gum::ScheduleProjection< TABLE >::ScheduleProjection | ( | const ScheduleProjection< TABLE > & | from | ) |
| gum::ScheduleProjection< TABLE >::ScheduleProjection | ( | ScheduleProjection< TABLE > && | from | ) |
|
virtual |
destructor
References ScheduleProjection().
| const ScheduleMultiDim< TABLE > & gum::ScheduleProjection< TABLE >::arg | ( | ) | const |
|
finalvirtual |
returns the sequence of arguments passed to the operator
Implements gum::ScheduleOperator.
References args().
Referenced by args().
|
finalvirtual |
virtual copy constructor
Implements gum::ScheduleOperator.
References ScheduleProjection().
|
finalvirtual |
executes the operator
This method guarantees that the result of the combination is a stored into a newly allocated table
Implements gum::ScheduleOperator.
References execute().
Referenced by execute().
|
inherited |
shows whether the operator has persistent results
|
finalvirtual |
checks whether two ScheduleProjection have the same parameters (same variables, including the set of variables to delete, and same content)
ScheduleMultiDim Parameters having the same variables and the same content are essentially identical but they may have different Ids (so that they may not be ==).
Implements gum::ScheduleOperator.
References gum::ScheduleOperator::ScheduleOperator(), and hasSameArguments().
Referenced by hasSameArguments(), and hasSameArguments().
| bool gum::ScheduleProjection< TABLE >::hasSameArguments | ( | const ScheduleProjection< TABLE > & | ) | const |
checks whether two ScheduleProjection have the same parameters (same variables, including the set of variables to delete, and same content)
ScheduleMultiDim Parameters having the same variables and the same content are essentially identical but they may have different Ids (so that they may not be ==).
References ScheduleProjection(), and hasSameArguments().
|
finalvirtual |
checks whether two ScheduleProjection have similar parameters (same variables, including the set of variables to delete)
ScheduleMultiDim Parameters having the same variables and the same content are essentially identical but they may have different Ids (so that they may not be ==).
Implements gum::ScheduleOperator.
References gum::ScheduleOperator::ScheduleOperator(), and hasSimilarArguments().
Referenced by hasSimilarArguments(), and hasSimilarArguments().
| bool gum::ScheduleProjection< TABLE >::hasSimilarArguments | ( | const ScheduleProjection< TABLE > & | ) | const |
checks whether two ScheduleProjection have similar parameters (same variables, including the set of variables to delete)
ScheduleMultiDim Parameters having the same variables and the same content are essentially identical but they may have different Ids (so that they may not be ==).
References ScheduleProjection(), and hasSimilarArguments().
|
inherited |
indicates whether the operator deletes some of its arguments
|
finalvirtual |
indicates whether the operator has been executed
Implements gum::ScheduleOperator.
References isExecuted().
Referenced by isExecuted().
|
finalvirtual |
checks whether two ScheduleOperator perform the same projection
Reimplemented from gum::ScheduleOperator.
References gum::ScheduleOperator::ScheduleOperator(), and isSameOperator().
Referenced by isSameOperator(), and isSameOperator().
| bool gum::ScheduleProjection< TABLE >::isSameOperator | ( | const ScheduleProjection< TABLE > & | ) | const |
checks whether two ScheduleOperator perform the same projection
References ScheduleProjection(), and isSameOperator().
|
inherited |
makes the results of the operator persistent or not
Unlike non-persistent results, a persistent one is not destroyed when the operator itself is destroyed
|
finalvirtual |
returns the memory consumption used during the execution of the operator
Actually, this function does not return a precise account of the memory used by the ScheduleOperator but a rough estimate based on the sizes of the tables involved in the operator.
Implements gum::ScheduleOperator.
References memoryUsage().
Referenced by memoryUsage().
|
finalvirtual |
returns an estimation of the number of elementary operations needed to perform the ScheduleOperator
Implements gum::ScheduleOperator.
References nbOperations().
Referenced by nbOperations().
|
finalvirtual |
operator !=
Two operators are different if and only if they either have different (!=) ScheduleMultiDim arguments or they have different sets of variables to project on, or they perform different operations (e.g., one performs a max projection and the other a min projection). Different ScheduleMultiDim arguments means that the latter differ by their Ids.
Reimplemented from gum::ScheduleOperator.
References gum::ScheduleOperator::ScheduleOperator().
|
virtual |
operator !=
Two operators are different if and only if they either have different (!=) ScheduleMultiDim arguments or they have different sets of variables to project on, or they perform different operations (e.g., one performs a max projection and the other a min projection). Different ScheduleMultiDim arguments means that the latter differ by their Ids.
References ScheduleProjection().
| ScheduleProjection< TABLE > & gum::ScheduleProjection< TABLE >::operator= | ( | const ScheduleProjection< TABLE > & | ) |
| ScheduleProjection< TABLE > & gum::ScheduleProjection< TABLE >::operator= | ( | ScheduleProjection< TABLE > && | ) |
|
finalvirtual |
operator ==
Two operators are identical if and only if they have equal (==) ScheduleMultiDim arguments, the same set of variables to project on, and they perform exactly the same set of operations (e.g., both perform a max projection). By Equal arguments, we stress that we mean that these ScheduleMultiDims have the same IDs
Reimplemented from gum::ScheduleOperator.
References gum::ScheduleOperator::ScheduleOperator().
|
virtual |
operator ==
Two operators are identical if and only if they have equal (==) ScheduleMultiDim arguments, the same set of variables to project on, and they perform exactly the same set of operations (e.g., both perform a max projection). By Equal arguments, we mean that these ScheduleMultiDims have the same IDs
References ScheduleProjection().
| const ScheduleMultiDim< TABLE > & gum::ScheduleProjection< TABLE >::result | ( | ) | const |
|
finalvirtual |
returns the sequence of ScheduleMultidim output by the operator
Implements gum::ScheduleOperator.
References results().
Referenced by results().
| void gum::ScheduleProjection< TABLE >::setProjectionFunction | ( | TABLE(* | project )(const TABLE &, const gum::VariableSet &) | ) |
use a new projection function
References setProjectionFunction().
Referenced by setProjectionFunction().
|
finalvirtual |
displays the content of the operator
Implements gum::ScheduleOperator.
References toString().
Referenced by toString().
|
inherited |
returns the type of the operator
Referenced by ScheduleOperator().
|
finalvirtual |
undo a previous execution, if any
Implements gum::ScheduleOperator.
References undo().
Referenced by undo().
|
finalvirtual |
modifies the arguments of the operator
| SizeError | is raised if the number of elements in new_args does not correspond to the number of arguments expected by the ScheduleOperator. |
| TypeError | is raised if at least one element of new_args does not have a type compatible with what the ScheduleOperator expects. |
Implements gum::ScheduleOperator.
References updateArgs().
Referenced by updateArgs().
|
private |
|
private |
the sequence of arguments passed to the operator
This method is convenient when using ScheduleOperator rather than directly using ScheduleBinaryCombination
Definition at line 299 of file scheduleProjection.h.
|
private |
the set of variables that should be removed from the arg table
Definition at line 312 of file scheduleProjection.h.
|
privateinherited |
indicates whether the operator will delete some of the ScheduleMultiDim passed as its arguments
Definition at line 246 of file scheduleOperator.h.
|
privateinherited |
the name of the operator to perform
Definition at line 242 of file scheduleOperator.h.
|
private |
the projection operator
Definition at line 315 of file scheduleProjection.h.
|
private |
|
privateinherited |
is the result persistent
Definition at line 249 of file scheduleOperator.h.
|
private |
the sequence of ScheduleMultidim output by the operator
Definition at line 309 of file scheduleProjection.h.