From: Arnaud Giersch Date: Wed, 28 Mar 2018 08:34:56 +0000 (+0200) Subject: Make static functions in lagrange.cpp static methods of lmm::Lagrange. X-Git-Tag: v3.20~617 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/a3a3d31eb820dc24865879894bf9635cd21e1c08?hp=8cd6895f11e7da5ddbb04fbc117ae1f3244cca29 Make static functions in lagrange.cpp static methods of lmm::Lagrange. --- diff --git a/src/kernel/lmm/lagrange.cpp b/src/kernel/lmm/lagrange.cpp index 98b6fd2aeb..db92f1e454 100644 --- a/src/kernel/lmm/lagrange.cpp +++ b/src/kernel/lmm/lagrange.cpp @@ -35,14 +35,6 @@ System* make_new_lagrange_system(bool selective_update) return new Lagrange(selective_update); } -/* - * Local prototypes to implement the Lagrangian optimization with optimal step, also called dichotomy. - */ -// computes the value of the dichotomy using a initial values, init, with a specific variable or constraint -static double dichotomy(double init, double diff(double, const Constraint&), const Constraint& cnst, double min_error); -// computes the value of the differential of constraint cnst applied to lambda -static double partial_diff_lambda(double lambda, const Constraint& cnst); - bool Lagrange::check_feasible(bool warn) { for (Constraint const& cnst : active_constraint_set) { @@ -77,7 +69,7 @@ bool Lagrange::check_feasible(bool warn) return true; } -static double new_value(const Variable& var) +double Lagrange::new_value(const Variable& var) { double tmp = 0; @@ -91,7 +83,7 @@ static double new_value(const Variable& var) return var.func_fpi(var, tmp); } -static double new_mu(const Variable& var) +double Lagrange::new_mu(const Variable& var) { double mu_i = 0.0; double sigma_i = 0.0; @@ -277,7 +269,8 @@ void Lagrange::lagrange_solve() * * @return a double corresponding to the result of the dichotomy process */ -static double dichotomy(double init, double diff(double, const Constraint&), const Constraint& cnst, double min_error) +double Lagrange::dichotomy(double init, double diff(double, const Constraint&), const Constraint& cnst, + double min_error) { double min = init; double max = init; @@ -377,7 +370,7 @@ static double dichotomy(double init, double diff(double, const Constraint&), con return ((min + max) / 2.0); } -static double partial_diff_lambda(double lambda, const Constraint& cnst) +double Lagrange::partial_diff_lambda(double lambda, const Constraint& cnst) { double diff = 0.0; diff --git a/src/kernel/lmm/maxmin.hpp b/src/kernel/lmm/maxmin.hpp index e98cdb6f41..f0cafe76e3 100644 --- a/src/kernel/lmm/maxmin.hpp +++ b/src/kernel/lmm/maxmin.hpp @@ -630,6 +630,18 @@ private: bool check_feasible(bool warn); double dual_objective(); + + /* + * Local prototypes to implement the Lagrangian optimization with optimal step, also called dichotomy. + */ + // computes the value of the dichotomy using a initial values, init, with a specific variable or constraint + static double dichotomy(double init, double diff(double, const Constraint&), const Constraint& cnst, + double min_error); + // computes the value of the differential of constraint cnst applied to lambda + static double partial_diff_lambda(double lambda, const Constraint& cnst); + + static double new_value(const Variable& var); + static double new_mu(const Variable& var); }; XBT_PUBLIC System* make_new_maxmin_system(bool selective_update);