alpaqa 1.0.0a19
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 namespace fs = std::filesystem;
118 auto path = fs::path(so_fname);
119 if (fs::is_directory(path))
120 path /= "PROBLEM.so";
121 // Open the shared library
122 so_handle = load_lib(path.c_str());
123
124 // Open the OUTSDIF.d file
126 path = outsdif_fname;
127 else
128 path.replace_filename("OUTSDIF.d");
129 cleanup_outsdif = load_outsdif(path.c_str());
130
131 // Get the dimensions of the problem
132 integer status;
133 call<cutest::cdimen>(&status, &funit, &nvar, &ncon);
134 throw_if_error("Failed to call cutest_cdimen", status);
135 }
136
154
155 void setup_problem(rvec x0, rvec y0, Box &C, Box &D) {
156 assert(x0.size() == static_cast<length_t>(nvar));
157 assert(C.lowerbound.size() == static_cast<length_t>(nvar));
158 assert(C.upperbound.size() == static_cast<length_t>(nvar));
159 assert(y0.size() == static_cast<length_t>(ncon));
160 assert(D.lowerbound.size() == static_cast<length_t>(ncon));
161 assert(D.upperbound.size() == static_cast<length_t>(ncon));
162
163 // Variables returned and required by csetup
164 equatn.resize(static_cast<length_t>(ncon));
165 linear.resize(static_cast<length_t>(ncon));
166 integer e_order = 0; // no specific order of equality constraints
167 integer l_order = 0; // no specific order of linear constraints
168 integer v_order = 0; // no specific order of linear variables
169 integer status;
170
171 // Initialize the problem
173 &status, &funit, &iout, &io_buffer, &nvar, &ncon, x0.data(),
174 C.lowerbound.data(), C.upperbound.data(), y0.data(),
175 D.lowerbound.data(), D.upperbound.data(), equatn.data(),
176 linear.data(), &e_order, &l_order, &v_order);
177 throw_if_error("Failed to call cutest_csetup", status);
179
180 // Check the number of constraints
181 if (ncon == 0)
182 throw std::runtime_error(
183 "Unconstrained CUTEst problems are currently unsupported");
184
185 // Allocate workspaces
186 work.resize(std::max(nvar, ncon));
187 work2.resize(std::max(nvar, ncon));
188 // Convert bounds
189 std::ranges::replace(C.lowerbound, -cutest::inf, -inf<config_t>);
190 std::ranges::replace(C.upperbound, +cutest::inf, +inf<config_t>);
191 std::ranges::replace(D.lowerbound, -cutest::inf, -inf<config_t>);
192 std::ranges::replace(D.upperbound, +cutest::inf, +inf<config_t>);
193 // Load problem functions and gradients
194 funcs = {
196 .cofg = load<cutest::cofg>(),
197 .ccfg = load<cutest::ccfg>(),
198 .clfg = load<cutest::clfg>(),
199 .cjprod = load<cutest::cjprod>(),
200 .ccifg = load<cutest::ccifg>(),
201 .cigr = load<cutest::cigr>(),
202 .cdimsj = load<cutest::cdimsj>(),
203 .csjp = load<cutest::csjp>(),
204 .ccfsg = load<cutest::ccfsg>(),
205 .cdh = load<cutest::cdh>(),
206 .cdimsh = load<cutest::cdimsh>(),
207 .cshp = load<cutest::cshp>(),
208 .csh = load<cutest::csh>(),
209 .chprod = load<cutest::chprod>(),
210 };
211 }
212
213 std::string get_name() {
214 std::string name(cutest::fstring_len, ' ');
215 integer status;
216 call<cutest::probname>(&status, name.data());
217 throw_if_error("Failed to call CUTEST_probname", status);
218 if (auto last = name.find_last_not_of(' '); last != name.npos)
219 name.resize(last + 1);
220 return name;
221 }
222
223 void get_report(double *calls, double *time) {
224 integer status;
225 if (ncon > 0) {
226 call<cutest::creport>(&status, calls, time);
227 throw_if_error("Failed to call CUTEST_creport", status);
228 } else {
229 call<cutest::ureport>(&status, calls, time);
230 throw_if_error("Failed to call CUTEST_ureport", status);
231 }
232 }
233
234 // Order of cleanup is important!
235 std::shared_ptr<void> so_handle; ///< dlopen handle to shared library
236 cleanup_t cleanup_outsdif; ///< Responsible for closing the OUTSDIF.d file
237 cleanup_t cutest_terminate; ///< Responsible for calling CUTEST_xterminate
238
239 integer funit = 42; ///< Fortran Unit Number for OUTSDIF.d file
240 integer iout = 6; ///< Fortran Unit Number for standard output
241 integer io_buffer = 11; ///< Fortran Unit Number for internal IO
242
243 integer nvar; ///< Number of decision variabls
244 integer ncon; ///< Number of constraints
245 ConstrFuncs funcs; /// Pointers to loaded problem functions
246
247 using logical_vec = Eigen::VectorX<logical>;
248 logical_vec equatn; ///< whether the constraint is an equality
249 logical_vec linear; ///< whether the constraint is linear
250 mutable vec work, work2; ///< work vectors
251};
252
254 bool sparse)
255 : BoxConstrProblem<config_t>{0, 0}, sparse{sparse} {
256 impl = std::make_unique<CUTEstLoader>(so_fname, outsdif_fname);
257 resize(static_cast<length_t>(impl->nvar),
258 static_cast<length_t>(impl->ncon));
259 x0.resize(n);
260 y0.resize(m);
261 impl->setup_problem(x0, y0, C, D);
262 name = impl->get_name();
263}
264
265CUTEstProblem::CUTEstProblem(const CUTEstProblem &) = default;
266CUTEstProblem &CUTEstProblem::operator=(const CUTEstProblem &) = default;
268CUTEstProblem &CUTEstProblem::operator=(CUTEstProblem &&) noexcept = default;
269CUTEstProblem::~CUTEstProblem() = default;
270
271auto CUTEstProblem::get_report() const -> Report {
272 double calls[7]; // NOLINT(*-c-arrays)
273 double time[2]; // NOLINT(*-c-arrays)
274 impl->get_report(calls, time);
275 const bool constr = impl->ncon > 0;
276 return {
277 .calls{
278 .objective = static_cast<unsigned>(calls[0]),
279 .objective_grad = static_cast<unsigned>(calls[1]),
280 .objective_hess = static_cast<unsigned>(calls[2]),
281 .hessian_times_vector = static_cast<unsigned>(calls[3]),
282 .constraints = constr ? static_cast<unsigned>(calls[4]) : 0,
283 .constraints_grad = constr ? static_cast<unsigned>(calls[5]) : 0,
284 .constraints_hess = constr ? static_cast<unsigned>(calls[6]) : 0,
285 },
286 .time_setup = time[0],
287 .time = time[1],
288 };
289}
290
292 assert(x.size() == static_cast<length_t>(impl->nvar));
293 real_t f;
295 checked(impl->funcs.cofg, "eval_f: CUTEST_cofg")(&impl->nvar, x.data(), &f,
296 nullptr, &grad);
297 return f;
298}
300 assert(x.size() == static_cast<length_t>(impl->nvar));
301 assert(grad_fx.size() == static_cast<length_t>(impl->nvar));
302 real_t f;
304 checked(impl->funcs.cofg, "eval_grad_f: CUTEST_cofg")(
305 &impl->nvar, x.data(), &f, grad_fx.data(), &grad);
306}
308 assert(x.size() == static_cast<length_t>(impl->nvar));
309 assert(gx.size() == static_cast<length_t>(impl->ncon));
312 checked(impl->funcs.ccfg, "eval_g: CUTEST_ccfg")(
313 &impl->nvar, &impl->ncon, x.data(), gx.data(), &jtrans, &zero, &zero,
314 nullptr, &grad);
315}
317 assert(x.size() == static_cast<length_t>(impl->nvar));
318 assert(y.size() == static_cast<length_t>(impl->ncon));
319 assert(grad_gxy.size() == static_cast<length_t>(impl->nvar));
320 auto lvector = static_cast<cutest::integer>(y.size()),
321 lresult = static_cast<cutest::integer>(grad_gxy.size());
323 checked(impl->funcs.cjprod, "eval_grad_g_prod: CUTEST_cjprod")(
324 &impl->nvar, &impl->ncon, &gotj, &jtrans, x.data(), y.data(), &lvector,
325 grad_gxy.data(), &lresult);
326}
327
329 // Compute the nonzero values
330 assert(x.size() == static_cast<length_t>(impl->nvar));
331 // Sparse Jacobian
332 if (sparse) {
333 assert(nnz_J >= 0);
334 assert(J_values.size() == static_cast<length_t>(nnz_J));
335 assert(storage_jac_g.rows.size() == static_cast<length_t>(nnz_J));
336 assert(storage_jac_g.cols.size() == static_cast<length_t>(nnz_J));
337 const cutest::integer nnz = nnz_J;
339 checked(impl->funcs.ccfsg, "eval_jac_g: CUTEST_ccfsg")(
340 &impl->nvar, &impl->ncon, x.data(), impl->work.data(), &nnz_J, &nnz,
341 J_values.data(), storage_jac_g.cols.data(),
342 storage_jac_g.rows.data(), &grad);
343 }
344 // Dense Jacobian
345 else {
346 assert(J_values.size() == static_cast<length_t>(impl->nvar) *
347 static_cast<length_t>(impl->ncon));
349 checked(impl->funcs.ccfg, "eval_jac_g: CUTEST_ccfg")(
350 &impl->nvar, &impl->ncon, x.data(), impl->work.data(), &jtrans,
351 &impl->ncon, &impl->nvar, J_values.data(), &grad);
352 }
353}
355 if (!sparse)
357 .rows = m,
358 .cols = n,
360 };
361 if (nnz_J < 0) {
362 checked(impl->funcs.cdimsj,
363 "get_jac_g_sparsity: CUTEST_cdimsj")(&nnz_J);
364 nnz_J -= impl->nvar;
365 assert(nnz_J >= 0);
366 storage_jac_g.cols.resize(nnz_J);
367 storage_jac_g.rows.resize(nnz_J);
368 const cutest::integer nnz = nnz_J;
369 checked(impl->funcs.csjp, "eval_jac_g: CUTEST_csjp")(
370 &nnz_J, &nnz, storage_jac_g.cols.data(), storage_jac_g.rows.data());
371 }
372 using SparseCOO = sparsity::SparseCOO<config_t, int>;
373 return SparseCOO{
374 .rows = m,
375 .cols = n,
377 .row_indices = storage_jac_g.rows,
378 .col_indices = storage_jac_g.cols,
379 .order = SparseCOO::Unsorted,
380 .first_index = 1, // Fortran-style indices
381 };
382}
384 assert(x.size() == static_cast<length_t>(impl->nvar));
385 assert(grad_gi.size() == static_cast<length_t>(impl->nvar));
386 auto iprob = static_cast<cutest::integer>(i + 1); // index zero is objective
387 checked(impl->funcs.cigr, "eval_grad_gi: CUTEST_cigr")(
388 &impl->nvar, &iprob, x.data(), grad_gi.data());
389}
391 rvec Hv) const {
392 assert(x.size() == static_cast<length_t>(impl->nvar));
393 assert(y.size() == static_cast<length_t>(impl->ncon));
394 assert(v.size() == static_cast<length_t>(impl->nvar));
395 assert(Hv.size() == static_cast<length_t>(impl->nvar));
396 const auto *mult = y.data();
397 if (scale != 1) {
398 impl->work = y * (real_t(1) / scale);
399 mult = impl->work.data();
400 }
402 checked(impl->funcs.chprod, "eval_hess_L_prod: CUTEST_chprod")(
403 &impl->nvar, &impl->ncon, &goth, x.data(), mult,
404 const_cast<real_t *>(v.data()), Hv.data());
405 if (scale != 1)
406 Hv *= scale;
407}
409 crvec v, rvec Hv) const {
410 assert(x.size() == static_cast<length_t>(impl->nvar));
411 assert(y.size() == static_cast<length_t>(impl->ncon));
412 assert(Σ.size() == static_cast<length_t>(impl->ncon));
413 assert(v.size() == static_cast<length_t>(impl->nvar));
414 assert(Hv.size() == static_cast<length_t>(impl->nvar));
415 auto &&ζ = impl->work.topRows(impl->ncon);
416 auto &&ŷ = impl->work2.topRows(impl->ncon);
417 // ζ = g(x) + Σ⁻¹y
418 eval_g(x, ζ);
419 ζ += y.cwiseQuotient(Σ);
420 // d = ζ - Π(ζ, D)
421 this->eval_proj_diff_g(ζ, ŷ);
422 // ŷ = Σ d
423 ŷ.array() *= Σ.array();
424 // Hv = ∇²ℒ(x, ŷ) v
425 eval_hess_L_prod(x, ŷ, scale, v, Hv);
426 // Find active constraints
427 for (index_t i = 0; i < impl->ncon; ++i)
428 ζ(i) = (ζ(i) <= D.lowerbound(i)) || (D.upperbound(i) <= ζ(i))
429 ? Σ(i)
430 : real_t(0);
431 // Jg(x) v
432 auto &&Jv = impl->work2.topRows(impl->ncon);
433 auto lvector = static_cast<cutest::integer>(v.size()),
434 lresult = static_cast<cutest::integer>(Jv.size());
436 checked(impl->funcs.cjprod, "eval_hess_ψ_prod: CUTEST_cjprod-1")(
437 &impl->nvar, &impl->ncon, &gotj, &jtrans, x.data(), v.data(), &lvector,
438 Jv.data(), &lresult);
439 // Σ Jg v
440 Jv.array() *= ζ.array();
441 // Jgᵀ Σ Jg v
442 std::swap(lvector, lresult);
444 auto &&JΣJv = impl->work.topRows(impl->nvar);
445 checked(impl->funcs.cjprod, "eval_hess_ψ_prod: CUTEST_cjprod-2")(
446 &impl->nvar, &impl->ncon, &gotj, &jtrans, x.data(), Jv.data(), &lvector,
447 JΣJv.data(), &lresult);
448 Hv += JΣJv;
449}
451 rvec H_values) const {
452 // Compute the nonzero values
453 assert(x.size() == static_cast<length_t>(impl->nvar));
454 assert(y.size() == static_cast<length_t>(impl->ncon));
455 const auto *mult = y.data();
456 if (scale != 1) {
457 impl->work = y * (real_t(1) / scale);
458 mult = impl->work.data();
459 }
460 // Sparse Hessian
461 if (sparse) {
462 assert(nnz_H >= 0);
463 assert(H_values.size() == static_cast<length_t>(nnz_H));
464 assert(storage_hess_L.rows.size() == static_cast<length_t>(nnz_H));
465 assert(storage_hess_L.cols.size() == static_cast<length_t>(nnz_H));
466 const cutest::integer nnz = nnz_H;
467 checked(impl->funcs.csh, "eval_hess_L: CUTEST_csh")(
468 &impl->nvar, &impl->ncon, x.data(), y.data(), &nnz_H, &nnz,
469 H_values.data(), storage_hess_L.rows.data(),
470 storage_hess_L.cols.data());
471 }
472 // Dense Hessian
473 else {
474 assert(H_values.size() == static_cast<length_t>(impl->nvar) *
475 static_cast<length_t>(impl->nvar));
476 checked(impl->funcs.cdh,
477 "eval_hess_L: CUTEST_cdh")(&impl->nvar, &impl->ncon, x.data(),
478 mult, &impl->nvar, H_values.data());
479 }
480 if (scale != 1)
481 H_values *= scale;
482}
484 if (!sparse)
486 .rows = n,
487 .cols = n,
488 .symmetry = sparsity::Symmetry::Upper,
489 };
490 if (nnz_H < 0) {
491 checked(impl->funcs.cdimsh,
492 "get_hess_L_sparsity: CUTEST_cdimsh")(&nnz_H);
493 assert(nnz_H >= 0);
494 storage_hess_L.rows.resize(nnz_H);
495 storage_hess_L.cols.resize(nnz_H);
496 const cutest::integer nnz = nnz_H;
497 checked(impl->funcs.cshp, "eval_hess_L: CUTEST_cshp")(
498 &impl->nvar, &nnz_H, &nnz, storage_hess_L.rows.data(),
499 storage_hess_L.cols.data());
500 }
501 using SparseCOO = sparsity::SparseCOO<config_t, int>;
502 return SparseCOO{
503 .rows = n,
504 .cols = n,
505 .symmetry = sparsity::Symmetry::Upper,
506 .row_indices = storage_hess_L.rows,
507 .col_indices = storage_hess_L.cols,
508 .order = SparseCOO::Unsorted,
509 .first_index = 1, // Fortran-style indices
510 };
511}
513 assert(x.size() == static_cast<length_t>(impl->nvar));
514 assert(grad_fx.size() == static_cast<length_t>(impl->nvar));
515 real_t f;
517 checked(impl->funcs.cofg, "eval_f_grad_f: CUTEST_cofg")(
518 &impl->nvar, x.data(), &f, grad_fx.data(), &grad);
519 return f;
520}
522 assert(x.size() == static_cast<length_t>(impl->nvar));
523 assert(g.size() == static_cast<length_t>(impl->ncon));
524 real_t f;
525 checked(impl->funcs.cfn, "eval_f_g: CUTEST_cfn")(&impl->nvar, &impl->ncon,
526 x.data(), &f, g.data());
527 return f;
528}
529void CUTEstProblem::eval_grad_L(crvec x, crvec y, rvec grad_L, rvec) const {
530 assert(x.size() == static_cast<length_t>(impl->nvar));
531 assert(y.size() == static_cast<length_t>(impl->ncon));
532 assert(grad_L.size() == static_cast<length_t>(impl->nvar));
533 real_t L;
535 checked(impl->funcs.clfg, "eval_f_g: CUTEST_clfg")(
536 &impl->nvar, &impl->ncon, x.data(), y.data(), &L, grad_L.data(), &grad);
537}
538
539std::ostream &CUTEstProblem::format_report(std::ostream &os,
540 const Report &r) const {
541 os << "CUTEst problem: " << name << "\r\n\n"
542 << "Number of variables: " << n << "\r\n"
543 << "Number of constraints: " << m << "\r\n\n"
544 << "Objective function evaluations: " //
545 << r.calls.objective << "\r\n"
546 << "Objective function gradient evaluations: " //
547 << r.calls.objective_grad << "\r\n"
548 << "Objective function Hessian evaluations: " //
549 << r.calls.objective_hess << "\r\n"
550 << "Hessian times vector products: " //
551 << r.calls.objective_hess << "\r\n\n";
552 if (m > 0) {
553 os << "Constraint function evaluations: " //
554 << r.calls.constraints << "\r\n"
555 << "Constraint function gradients evaluations: " //
556 << r.calls.constraints_grad << "\r\n"
557 << "Constraint function Hessian evaluations: " //
558 << r.calls.constraints_hess << "\r\n\n";
559 }
560 return os << "Setup time: " << r.time_setup << "s\r\n"
561 << "Time since setup: " << r.time << "s";
562}
563
564} // 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: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
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
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