- if (method == LAGRANGE_VEGAS)
- simgrid::kernel::lmm::lmm_set_default_protocol_function(
- simgrid::kernel::lmm::func_vegas_f, simgrid::kernel::lmm::func_vegas_fp, simgrid::kernel::lmm::func_vegas_fpi);
- else if (method == LAGRANGE_RENO)
- simgrid::kernel::lmm::lmm_set_default_protocol_function(
- simgrid::kernel::lmm::func_reno_f, simgrid::kernel::lmm::func_reno_fpi, simgrid::kernel::lmm::func_reno_fpi);
-
- lmm_system_t Sys = new simgrid::kernel::lmm::s_lmm_system_t(true);
- lmm_constraint_t L1 = Sys->constraint_new(nullptr, a);
- lmm_constraint_t L2 = Sys->constraint_new(nullptr, b);
- lmm_constraint_t L3 = Sys->constraint_new(nullptr, a);
-
- lmm_variable_t R_1_2_3 = Sys->variable_new(nullptr, 1.0, -1.0, 3);
- lmm_variable_t R_1 = Sys->variable_new(nullptr, 1.0, -1.0, 1);
- lmm_variable_t R_2 = Sys->variable_new(nullptr, 1.0, -1.0, 1);
- lmm_variable_t R_3 = Sys->variable_new(nullptr, 1.0, -1.0, 1);
-
- Sys->update_variable_weight(R_1_2_3, 1.0);
- Sys->update_variable_weight(R_1, 1.0);
- Sys->update_variable_weight(R_2, 1.0);
- Sys->update_variable_weight(R_3, 1.0);
-
- Sys->expand(L1, R_1_2_3, 1.0);
- Sys->expand(L2, R_1_2_3, 1.0);
- Sys->expand(L3, R_1_2_3, 1.0);
-
- Sys->expand(L1, R_1, 1.0);
- Sys->expand(L2, R_2, 1.0);
- Sys->expand(L3, R_3, 1.0);
-
- if (method == MAXMIN) {
- lmm_solve(Sys);
- } else {
- double x;
- if (method == LAGRANGE_VEGAS) {
- x = 3 * a / 4 - 3 * b / 8 + sqrt(9 * b * b + 4 * a * a - 4 * a * b) / 8;
- /* Computed with mupad and D_f=1.0 */
- if (x > a) {
- x = a;
- }
- if (x < 0) {
- x = 0;
- }
- } else if (method == LAGRANGE_RENO) {
- a_test_1 = a;
- b_test_1 = b;
- x = dichotomy(diff_lagrange_test_1, 0, a, 1e-13);
-
- if (x < 0)
- x = 0;
- if (x > a)
- x = a;
- } else {
- xbt_die( "Invalid method");
- }