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