alpaqa sparse
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 return std::shared_ptr<void>{h, &::dlclose};
54}
55} // namespace
56
57namespace alpaqa {
58
60 public:
61 USING_ALPAQA_CONFIG(CUTEstProblem::config_t);
63
64 private:
65 using cleanup_t = std::shared_ptr<void>;
66 template <class F>
68 return cleanup_t{nullptr,
69 [func{std::forward<F>(func)}](void *) { func(); }};
70 }
71
74
75 template <class F>
76 auto load() -> F::signature_t * {
77 return F::load(so_handle.get());
78 }
79
80 template <class F, class... Args>
81 decltype(auto) call(Args &&...args) {
82 return load<F>()(std::forward<Args>(args)...);
83 }
84
86 std::filesystem::path p = outsdif_fname;
87 if (!std::filesystem::is_regular_file(p))
88 throw std::invalid_argument("CUTEstLoader: OUTSDIF path does not "
89 "exist or is not a regular file: \"" +
90 std::string(outsdif_fname) + '"');
91 integer status;
94 throw_if_error("Failed to open "s + outsdif_fname, status);
95 return cleanup([funit{this->funit}, fptr_close] {
96 integer status;
97 fptr_close(&funit, &status);
98 log_if_error("Failed to close OUTSDIF.d file", status);
99 });
100 }
101
104 return cleanup([fptr_cterminate] {
105 integer status;
106 fptr_cterminate(&status);
107 log_if_error("Failed to call cutest_cterminate", status);
108 });
109 }
110
111 public:
112 CUTEstLoader(const char *so_fname, const char *outsdif_fname) {
113 // Open the shared library
114 so_handle = load_lib(so_fname);
115
116 // Open the OUTSDIF.d file
119 else
120 cleanup_outsdif = load_outsdif(std::filesystem::path(so_fname)
121 .replace_filename("OUTSDIF.d")
122 .c_str());
123
124 // Get the dimensions of the problem
125 integer status;
126 call<cutest::cdimen>(&status, &funit, &nvar, &ncon);
127 throw_if_error("Failed to call cutest_cdimen", status);
128 }
129
147
148 void setup_problem(rvec x0, rvec y0, Box &C, Box &D) {
149 assert(x0.size() == static_cast<length_t>(nvar));
150 assert(C.lowerbound.size() == static_cast<length_t>(nvar));
151 assert(C.upperbound.size() == static_cast<length_t>(nvar));
152 assert(y0.size() == static_cast<length_t>(ncon));
153 assert(D.lowerbound.size() == static_cast<length_t>(ncon));
154 assert(D.upperbound.size() == static_cast<length_t>(ncon));
155
156 // Variables returned and required by csetup
157 equatn.resize(static_cast<length_t>(ncon));
158 linear.resize(static_cast<length_t>(ncon));
159 integer e_order = 0; // no specific order of equality constraints
160 integer l_order = 0; // no specific order of linear constraints
161 integer v_order = 0; // no specific order of linear variables
162 integer status;
163
164 // Initialize the problem
166 &status, &funit, &iout, &io_buffer, &nvar, &ncon, x0.data(),
167 C.lowerbound.data(), C.upperbound.data(), y0.data(),
168 D.lowerbound.data(), D.upperbound.data(), equatn.data(),
169 linear.data(), &e_order, &l_order, &v_order);
170 throw_if_error("Failed to call cutest_csetup", status);
172
173 // Check the number of constraints
174 if (ncon == 0)
175 throw std::runtime_error(
176 "Unconstrained CUTEst problems are currently unsupported");
177
178 // Allocate workspaces
179 work.resize(std::max(nvar, ncon));
180 work2.resize(std::max(nvar, ncon));
181 // Convert bounds
182 std::ranges::replace(C.lowerbound, -cutest::inf, -inf<config_t>);
183 std::ranges::replace(C.upperbound, +cutest::inf, +inf<config_t>);
184 std::ranges::replace(D.lowerbound, -cutest::inf, -inf<config_t>);
185 std::ranges::replace(D.upperbound, +cutest::inf, +inf<config_t>);
186 // Load problem functions and gradients
187 funcs = {
189 .cofg = load<cutest::cofg>(),
190 .ccfg = load<cutest::ccfg>(),
191 .clfg = load<cutest::clfg>(),
192 .cjprod = load<cutest::cjprod>(),
193 .ccifg = load<cutest::ccifg>(),
194 .cigr = load<cutest::cigr>(),
195 .cdimsj = load<cutest::cdimsj>(),
196 .csjp = load<cutest::csjp>(),
197 .ccfsg = load<cutest::ccfsg>(),
198 .cdh = load<cutest::cdh>(),
199 .cdimsh = load<cutest::cdimsh>(),
200 .cshp = load<cutest::cshp>(),
201 .csh = load<cutest::csh>(),
202 .chprod = load<cutest::chprod>(),
203 };
204 }
205
206 std::string get_name() {
207 std::string name(cutest::fstring_len, ' ');
208 integer status;
209 call<cutest::probname>(&status, name.data());
210 throw_if_error("Failed to call CUTEST_probname", status);
211 if (auto last = name.find_last_not_of(' '); last != name.npos)
212 name.resize(last + 1);
213 return name;
214 }
215
216 void get_report(double *calls, double *time) {
217 integer status;
218 if (ncon > 0) {
219 call<cutest::creport>(&status, calls, time);
220 throw_if_error("Failed to call CUTEST_creport", status);
221 } else {
222 call<cutest::ureport>(&status, calls, time);
223 throw_if_error("Failed to call CUTEST_ureport", status);
224 }
225 }
226
227 // Order of cleanup is important!
228 std::shared_ptr<void> so_handle; ///< dlopen handle to shared library
229 cleanup_t cleanup_outsdif; ///< Responsible for closing the OUTSDIF.d file
230 cleanup_t cutest_terminate; ///< Responsible for calling CUTEST_xterminate
231
232 integer funit = 42; ///< Fortran Unit Number for OUTSDIF.d file
233 integer iout = 6; ///< Fortran Unit Number for standard output
234 integer io_buffer = 11; ///< Fortran Unit Number for internal IO
235
236 integer nvar; ///< Number of decision variabls
237 integer ncon; ///< Number of constraints
238 ConstrFuncs funcs; /// Pointers to loaded problem functions
239
240 using logical_vec = Eigen::VectorX<logical>;
241 logical_vec equatn; ///< whether the constraint is an equality
242 logical_vec linear; ///< whether the constraint is linear
243 mutable vec work, work2; ///< work vectors
244};
245
247 bool sparse)
248 : BoxConstrProblem<config_t>{0, 0}, sparse{sparse} {
249 impl = std::make_unique<CUTEstLoader>(so_fname, outsdif_fname);
250 resize(static_cast<length_t>(impl->nvar),
251 static_cast<length_t>(impl->ncon));
252 x0.resize(n);
253 y0.resize(m);
254 impl->setup_problem(x0, y0, C, D);
255 name = impl->get_name();
256}
257
258CUTEstProblem::CUTEstProblem(const CUTEstProblem &) = default;
259CUTEstProblem &CUTEstProblem::operator=(const CUTEstProblem &) = default;
261CUTEstProblem &CUTEstProblem::operator=(CUTEstProblem &&) noexcept = default;
262CUTEstProblem::~CUTEstProblem() = default;
263
264auto CUTEstProblem::get_report() const -> Report {
265 double calls[7]; // NOLINT(*-c-arrays)
266 double time[2]; // NOLINT(*-c-arrays)
267 impl->get_report(calls, time);
268 const bool constr = impl->ncon > 0;
269 return {
270 .calls{
271 .objective = static_cast<unsigned>(calls[0]),
272 .objective_grad = static_cast<unsigned>(calls[1]),
273 .objective_hess = static_cast<unsigned>(calls[2]),
274 .hessian_times_vector = static_cast<unsigned>(calls[3]),
275 .constraints = constr ? static_cast<unsigned>(calls[4]) : 0,
276 .constraints_grad = constr ? static_cast<unsigned>(calls[5]) : 0,
277 .constraints_hess = constr ? static_cast<unsigned>(calls[6]) : 0,
278 },
279 .time_setup = time[0],
280 .time = time[1],
281 };
282}
283
285 assert(x.size() == static_cast<length_t>(impl->nvar));
286 real_t f;
288 checked(impl->funcs.cofg, "eval_f: CUTEST_cofg")(&impl->nvar, x.data(), &f,
289 nullptr, &grad);
290 return f;
291}
293 assert(x.size() == static_cast<length_t>(impl->nvar));
294 assert(grad_fx.size() == static_cast<length_t>(impl->nvar));
295 real_t f;
297 checked(impl->funcs.cofg, "eval_grad_f: CUTEST_cofg")(
298 &impl->nvar, x.data(), &f, grad_fx.data(), &grad);
299}
301 assert(x.size() == static_cast<length_t>(impl->nvar));
302 assert(gx.size() == static_cast<length_t>(impl->ncon));
305 checked(impl->funcs.ccfg, "eval_g: CUTEST_ccfg")(
306 &impl->nvar, &impl->ncon, x.data(), gx.data(), &jtrans, &zero, &zero,
307 nullptr, &grad);
308}
310 assert(x.size() == static_cast<length_t>(impl->nvar));
311 assert(y.size() == static_cast<length_t>(impl->ncon));
312 assert(grad_gxy.size() == static_cast<length_t>(impl->nvar));
313 auto lvector = static_cast<cutest::integer>(y.size()),
314 lresult = static_cast<cutest::integer>(grad_gxy.size());
316 checked(impl->funcs.cjprod, "eval_grad_g_prod: CUTEST_cjprod")(
317 &impl->nvar, &impl->ncon, &gotj, &jtrans, x.data(), y.data(), &lvector,
318 grad_gxy.data(), &lresult);
319}
320
322 // Compute the nonzero values
323 assert(x.size() == static_cast<length_t>(impl->nvar));
324 // Sparse Jacobian
325 if (sparse) {
326 assert(nnz_J >= 0);
327 assert(J_values.size() == static_cast<length_t>(nnz_J));
328 assert(storage_jac_g.rows.size() == static_cast<length_t>(nnz_J));
329 assert(storage_jac_g.cols.size() == static_cast<length_t>(nnz_J));
330 const cutest::integer nnz = nnz_J;
332 checked(impl->funcs.ccfsg, "eval_jac_g: CUTEST_ccfsg")(
333 &impl->nvar, &impl->ncon, x.data(), impl->work.data(), &nnz_J, &nnz,
334 J_values.data(), storage_jac_g.cols.data(),
335 storage_jac_g.rows.data(), &grad);
336 }
337 // Dense Jacobian
338 else {
339 assert(J_values.size() == static_cast<length_t>(impl->nvar) *
340 static_cast<length_t>(impl->ncon));
342 checked(impl->funcs.ccfg, "eval_jac_g: CUTEST_ccfg")(
343 &impl->nvar, &impl->ncon, x.data(), impl->work.data(), &jtrans,
344 &impl->ncon, &impl->nvar, J_values.data(), &grad);
345 }
346}
348 if (!sparse)
350 .rows = m,
351 .cols = n,
353 };
354 if (nnz_J < 0) {
355 checked(impl->funcs.cdimsj,
356 "get_jac_g_sparsity: CUTEST_cdimsj")(&nnz_J);
357 nnz_J -= impl->nvar;
358 assert(nnz_J >= 0);
359 storage_jac_g.cols.resize(nnz_J);
360 storage_jac_g.rows.resize(nnz_J);
361 const cutest::integer nnz = nnz_J;
362 checked(impl->funcs.csjp, "eval_jac_g: CUTEST_csjp")(
363 &nnz_J, &nnz, storage_jac_g.cols.data(), storage_jac_g.rows.data());
364 }
365 using SparseCOO = sparsity::SparseCOO<config_t, int>;
366 return SparseCOO{
367 .rows = m,
368 .cols = n,
370 .row_indices = storage_jac_g.rows,
371 .col_indices = storage_jac_g.cols,
372 .order = SparseCOO::Unsorted,
373 .first_index = 1, // Fortran-style indices
374 };
375}
377 assert(x.size() == static_cast<length_t>(impl->nvar));
378 assert(grad_gi.size() == static_cast<length_t>(impl->nvar));
379 auto iprob = static_cast<cutest::integer>(i + 1); // index zero is objective
380 checked(impl->funcs.cigr, "eval_grad_gi: CUTEST_cigr")(
381 &impl->nvar, &iprob, x.data(), grad_gi.data());
382}
384 rvec Hv) const {
385 assert(x.size() == static_cast<length_t>(impl->nvar));
386 assert(y.size() == static_cast<length_t>(impl->ncon));
387 assert(v.size() == static_cast<length_t>(impl->nvar));
388 assert(Hv.size() == static_cast<length_t>(impl->nvar));
389 const auto *mult = y.data();
390 if (scale != 1) {
391 impl->work = y * (real_t(1) / scale);
392 mult = impl->work.data();
393 }
395 checked(impl->funcs.chprod, "eval_hess_L_prod: CUTEST_chprod")(
396 &impl->nvar, &impl->ncon, &goth, x.data(), mult,
397 const_cast<real_t *>(v.data()), Hv.data());
398 if (scale != 1)
399 Hv *= scale;
400}
402 crvec v, rvec Hv) const {
403 assert(x.size() == static_cast<length_t>(impl->nvar));
404 assert(y.size() == static_cast<length_t>(impl->ncon));
405 assert(Σ.size() == static_cast<length_t>(impl->ncon));
406 assert(v.size() == static_cast<length_t>(impl->nvar));
407 assert(Hv.size() == static_cast<length_t>(impl->nvar));
408 auto &&ζ = impl->work.topRows(impl->ncon);
409 auto &&ŷ = impl->work2.topRows(impl->ncon);
410 // ζ = g(x) + Σ⁻¹y
411 eval_g(x, ζ);
412 ζ += Σ.asDiagonal().inverse() * y;
413 // d = ζ - Π(ζ, D)
414 this->eval_proj_diff_g(ζ, ŷ);
415 // ŷ = Σ d
416 ŷ.array() *= Σ.array();
417 // Hv = ∇²ℒ(x, ŷ) v
419 // Find active constraints
420 for (index_t i = 0; i < impl->ncon; ++i)
421 ζ(i) = (ζ(i) <= D.lowerbound(i)) || (D.upperbound(i) <= ζ(i))
422 ? Σ(i)
423 : real_t(0);
424 // Jg(x) v
425 auto &&Jv = impl->work2.topRows(impl->ncon);
426 auto lvector = static_cast<cutest::integer>(v.size()),
427 lresult = static_cast<cutest::integer>(Jv.size());
429 checked(impl->funcs.cjprod, "eval_hess_ψ_prod: CUTEST_cjprod-1")(
430 &impl->nvar, &impl->ncon, &gotj, &jtrans, x.data(), v.data(), &lvector,
431 Jv.data(), &lresult);
432 // Σ Jg v
433 Jv.array() *= ζ.array();
434 // Jgᵀ Σ Jg v
435 std::swap(lvector, lresult);
437 auto &&JΣJv = impl->work.topRows(impl->nvar);
438 checked(impl->funcs.cjprod, "eval_hess_ψ_prod: CUTEST_cjprod-2")(
439 &impl->nvar, &impl->ncon, &gotj, &jtrans, x.data(), Jv.data(), &lvector,
440 JΣJv.data(), &lresult);
441 Hv += JΣJv;
442}
444 rvec H_values) const {
445 // Compute the nonzero values
446 assert(x.size() == static_cast<length_t>(impl->nvar));
447 assert(y.size() == static_cast<length_t>(impl->ncon));
448 const auto *mult = y.data();
449 if (scale != 1) {
450 impl->work = y * (real_t(1) / scale);
451 mult = impl->work.data();
452 }
453 // Sparse Hessian
454 if (sparse) {
455 assert(nnz_H >= 0);
456 assert(H_values.size() == static_cast<length_t>(nnz_H));
457 assert(storage_hess_L.rows.size() == static_cast<length_t>(nnz_H));
458 assert(storage_hess_L.cols.size() == static_cast<length_t>(nnz_H));
459 const cutest::integer nnz = nnz_H;
460 checked(impl->funcs.csh, "eval_hess_L: CUTEST_csh")(
461 &impl->nvar, &impl->ncon, x.data(), y.data(), &nnz_H, &nnz,
462 H_values.data(), storage_hess_L.rows.data(),
463 storage_hess_L.cols.data());
464 }
465 // Dense Hessian
466 else {
467 assert(H_values.size() == static_cast<length_t>(impl->nvar) *
468 static_cast<length_t>(impl->nvar));
469 checked(impl->funcs.cdh,
470 "eval_hess_L: CUTEST_cdh")(&impl->nvar, &impl->ncon, x.data(),
471 mult, &impl->nvar, H_values.data());
472 }
473 if (scale != 1)
474 H_values *= scale;
475}
477 if (!sparse)
479 .rows = n,
480 .cols = n,
481 .symmetry = sparsity::Symmetry::Upper,
482 };
483 if (nnz_H < 0) {
484 checked(impl->funcs.cdimsh,
485 "get_hess_L_sparsity: CUTEST_cdimsh")(&nnz_H);
486 assert(nnz_H >= 0);
487 storage_hess_L.rows.resize(nnz_H);
488 storage_hess_L.cols.resize(nnz_H);
489 const cutest::integer nnz = nnz_H;
490 checked(impl->funcs.cshp, "eval_hess_L: CUTEST_cshp")(
491 &impl->nvar, &nnz_H, &nnz, storage_hess_L.rows.data(),
492 storage_hess_L.cols.data());
493 }
494 using SparseCOO = sparsity::SparseCOO<config_t, int>;
495 return SparseCOO{
496 .rows = n,
497 .cols = n,
498 .symmetry = sparsity::Symmetry::Upper,
499 .row_indices = storage_hess_L.rows,
500 .col_indices = storage_hess_L.cols,
501 .order = SparseCOO::Unsorted,
502 .first_index = 1, // Fortran-style indices
503 };
504}
506 assert(x.size() == static_cast<length_t>(impl->nvar));
507 assert(grad_fx.size() == static_cast<length_t>(impl->nvar));
508 real_t f;
510 checked(impl->funcs.cofg, "eval_f_grad_f: CUTEST_cofg")(
511 &impl->nvar, x.data(), &f, grad_fx.data(), &grad);
512 return f;
513}
515 assert(x.size() == static_cast<length_t>(impl->nvar));
516 assert(g.size() == static_cast<length_t>(impl->ncon));
517 real_t f;
518 checked(impl->funcs.cfn, "eval_f_g: CUTEST_cfn")(&impl->nvar, &impl->ncon,
519 x.data(), &f, g.data());
520 return f;
521}
522void CUTEstProblem::eval_grad_L(crvec x, crvec y, rvec grad_L, rvec) const {
523 assert(x.size() == static_cast<length_t>(impl->nvar));
524 assert(y.size() == static_cast<length_t>(impl->ncon));
525 assert(grad_L.size() == static_cast<length_t>(impl->nvar));
526 real_t L;
528 checked(impl->funcs.clfg, "eval_f_g: CUTEST_clfg")(
529 &impl->nvar, &impl->ncon, x.data(), y.data(), &L, grad_L.data(), &grad);
530}
531
532std::ostream &CUTEstProblem::format_report(std::ostream &os,
533 const Report &r) const {
534 os << "CUTEst problem: " << name << "\r\n\n"
535 << "Number of variables: " << n << "\r\n"
536 << "Number of constraints: " << m << "\r\n\n"
537 << "Objective function evaluations: " //
538 << r.calls.objective << "\r\n"
539 << "Objective function gradient evaluations: " //
540 << r.calls.objective_grad << "\r\n"
541 << "Objective function Hessian evaluations: " //
542 << r.calls.objective_hess << "\r\n"
543 << "Hessian times vector products: " //
544 << r.calls.objective_hess << "\r\n\n";
545 if (m > 0) {
546 os << "Constraint function evaluations: " //
547 << r.calls.constraints << "\r\n"
548 << "Constraint function gradients evaluations: " //
549 << r.calls.constraints_grad << "\r\n"
550 << "Constraint function Hessian evaluations: " //
551 << r.calls.constraints_hess << "\r\n\n";
552 }
553 return os << "Setup time: " << r.time_setup << "s\r\n"
554 << "Time since setup: " << r.time << "s";
555}
556
557} // 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:20
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:55
Stores any of the supported sparsity patterns.
Definition sparsity.hpp:105