1 /*  _______________________________________________________________________
2 
3     DAKOTA: Design Analysis Kit for Optimization and Terascale Applications
4     Copyright 2014-2020 National Technology & Engineering Solutions of Sandia, LLC (NTESS).
5     This software is distributed under the GNU Lesser General Public License.
6     For more information, see the README file in the top Dakota directory.
7     _______________________________________________________________________ */
8 
9 //- Class:        TraitsBase
10 //- Description:  Traits class used in registering the various functionalities
11 //                supported by individual Dakota optimization TPLs.
12 //- Owner:        Moe Khalil
13 //- Version: $Id: DakotaTraitsBase.hpp 0001 2017-02-21 10:35:14Z mkhalil $
14 
15 
16 #ifndef DAKOTA_TRAITS_BASE_H
17 #define DAKOTA_TRAITS_BASE_H
18 
19 namespace Dakota {
20 
21   enum class LINEAR_INEQUALITY_FORMAT    { NONE,
22                                            TWO_SIDED,
23                                            ONE_SIDED_LOWER,
24                                            ONE_SIDED_UPPER };
25 
26   enum class NONLINEAR_EQUALITY_FORMAT   { NONE,
27                                            TRUE_EQUALITY,
28                                            TWO_INEQUALITY };
29 
30   enum class NONLINEAR_INEQUALITY_FORMAT { NONE,
31                                            ONE_SIDED_UPPER,
32                                            ONE_SIDED_LOWER,
33                                            TWO_SIDED };
34 
35 /// Base class for traits.
36 
37 /** TraitsBase provides default traits through various accessors . */
38 
39 class TraitsBase
40 {
41 public:
42 
43   /// default constructor
44   TraitsBase();
45 
46   /// destructor
47   virtual ~TraitsBase();
48 
49   /// A temporary query used in the refactor
is_derived()50   virtual bool is_derived() { return false; }
51 
52   /// Return the flag indicating whether method requires bounds
requires_bounds()53   virtual bool requires_bounds() { return false; }
54 
55   /// Return the flag indicating whether method supports linear equalities
supports_linear_equality()56   virtual bool supports_linear_equality() { return false; }
57 
58   /// Return the flag indicating whether method supports linear inequalities
supports_linear_inequality()59   virtual bool supports_linear_inequality() { return false; }
60 
61   /// Return the format used for linear inequality constraints
linear_inequality_format()62   virtual LINEAR_INEQUALITY_FORMAT linear_inequality_format()
63     { return LINEAR_INEQUALITY_FORMAT::NONE; }
64 
65   /// Return the flag indicating whether method supports nonlinear equalities
supports_nonlinear_equality()66   virtual bool supports_nonlinear_equality() { return false; }
67 
68   /// Return the format used for nonlinear equality constraints
nonlinear_equality_format()69   virtual NONLINEAR_EQUALITY_FORMAT nonlinear_equality_format()
70     { return NONLINEAR_EQUALITY_FORMAT::NONE; }
71 
72   /// Return the flag indicating whether method supports nonlinear inequalities
supports_nonlinear_inequality()73   virtual bool supports_nonlinear_inequality() { return false; }
74 
75   /// Return the format used for nonlinear inequality constraints
nonlinear_inequality_format()76   virtual NONLINEAR_INEQUALITY_FORMAT nonlinear_inequality_format()
77     { return NONLINEAR_INEQUALITY_FORMAT::NONE; }
78 
79   /// Return the flag indicating whether method expects nonlinear inequality
80   /// constraints followed by nonlinear equality constraints
expects_nonlinear_inequalities_first()81   virtual bool expects_nonlinear_inequalities_first() { return true; }
82 
83   /// Return the flag indicating whether method supports parameter scaling
supports_scaling()84   virtual bool supports_scaling() { return false; }
85 
86   /// Return the flag indicating whether method supports least squares
supports_least_squares()87   virtual bool supports_least_squares() { return false; }
88 
89   /// Return flag indicating whether method supports multiobjective optimization
supports_multiobjectives()90   virtual bool supports_multiobjectives() { return false; }
91 
92   /// Return the flag indicating whether method supports continuous variables
supports_continuous_variables()93   virtual bool supports_continuous_variables() { return false; }
94 
95   /// Return the flag indicating whether method supports continuous variables
supports_discrete_variables()96   virtual bool supports_discrete_variables() { return false; }
97 
98   /// Return the flag indicating whether method provides best objective result
provides_best_objective()99   virtual bool provides_best_objective() { return false; }
100 
101   /// Return the flag indicating whether method provides best parameters result
provides_best_parameters()102   virtual bool provides_best_parameters() { return false; }
103 
104   /// Return the flag indicating whether method provides best constraint result
provides_best_constraint()105   virtual bool provides_best_constraint() { return false; }
106 
107   /// Return the flag indicating whether method provides final gradient result
provides_final_gradient()108   virtual bool provides_final_gradient() { return false; }
109 
110   /// Return the flag indicating whether method provides final hessian result
provides_final_hessian()111   virtual bool provides_final_hessian() { return false; }
112 };
113 
~TraitsBase()114 inline TraitsBase::~TraitsBase()
115 { }
116 
117 } // namespace Dakota
118 
119 #endif
120