Verified Commit 16a97a96 authored by Sébastien Villemot's avatar Sébastien Villemot
Browse files

Rewrite engine for matching the non-optimizing agents part in PAC

The engine is now more robust and should reject any expression that does not
conform to the expected form. It is also able to deal with more cases, such as
terms appearing with a minus sign, or variables in the middle of a
three-factors product.

BTW, use a std::tuple for storing the result of the matching inside
PacExpectationNode, and change the order of components within the
structure (variable first, scalar last).
parent 003df49e
Pipeline #395 passed with stage
in 1 minute and 20 seconds
......@@ -4243,7 +4243,7 @@ DynamicModel::walkPacParameters()
pair<int, int> lhs (-1, -1);
pair<int, pair<vector<int>, vector<bool>>> ec_params_and_vars;
set<pair<int, pair<int, int>>> ar_params_and_vars;
set<pair<int, pair<pair<int, int>, double>>> non_optim_params_vars_and_scaling_factor;
vector<tuple<int, int, int, double>> non_optim_vars_params_and_constants;
if (equation->containsPacExpectation())
{
......@@ -4271,12 +4271,12 @@ DynamicModel::walkPacParameters()
{
optim_share_index = *(optim_share.begin());
optim_part->getPacOptimizingPart(lhs_orig_symb_id, ec_params_and_vars, ar_params_and_vars);
non_optim_part->getPacNonOptimizingPart(non_optim_params_vars_and_scaling_factor);
non_optim_vars_params_and_constants = non_optim_part->getPacNonOptimizingPart();
}
equation->addParamInfoToPac(lhs,
optim_share_index,
ec_params_and_vars, ar_params_and_vars,
non_optim_params_vars_and_scaling_factor);
non_optim_vars_params_and_constants);
}
}
}
......
This diff is collapsed.
This diff is collapsed.
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment