BELFEM 0.9.0
Berkeley Lab Finite Element Framework
Loading...
Searching...
No Matches
en_Opt_Status.hpp
Go to the documentation of this file.
1/*
2 * BELFEM -- The Berkeley Lab Finite Element Framework
3 * Copyright (c) 2026, The Regents of the University of California,
4 * through Lawrence Berkeley National Laboratory (subject to receipt of any required
5 * approvals from the U.S. Dept. of Energy). All rights reserved.
6 *
7 * Developers: Christian Messe, Gregory Giard
8 *
9 * See the top-level LICENSE file for the complete license and disclaimer.
10 */
11
12#ifndef BELFEM_EN_OPT_STATUS_HPP
13#define BELFEM_EN_OPT_STATUS_HPP
14
15#include "typedefs.hpp"
16
17namespace belfem
18{
19 namespace opt
20 {
26 enum class Status
27 {
28 // --- success: the optimizer converged on a stopping criterion ---
29 SUCCESS = 0, // generic success
30 STOPVAL_REACHED = 1, // objective dropped below the stop value
31 FTOL_REACHED = 2, // relative change of objective below ftol
32 XTOL_REACHED = 3, // relative change of design vector below xtol
33 MAXEVAL_REACHED = 4, // reached the maximum number of evaluations
34 MAXTIME_REACHED = 5, // reached the maximum wall-clock time
35
36 // --- failure: no usable result was produced -------------------
37 FAILURE = 6, // generic failure
38 INVALID_ARGS = 7, // bounds/tolerances inconsistent
39 OUT_OF_MEMORY = 8, // allocation failed
40 ROUNDOFF_LIMITED = 9, // halted by roundoff, result may be inaccurate
41 FORCED_STOP = 10 // objective requested an early stop
42 };
43
44//------------------------------------------------------------------------------
45
49 inline bool
50 is_success( const Status aStatus )
51 {
52 return aStatus <= Status::MAXTIME_REACHED;
53 }
54
55//------------------------------------------------------------------------------
56
67 inline bool
68 is_usable( const Status aStatus )
69 {
70 return is_success( aStatus )
71 || aStatus == Status::ROUNDOFF_LIMITED
72 || aStatus == Status::FORCED_STOP;
73 }
74
75//------------------------------------------------------------------------------
76
82 string
83 error_message( const Status aStatus );
84
85//------------------------------------------------------------------------------
86 }
87}
88#endif //BELFEM_EN_OPT_STATUS_HPP
Definition cl_Objective.hpp:21
bool is_usable(const Status aStatus)
true if the returned design point is usable, even when the solver did not terminate on a clean conver...
Definition en_Opt_Status.hpp:68
string error_message(const Status aStatus)
human-readable explanation of an optimizer status, suitable for a BELFEM_ERROR message when is_usable...
Definition cl_Optimizer.cpp:62
bool is_success(const Status aStatus)
true if the status corresponds to a converged / usable result
Definition en_Opt_Status.hpp:50
Status
outcome of an optimization run.
Definition en_Opt_Status.hpp:27
@ FAILURE
Definition en_Opt_Status.hpp:37
@ MAXEVAL_REACHED
Definition en_Opt_Status.hpp:33
@ XTOL_REACHED
Definition en_Opt_Status.hpp:32
@ STOPVAL_REACHED
Definition en_Opt_Status.hpp:30
@ INVALID_ARGS
Definition en_Opt_Status.hpp:38
@ FORCED_STOP
Definition en_Opt_Status.hpp:41
@ FTOL_REACHED
Definition en_Opt_Status.hpp:31
@ OUT_OF_MEMORY
Definition en_Opt_Status.hpp:39
@ SUCCESS
Definition en_Opt_Status.hpp:29
@ ROUNDOFF_LIMITED
Definition en_Opt_Status.hpp:40
@ MAXTIME_REACHED
Definition en_Opt_Status.hpp:34
USER GUIDES:
Definition cl_Capacitor.cpp:16