MCPcopy Create free account
hub / github.com/cvanaret/Uno / evaluate_objective

Method evaluate_objective

interfaces/C/Uno_C_API.cpp:71–83  ·  view source on GitHub ↗

function evaluations

Source from the content-addressed store, hash-verified

69
70 // function evaluations
71 [[nodiscard]] double evaluate_objective(const Vector<double>& x) const override {
72 double objective_value{0.};
73 if (this->user_model.objective_function != nullptr) {
74 const uno_int return_code = this->user_model.objective_function(this->user_model.number_variables, x.data(),
75 &objective_value, this->user_model.user_data);
76 if (0 < return_code) {
77 throw FunctionEvaluationError();
78 }
79 objective_value *= this->optimization_sense;
80 ++this->number_model_evaluations.objective;
81 }
82 return objective_value;
83 }
84
85 void evaluate_constraints(const Vector<double>& x, Vector<double>& constraints) const override {
86 if (this->user_model.constraint_functions != nullptr) {

Callers

nothing calls this directly

Calls 2

dataMethod · 0.45

Tested by

no test coverage detected