alpaqa 1.0.0a14
Nonconvex constrained optimization
Loading...
Searching...
No Matches
cutest-loader.cpp
Go to the documentation of this file.
2
5
6#include <dlfcn.h>
7
8#include <cassert>
9#include <filesystem>
10#include <functional>
11#include <iostream>
12#include <memory>
13#include <numeric>
14#include <stdexcept>
15#include <string>
16#include <string_view>
17#include <vector>
18
19#include "cutest-functions.hpp"
20
21using namespace std::string_literals;
22
23namespace {
24void throw_error(std::string_view s, int code) {
26 std::string(s), static_cast<alpaqa::cutest::Status>(code));
27}
28void throw_if_error(std::string_view s, int code) {
29 if (code)
30 throw_error(s, code);
31}
32void log_if_error(std::string_view s, int code) {
33 if (code)
34 std::cerr << s << " (" << code << ")\n";
35}
36template <class F>
37auto checked(F &&func, std::string_view msg) {
38 return [msg, func{std::forward<F>(func)}]<class... Args>(
39 Args &&...args) mutable {
41 std::forward<F>(func)(&status, std::forward<Args>(args)...);
42 throw_if_error(msg, status);
43 };
44}
45
46std::shared_ptr<void> load_lib(const char *so_filename) {
47 assert(so_filename);
48 ::dlerror();
49 void *h = ::dlopen(so_filename, RTLD_LOCAL | RTLD_NOW);
50 if (auto *err = ::dlerror())
51 throw std::runtime_error(err);
52 assert(h);
53#if ALPAQA_NO_DLCLOSE
54 return std::shared_ptr<void>{h, +[](void *) {}};
55#else
56 return std::shared_ptr<void>{h, &::dlclose};
57#endif
58}
59} // namespace
60
61namespace alpaqa {
62
64 public:
65 USING_ALPAQA_CONFIG(CUTEstProblem::config_t);
67
68 private:
69 using cleanup_t = std::shared_ptr<void>;
70 template <class F>
72 return cleanup_t{nullptr,
73 [func{std::forward<F>(func)}](void *) { func(); }};
74 }
75
78
79 template <class F>
80 auto load() -> F::signature_t * {
81 return F::load(so_handle.get());
82 }
83
84 template <class F, class... Args>
85 decltype(auto) call(Args &&...args) {
86 return load<F>()(std::forward<Args>(args)...);
87 }
88
90 std::filesystem::path p = outsdif_fname;
91 if (!std::filesystem::is_regular_file(p))
92 throw std::invalid_argument("CUTEstLoader: OUTSDIF path does not "
93 "exist or is not a regular file: \"" +
94 std::string(outsdif_fname) + '"');
95 integer status;
98 throw_if_error("Failed to open "s + outsdif_fname, status);
99 return cleanup([funit{this->funit}, fptr_close] {
100 integer status;
101 fptr_close(&funit, &status);
102 log_if_error("Failed to close OUTSDIF.d file", status);
103 });
104 }
105
108 return cleanup([fptr_cterminate] {
109 integer status;
110 fptr_cterminate(&status);
111 log_if_error("Failed to call cutest_cterminate", status);
112 });
113 }
114
115 public:
116 CUTEstLoader(const char *so_fname, const char *outsdif_fname) {
117 // Open the shared library
118 so_handle = load_lib(so_fname);
119
120 // Open the OUTSDIF.d file
123 else
124 cleanup_outsdif = load_outsdif(std::filesystem::path(so_fname)
125 .replace_filename("OUTSDIF.d")
126 .c_str());
127
128 // Get the dimensions of the problem
129 integer status;
130 call<cutest::cdimen>(&status, &funit, &nvar, &ncon);
131 throw_if_error("Failed to call cutest_cdimen", status);
132 }
133
151
152 void setup_problem(rvec x0, rvec y0, Box &C, Box &D) {
153 assert(x0.size() == static_cast<length_t>(nvar));
154 assert(C.lowerbound.size() == static_cast<length_t>(nvar));
155 assert(C.upperbound.size() == static_cast<length_t>(nvar));
156 assert(y0.size() == static_cast<length_t>(ncon));
157 assert(D.lowerbound.size() == static_cast<length_t>(ncon));
158 assert(D.upperbound.size() == static_cast<length_t>(ncon));
159
160 // Variables returned and required by csetup
161 equatn.resize(static_cast<length_t>(ncon));
162 linear.resize(static_cast<length_t>(ncon));
163 integer e_order = 0; // no specific order of equality constraints
164 integer l_order = 0; // no specific order of linear constraints
165 integer v_order = 0; // no specific order of linear variables
166 integer status;
167
168 // Initialize the problem
170 &status, &funit, &iout, &io_buffer, &nvar, &ncon, x0.data(),
171 C.lowerbound.data(), C.upperbound.data(), y0.data(),
172 D.lowerbound.data(), D.upperbound.data(), equatn.data(),
173 linear.data(), &e_order, &l_order, &v_order);
174 throw_if_error("Failed to call cutest_csetup", status);
176
177 // Check the number of constraints
178 if (ncon == 0)
179 throw std::runtime_error(
180 "Unconstrained CUTEst problems are currently unsupported");
181
182 // Allocate workspaces
183 work.resize(std::max(nvar, ncon));
184 work2.resize(std::max(nvar, ncon));
185 // Convert bounds
186 std::ranges::replace(C.lowerbound, -cutest::inf, -inf<config_t>);
187 std::ranges::replace(C.upperbound, +cutest::inf, +inf<config_t>);
188 std::ranges::replace(D.lowerbound, -cutest::inf, -inf<config_t>);
189 std::ranges::replace(D.upperbound, +cutest::inf, +inf<config_t>);
190 // Load problem functions and gradients
191 funcs = {
193 .cofg = load<cutest::cofg>(),
194 .ccfg = load<cutest::ccfg>(),
195 .clfg = load<cutest::clfg>(),
196 .cjprod = load<cutest::cjprod>(),
197 .ccifg = load<cutest::ccifg>(),
198 .cigr = load<cutest::cigr>(),
199 .cdimsj = load<cutest::cdimsj>(),
200 .csjp = load<cutest::csjp>(),
201 .ccfsg = load<cutest::ccfsg>(),
202 .cdh = load<cutest::cdh>(),
203 .cdimsh = load<cutest::cdimsh>(),
204 .cshp = load<cutest::cshp>(),
205 .csh = load<cutest::csh>(),
206 .chprod = load<cutest::chprod>(),
207 };
208 }
209
210 std::string get_name() {
211 std::string name(cutest::fstring_len, ' ');
212 integer status;
213 call<cutest::probname>(&status, name.data());
214 throw_if_error("Failed to call CUTEST_probname", status);
215 if (auto last = name.find_last_not_of(' '); last != name.npos)
216 name.resize(last + 1);
217 return name;
218 }
219
220 void get_report(double *calls, double *time) {
221 integer status;
222 if (ncon > 0) {
223 call<cutest::creport>(&status, calls, time);
224 throw_if_error("Failed to call CUTEST_creport", status);
225 } else {
226 call<cutest::ureport>(&status, calls, time);
227 throw_if_error("Failed to call CUTEST_ureport", status);
228 }
229 }
230
231 // Order of cleanup is important!
232 std::shared_ptr<void> so_handle; ///< dlopen handle to shared library
233 cleanup_t cleanup_outsdif; ///< Responsible for closing the OUTSDIF.d file
234 cleanup_t cutest_terminate; ///< Responsible for calling CUTEST_xterminate
235
236 integer funit = 42; ///< Fortran Unit Number for OUTSDIF.d file
237 integer iout = 6; ///< Fortran Unit Number for standard output
238 integer io_buffer = 11; ///< Fortran Unit Number for internal IO
239
240 integer nvar; ///< Number of decision variabls
241 integer ncon; ///< Number of constraints
242 ConstrFuncs funcs; /// Pointers to loaded problem functions
243
244 using logical_vec = Eigen::VectorX<logical>;
245 logical_vec equatn; ///< whether the constraint is an equality
246 logical_vec linear; ///< whether the constraint is linear
247 mutable vec work, work2; ///< work vectors
248};
249
251 bool sparse)
252 : BoxConstrProblem<config_t>{0, 0}, sparse{sparse} {
253 impl = std::make_unique<CUTEstLoader>(so_fname, outsdif_fname);
254 resize(static_cast<length_t>(impl->nvar),
255 static_cast<length_t>(impl->ncon));
256 x0.resize(n);
257 y0.resize(m);
258 impl->setup_problem(x0, y0, C, D);
259 name = impl->get_name();
260}
261
262CUTEstProblem::CUTEstProblem(const CUTEstProblem &) = default;
263CUTEstProblem &CUTEstProblem::operator=(const CUTEstProblem &) = default;
265CUTEstProblem &CUTEstProblem::operator=(CUTEstProblem &&) noexcept = default;
266CUTEstProblem::~CUTEstProblem() = default;
267
268auto CUTEstProblem::get_report() const -> Report {
269 double calls[7]; // NOLINT(*-c-arrays)
270 double time[2]; // NOLINT(*-c-arrays)
271 impl->get_report(calls, time);
272 const bool constr = impl->ncon > 0;
273 return {
274 .calls{
275 .objective = static_cast<unsigned>(calls[0]),
276 .objective_grad = static_cast<unsigned>(calls[1]),
277 .objective_hess = static_cast<unsigned>(calls[2]),
278 .hessian_times_vector = static_cast<unsigned>(calls[3]),
279 .constraints = constr ? static_cast<unsigned>(calls[4]) : 0,
280 .constraints_grad = constr ? static_cast<unsigned>(calls[5]) : 0,
281 .constraints_hess = constr ? static_cast<unsigned>(calls[6]) : 0,
282 },
283 .time_setup = time[0],
284 .time = time[1],
285 };
286}
287
289 assert(x.size() == static_cast<length_t>(impl->nvar));
290 real_t f;
292 checked(impl->funcs.cofg, "eval_f: CUTEST_cofg")(&impl->nvar, x.data(), &f,
293 nullptr, &grad);
294 return f;
295}
297 assert(x.size() == static_cast<length_t>(impl->nvar));
298 assert(grad_fx.size() == static_cast<length_t>(impl->nvar));
299 real_t f;
301 checked(impl->funcs.cofg, "eval_grad_f: CUTEST_cofg")(
302 &impl->nvar, x.data(), &f, grad_fx.data(), &grad);
303}
305 assert(x.size() == static_cast<length_t>(impl->nvar));
306 assert(gx.size() == static_cast<length_t>(impl->ncon));
309 checked(impl->funcs.ccfg, "eval_g: CUTEST_ccfg")(
310 &impl->nvar, &impl->ncon, x.data(), gx.data(), &jtrans, &zero, &zero,
311 nullptr, &grad);
312}
314 assert(x.size() == static_cast<length_t>(impl->nvar));
315 assert(y.size() == static_cast<length_t>(impl->ncon));
316 assert(grad_gxy.size() == static_cast<length_t>(impl->nvar));
317 auto lvector = static_cast<cutest::integer>(y.size()),
318 lresult = static_cast<cutest::integer>(grad_gxy.size());
320 checked(impl->funcs.cjprod, "eval_grad_g_prod: CUTEST_cjprod")(
321 &impl->nvar, &impl->ncon, &gotj, &jtrans, x.data(), y.data(), &lvector,
322 grad_gxy.data(), &lresult);
323}
324
326 // Compute the nonzero values
327 assert(x.size() == static_cast<length_t>(impl->nvar));
328 // Sparse Jacobian
329 if (sparse) {
330 assert(nnz_J >= 0);
331 assert(J_values.size() == static_cast<length_t>(nnz_J));
332 assert(storage_jac_g.rows.size() == static_cast<length_t>(nnz_J));
333 assert(storage_jac_g.cols.size() == static_cast<length_t>(nnz_J));
334 const cutest::integer nnz = nnz_J;
336 checked(impl->funcs.ccfsg, "eval_jac_g: CUTEST_ccfsg")(
337 &impl->nvar, &impl->ncon, x.data(), impl->work.data(), &nnz_J, &nnz,
338 J_values.data(), storage_jac_g.cols.data(),
339 storage_jac_g.rows.data(), &grad);
340 }
341 // Dense Jacobian
342 else {
343 assert(J_values.size() == static_cast<length_t>(impl->nvar) *
344 static_cast<length_t>(impl->ncon));
346 checked(impl->funcs.ccfg, "eval_jac_g: CUTEST_ccfg")(
347 &impl->nvar, &impl->ncon, x.data(), impl->work.data(), &jtrans,
348 &impl->ncon, &impl->nvar, J_values.data(), &grad);
349 }
350}
352 if (!sparse)
354 .rows = m,
355 .cols = n,
357 };
358 if (nnz_J < 0) {
359 checked(impl->funcs.cdimsj,
360 "get_jac_g_sparsity: CUTEST_cdimsj")(&nnz_J);
361 nnz_J -= impl->nvar;
362 assert(nnz_J >= 0);
363 storage_jac_g.cols.resize(nnz_J);
364 storage_jac_g.rows.resize(nnz_J);
365 const cutest::integer nnz = nnz_J;
366 checked(impl->funcs.csjp, "eval_jac_g: CUTEST_csjp")(
367 &nnz_J, &nnz, storage_jac_g.cols.data(), storage_jac_g.rows.data());
368 }
369 using SparseCOO = sparsity::SparseCOO<config_t, int>;
370 return SparseCOO{
371 .rows = m,
372 .cols = n,
374 .row_indices = storage_jac_g.rows,
375 .col_indices = storage_jac_g.cols,
376 .order = SparseCOO::Unsorted,
377 .first_index = 1, // Fortran-style indices
378 };
379}
381 assert(x.size() == static_cast<length_t>(impl->nvar));
382 assert(grad_gi.size() == static_cast<length_t>(impl->nvar));
383 auto iprob = static_cast<cutest::integer>(i + 1); // index zero is objective
384 checked(impl->funcs.cigr, "eval_grad_gi: CUTEST_cigr")(
385 &impl->nvar, &iprob, x.data(), grad_gi.data());
386}
388 rvec Hv) const {
389 assert(x.size() == static_cast<length_t>(impl->nvar));
390 assert(y.size() == static_cast<length_t>(impl->ncon));
391 assert(v.size() == static_cast<length_t>(impl->nvar));
392 assert(Hv.size() == static_cast<length_t>(impl->nvar));
393 const auto *mult = y.data();
394 if (scale != 1) {
395 impl->work = y * (real_t(1) / scale);
396 mult = impl->work.data();
397 }
399 checked(impl->funcs.chprod, "eval_hess_L_prod: CUTEST_chprod")(
400 &impl->nvar, &impl->ncon, &goth, x.data(), mult,
401 const_cast<real_t *>(v.data()), Hv.data());
402 if (scale != 1)
403 Hv *= scale;
404}
406 crvec v, rvec Hv) const {
407 assert(x.size() == static_cast<length_t>(impl->nvar));
408 assert(y.size() == static_cast<length_t>(impl->ncon));
409 assert(Σ.size() == static_cast<length_t>(impl->ncon));
410 assert(v.size() == static_cast<length_t>(impl->nvar));
411 assert(Hv.size() == static_cast<length_t>(impl->nvar));
412 auto &&ζ = impl->work.topRows(impl->ncon);
413 auto &&ŷ = impl->work2.topRows(impl->ncon);
414 // ζ = g(x) + Σ⁻¹y
415 eval_g(x, ζ);
416 ζ += Σ.asDiagonal().inverse() * y;
417 // d = ζ - Π(ζ, D)
418 this->eval_proj_diff_g(ζ, ŷ);
419 // ŷ = Σ d
420 ŷ.array() *= Σ.array();
421 // Hv = ∇²ℒ(x, ŷ) v
422 eval_hess_L_prod(x, ŷ, scale, v, Hv);
423 // Find active constraints
424 for (index_t i = 0; i < impl->ncon; ++i)
425 ζ(i) = (ζ(i) <= D.lowerbound(i)) || (D.upperbound(i) <= ζ(i))
426 ? Σ(i)
427 : real_t(0);
428 // Jg(x) v
429 auto &&Jv = impl->work2.topRows(impl->ncon);
430 auto lvector = static_cast<cutest::integer>(v.size()),
431 lresult = static_cast<cutest::integer>(Jv.size());
433 checked(impl->funcs.cjprod, "eval_hess_ψ_prod: CUTEST_cjprod-1")(
434 &impl->nvar, &impl->ncon, &gotj, &jtrans, x.data(), v.data(), &lvector,
435 Jv.data(), &lresult);
436 // Σ Jg v
437 Jv.array() *= ζ.array();
438 // Jgᵀ Σ Jg v
439 std::swap(lvector, lresult);
441 auto &&JΣJv = impl->work.topRows(impl->nvar);
442 checked(impl->funcs.cjprod, "eval_hess_ψ_prod: CUTEST_cjprod-2")(
443 &impl->nvar, &impl->ncon, &gotj, &jtrans, x.data(), Jv.data(), &lvector,
444 JΣJv.data(), &lresult);
445 Hv += JΣJv;
446}
448 rvec H_values) const {
449 // Compute the nonzero values
450 assert(x.size() == static_cast<length_t>(impl->nvar));
451 assert(y.size() == static_cast<length_t>(impl->ncon));
452 const auto *mult = y.data();
453 if (scale != 1) {
454 impl->work = y * (real_t(1) / scale);
455 mult = impl->work.data();
456 }
457 // Sparse Hessian
458 if (sparse) {
459 assert(nnz_H >= 0);
460 assert(H_values.size() == static_cast<length_t>(nnz_H));
461 assert(storage_hess_L.rows.size() == static_cast<length_t>(nnz_H));
462 assert(storage_hess_L.cols.size() == static_cast<length_t>(nnz_H));
463 const cutest::integer nnz = nnz_H;
464 checked(impl->funcs.csh, "eval_hess_L: CUTEST_csh")(
465 &impl->nvar, &impl->ncon, x.data(), y.data(), &nnz_H, &nnz,
466 H_values.data(), storage_hess_L.rows.data(),
467 storage_hess_L.cols.data());
468 }
469 // Dense Hessian
470 else {
471 assert(H_values.size() == static_cast<length_t>(impl->nvar) *
472 static_cast<length_t>(impl->nvar));
473 checked(impl->funcs.cdh,
474 "eval_hess_L: CUTEST_cdh")(&impl->nvar, &impl->ncon, x.data(),
475 mult, &impl->nvar, H_values.data());
476 }
477 if (scale != 1)
478 H_values *= scale;
479}
481 if (!sparse)
483 .rows = n,
484 .cols = n,
485 .symmetry = sparsity::Symmetry::Upper,
486 };
487 if (nnz_H < 0) {
488 checked(impl->funcs.cdimsh,
489 "get_hess_L_sparsity: CUTEST_cdimsh")(&nnz_H);
490 assert(nnz_H >= 0);
491 storage_hess_L.rows.resize(nnz_H);
492 storage_hess_L.cols.resize(nnz_H);
493 const cutest::integer nnz = nnz_H;
494 checked(impl->funcs.cshp, "eval_hess_L: CUTEST_cshp")(
495 &impl->nvar, &nnz_H, &nnz, storage_hess_L.rows.data(),
496 storage_hess_L.cols.data());
497 }
498 using SparseCOO = sparsity::SparseCOO<config_t, int>;
499 return SparseCOO{
500 .rows = n,
501 .cols = n,
502 .symmetry = sparsity::Symmetry::Upper,
503 .row_indices = storage_hess_L.rows,
504 .col_indices = storage_hess_L.cols,
505 .order = SparseCOO::Unsorted,
506 .first_index = 1, // Fortran-style indices
507 };
508}
510 assert(x.size() == static_cast<length_t>(impl->nvar));
511 assert(grad_fx.size() == static_cast<length_t>(impl->nvar));
512 real_t f;
514 checked(impl->funcs.cofg, "eval_f_grad_f: CUTEST_cofg")(
515 &impl->nvar, x.data(), &f, grad_fx.data(), &grad);
516 return f;
517}
519 assert(x.size() == static_cast<length_t>(impl->nvar));
520 assert(g.size() == static_cast<length_t>(impl->ncon));
521 real_t f;
522 checked(impl->funcs.cfn, "eval_f_g: CUTEST_cfn")(&impl->nvar, &impl->ncon,
523 x.data(), &f, g.data());
524 return f;
525}
526void CUTEstProblem::eval_grad_L(crvec x, crvec y, rvec grad_L, rvec) const {
527 assert(x.size() == static_cast<length_t>(impl->nvar));
528 assert(y.size() == static_cast<length_t>(impl->ncon));
529 assert(grad_L.size() == static_cast<length_t>(impl->nvar));
530 real_t L;
532 checked(impl->funcs.clfg, "eval_f_g: CUTEST_clfg")(
533 &impl->nvar, &impl->ncon, x.data(), y.data(), &L, grad_L.data(), &grad);
534}
535
536std::ostream &CUTEstProblem::format_report(std::ostream &os,
537 const Report &r) const {
538 os << "CUTEst problem: " << name << "\r\n\n"
539 << "Number of variables: " << n << "\r\n"
540 << "Number of constraints: " << m << "\r\n\n"
541 << "Objective function evaluations: " //
542 << r.calls.objective << "\r\n"
543 << "Objective function gradient evaluations: " //
544 << r.calls.objective_grad << "\r\n"
545 << "Objective function Hessian evaluations: " //
546 << r.calls.objective_hess << "\r\n"
547 << "Hessian times vector products: " //
548 << r.calls.objective_hess << "\r\n\n";
549 if (m > 0) {
550 os << "Constraint function evaluations: " //
551 << r.calls.constraints << "\r\n"
552 << "Constraint function gradients evaluations: " //
553 << r.calls.constraints_grad << "\r\n"
554 << "Constraint function Hessian evaluations: " //
555 << r.calls.constraints_hess << "\r\n\n";
556 }
557 return os << "Setup time: " << r.time_setup << "s\r\n"
558 << "Time since setup: " << r.time << "s";
559}
560
561} // namespace alpaqa
Implements common problem functions for minimization problems with box constraints.
length_t m
Number of constraints, dimension of g(x) and z.
length_t n
Number of decision variables, dimension of x.
cleanup_t cutest_terminate
Responsible for calling CUTEST_xterminate.
cutest::ccifg::signature_t * ccifg
cutest::cigr::signature_t * cigr
cutest::cfn::signature_t * cfn
integer ncon
Number of constraints.
cutest::logical logical
cutest::ccfsg::signature_t * ccfsg
std::shared_ptr< void > cleanup_t
cutest::csjp::signature_t * csjp
cleanup_t cleanup_outsdif
Responsible for closing the OUTSDIF.d file.
cutest::cdimsh::signature_t * cdimsh
CUTEstLoader(const char *so_fname, const char *outsdif_fname)
integer iout
Fortran Unit Number for standard output.
cutest::cdimsj::signature_t * cdimsj
integer funit
Fortran Unit Number for OUTSDIF.d file.
decltype(auto) call(Args &&...args)
cutest::csh::signature_t * csh
cutest::clfg::signature_t * clfg
cleanup_t load_outsdif(const char *outsdif_fname)
cutest::cofg::signature_t * cofg
cleanup_t cleanup(F &&func)
integer nvar
Number of decision variabls.
std::shared_ptr< void > so_handle
dlopen handle to shared library
cutest::integer integer
cutest::cjprod::signature_t * cjprod
cutest::cdh::signature_t * cdh
Eigen::VectorX< logical > logical_vec
Pointers to loaded problem functions.
cutest::chprod::signature_t * chprod
void setup_problem(rvec x0, rvec y0, Box &C, Box &D)
logical_vec equatn
whether the constraint is an equality
vec work2
work vectors
cutest::cshp::signature_t * cshp
auto load() -> F::signature_t *
void get_report(double *calls, double *time)
cutest::ccfg::signature_t * ccfg
logical_vec linear
whether the constraint is linear
integer io_buffer
Fortran Unit Number for internal IO.
Wrapper for CUTEst problems loaded from an external shared library.
void eval_grad_gi(crvec x, index_t i, rvec grad_gi) const
Calls calls
Function call counters.
void eval_jac_g(crvec x, rvec J_values) const
unsigned constraints_grad
Number of calls to the constraint gradients.
Sparsity get_jac_g_sparsity() const
real_t eval_f_g(crvec x, rvec g) const
double time_setup
CPU time (in seconds) for CUTEST_csetup.
Sparsity get_hess_L_sparsity() const
unsigned objective
Number of calls to the objective function.
struct alpaqa::CUTEstProblem::SparseStorage storage_hess_L
void eval_grad_L(crvec x, crvec y, rvec grad_L, rvec work_n) const
CUTEstProblem(const char *so_fname, const char *outsdif_fname=nullptr, bool sparse=false)
Load a CUTEst problem from the given shared library and OUTSDIF.d file.
unsigned constraints
Number of calls to the constraint functions.
std::string name
Problem name.
util::copyable_unique_ptr< class CUTEstLoader > impl
real_t eval_f_grad_f(crvec x, rvec grad_fx) const
double time
CPU time (in seconds) since the end of CUTEST_csetup.
void eval_grad_g_prod(crvec x, crvec y, rvec grad_gxy) const
void eval_hess_L_prod(crvec x, crvec y, real_t scale, crvec v, rvec Hv) const
void eval_grad_f(crvec x, rvec grad_fx) const
real_t eval_f(crvec x) const
void eval_g(crvec x, rvec gx) const
unsigned objective_hess
Number of calls to the objective Hessian.
struct alpaqa::CUTEstProblem::SparseStorage storage_jac_g
std::ostream & format_report(std::ostream &os, const Report &r) const
void eval_hess_L(crvec x, crvec y, real_t scale, rvec H_values) const
unsigned constraints_hess
Number of calls to the constraint Hessians.
CUTEstProblem & operator=(const CUTEstProblem &)
unsigned objective_grad
Number of calls to the objective gradient.
void eval_hess_ψ_prod(crvec x, crvec y, crvec Σ, real_t scale, crvec v, rvec Hv) const
The report generated by CUTEst.
#define USING_ALPAQA_CONFIG(Conf)
Definition config.hpp:56
constexpr logical True
constexpr logical False
constexpr size_t fstring_len
constexpr doublereal inf
@ Upper
Symmetric, upper-triangular part is stored.
Dense matrix structure.
Definition sparsity.hpp:21
typename Conf::real_t real_t
Definition config.hpp:65
typename Conf::index_t index_t
Definition config.hpp:77
typename Conf::length_t length_t
Definition config.hpp:76
constexpr const auto inf
Definition config.hpp:85
typename Conf::rvec rvec
Definition config.hpp:69
typename Conf::crvec crvec
Definition config.hpp:70
typename Conf::vec vec
Definition config.hpp:66
std::shared_ptr< void > load_lib(const char *so_filename)
auto checked(F &&func, std::string_view msg)
void throw_error(std::string_view s, int code)
void throw_if_error(std::string_view s, int code)
void log_if_error(std::string_view s, int code)
Sparse coordinate list structure (COO).
Definition sparsity.hpp:56
Stores any of the supported sparsity patterns.
Definition sparsity.hpp:106