Nonconvex constrained optimization
Loading...
Searching...
No Matches
problem-loader.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <alpaqa/problem-loader-export.h>
4
9
10#include <filesystem>
11#include <iosfwd>
12#include <memory>
13#include <optional>
14
15namespace alpaqa {
16
17namespace fs = std::filesystem;
18
19struct PROBLEM_LOADER_EXPORT ConstrCount {
21 ConstrCount() = default;
22 length_t lb = 0; ///< Number of variables with only lower bound
23 length_t ub = 0; ///< Number of variables with only upper bound
24 length_t lbub = 0; ///< Number of variables with both bounds
25 length_t eq = 0; ///< Number of variables with equal bounds
26};
27
28struct PROBLEM_LOADER_EXPORT LoadedProblem {
31 fs::path abs_path;
32 fs::path path;
33 std::string name = path.filename().string();
34 std::shared_ptr<alpaqa::EvalCounter> evaluations = nullptr;
35 vec initial_guess_x = vec::Zero(problem.get_num_variables()); ///< Unknowns
37 vec::Zero(problem.get_num_constraints()); ///< Multipliers g
39 std::optional<ConstrCount> box_constr_count = std::nullopt,
40 general_constr_count = std::nullopt;
41 std::optional<length_t> nnz_jac_g = std::nullopt, nnz_hess_L = std::nullopt,
42 nnz_hess_ψ = std::nullopt;
43};
44
45PROBLEM_LOADER_EXPORT
46LoadedProblem load_problem(std::string_view type, const fs::path &file,
47 Options &opts);
48
49PROBLEM_LOADER_EXPORT
50void print_problem_description(std::ostream &os, LoadedProblem &problem,
51 bool show_funcs = true);
52
53} // namespace alpaqa
The main polymorphic minimization problem interface.
#define USING_ALPAQA_CONFIG(Conf)
Definition config.hpp:77
vec initial_guess_y
Multipliers g.
PROBLEM_LOADER_EXPORT LoadedProblem load_problem(std::string_view type, const fs::path &file, Options &opts)
vec initial_guess_w
Multipliers bounds.
std::optional< length_t > nnz_hess_L
std::optional< ConstrCount > general_constr_count
EigenConfigd DefaultConfig
Definition config.hpp:31
std::optional< length_t > nnz_hess_ψ
const rvec< Conf > null_vec
Global empty vector for convenience.
Definition config.hpp:193
alpaqa::TypeErasedProblem< config_t > problem
typename Conf::length_t length_t
Definition config.hpp:103
typename Conf::vec vec
Definition config.hpp:88
std::optional< ConstrCount > box_constr_count
std::optional< length_t > nnz_jac_g
PROBLEM_LOADER_EXPORT void print_problem_description(std::ostream &os, LoadedProblem &problem, bool show_funcs=true)
std::shared_ptr< alpaqa::EvalCounter > evaluations
length_t ub
Number of variables with only upper bound.
length_t eq
Number of variables with equal bounds.
length_t lb
Number of variables with only lower bound.
length_t lbub
Number of variables with both bounds.