78 const auto lo =
static_cast< long >(std::floor(std::min(first, last)));
79 const auto hi =
static_cast< long >(std::ceil(std::max(first, last)));
80 if (aggType ==
"min") {
81 minVal = std::min(minVal, lo);
82 maxVal = std::min(maxVal, hi);
83 }
else if (aggType ==
"max") {
84 minVal = std::max(minVal, lo);
85 maxVal = std::max(maxVal, hi);
127 NodeId initialAggregator) {
129 bn.cpt(initialAggregator).content());
130 auto newAgg = bn.variable(initialAggregator).clone();
134 std::list< NodeId > orderedParents = {};
136 for (
const auto& elt: parents) {
137 orderedParents.push_back(elt);
140 orderedParents.sort();
155 = std::string(bn.variable(initialAggregator).name()) +
"_" + std::to_string(j);
156 const std::string aggType = p->aggregatorName();
159 for (
auto parent: parents) {
160 bn.eraseArc(parent, initialAggregator);
166 newAgg->setName(newName);
167 newAgg->setDescription(aggType);
171 for (
const auto& parent: orderedParents) {
172 if (q < parents.
size() - parents.
size() % arity) {
191 for (
NodeId node: newAggParents) {
192 bn.addArc(node, bn.idFromName(newName));
198 newAggs.insert(bn.idFromName(newName));
200 newAggParents.clear();
204 newName = std::string(bn.variable(initialAggregator).name()) +
"_" + std::to_string(j);
207 newAgg = bn.variable(initialAggregator).clone();
208 newAgg->setName(newName);
209 newAgg->setDescription(aggType);
216 newAggs.insert(parent);
231 newAggs.insert(bn.idFromName(newName));
233 for (
NodeId node: newAggParents) {
234 bn.addArc(node, bn.idFromName(newName));
237 for (
auto agg:
addDepthLayer_(bn, newAggs, initialAggregator, j)) {
238 bn.addArc(agg, initialAggregator);
251 bn.cpt(initialAggregator).content());
254 std::string aggType = p->aggregatorName();
256 if (nodes.
size() <= arity) {
259 auto newAgg = bn.variable(initialAggregator).clone();
265 std::list< NodeId > orderedParents = {};
267 for (
const auto& elt: nodes) {
268 orderedParents.push_back(elt);
271 orderedParents.sort();
282 = std::string(bn.variable(initialAggregator).name()) +
"_" + std::to_string(j);
284 newAgg->setName(newName);
285 newAgg->setDescription(aggType);
289 for (
const auto parent: orderedParents) {
290 if (q < nodes.size() - nodes.size() % arity) {
305 for (
NodeId node: newAggParents) {
306 bn.addArc(node, bn.idFromName(newName));
309 newAggs.insert(bn.idFromName(newName));
311 newAggParents.clear();
315 newName = std::string(bn.variable(initialAggregator).name()) +
"_" + std::to_string(j);
318 newAgg = bn.variable(initialAggregator).clone();
319 newAgg->setName(newName);
320 newAgg->setDescription(aggType);
327 newAggs.insert(parent);
342 newAggs.insert(bn.idFromName(newName));
344 for (
NodeId node: newAggParents) {
345 bn.addArc(node, bn.idFromName(newName));
static void _accumulateBounds_(const std::string &aggType, const DiscreteVariable &v, long &minVal, long &maxVal)
updates the bounds of a RANGE intermediate aggregator with those of a new (numerical) parent v,...