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

Method evaluate_objective_gradient

interfaces/C/Uno_C_API.cpp:97–109  ·  view source on GitHub ↗

dense objective gradient

Source from the content-addressed store, hash-verified

95
96 // dense objective gradient
97 void evaluate_objective_gradient(const Vector<double>& x, Vector<double>& gradient) const override {
98 if (this->user_model.objective_gradient != nullptr) {
99 const uno_int return_code = this->user_model.objective_gradient(this->user_model.number_variables, x.data(),
100 gradient.data(), this->user_model.user_data);
101 if (0 < return_code) {
102 throw GradientEvaluationError();
103 }
104 for (size_t variable_index: Range(this->number_variables)) {
105 gradient[variable_index] *= this->optimization_sense;
106 }
107 ++this->number_model_evaluations.objective_gradient;
108 }
109 }
110
111 // sparsity patterns of Jacobian and Hessian
112 void compute_jacobian_sparsity(uno_int* row_indices, uno_int* column_indices, uno_int row_offset, uno_int column_offset,

Callers

nothing calls this directly

Calls 3

RangeClass · 0.85
dataMethod · 0.45

Tested by

no test coverage detected