Type traits and enums#
-
enum class thread_safety#
This enum defines a set of values that can be used to specify the thread safety level of an object.
Most of the user-defined classes that can be implemented in pagmo (i.e., problems, algorithms, etc.) provide mechanisms to specify which thread safety level is provided by objects of these classes. The information on the thread safety level is used by pagmo to establish at runtime whether or not it is safe to use an object in a multithreaded context.
For instance,
thread_island
will refuse to run parallel optimisations in multiple threads if the involvedproblem
oralgorithm
do not provide at least thebasic
thread safety level.The thread safety levels are ordered in the following way:
none
<basic
<constant
.-
enumerator none#
No thread safety: concurrent operations on distinct objects are unsafe.
-
enumerator basic#
Basic thread safety: concurrent operations on distinct objects are safe.
-
enumerator constant#
Constant thread safety: constant (i.e., read-only) concurrent operations on the same object are safe.
-
enumerator none#
-
std::ostream &operator<<(std::ostream &os, thread_safety ts)#
Stream operator for
thread_safety
. It will direct to the stream os a human-readable representation of ts.- Parameters
os – an output stream.
ts – the
thread_safety
to be directed to the output stream.
- Returns
a reference to os.
- Throws
unspecified – any exception raised by the public interface of
std::ostream
.
-
template<typename T>
class is_udp# Detect user-defined problems (UDP).
This type trait will be
true
ifT
is not cv/reference qualified, it is destructible, default, copy and move constructible, and if it satisfies the pagmo::has_fitness and pagmo::has_bounds type traits.Types satisfying this type trait can be used as user-defined problems (UDP) in pagmo::problem.
Public Static Attributes
-
static constexpr bool value = implementation_defined#
Value of the type trait.
-
static constexpr bool value = implementation_defined#
-
template<typename T>
class is_uda# Detect user-defined algorithms (UDA).
This type trait will be
true
ifT
is not cv/reference qualified, it is destructible, default, copy and move constructible, and if it satisfies the pagmo::has_evolve type trait.Types satisfying this type trait can be used as user-defined algorithms (UDA) in pagmo::algorithm.
Public Static Attributes
-
static const bool value = implementation_defined#
Value of the type trait.
-
static const bool value = implementation_defined#
-
template<typename T>
class has_fitness# Detect
fitness()
method.This type trait will be
true
ifT
provides a method with the following signature:Thevector_double fitness(const vector_double &) const;
fitness()
method is part of the interface for the definition of a problem (see pagmo::problem).Public Static Attributes
-
static constexpr bool value = implementation_defined#
Value of the type trait.
-
static constexpr bool value = implementation_defined#
-
template<typename T>
class has_bounds# Detect
get_bounds()
method.This type trait will be
true
ifT
provides a method with the following signature:Thestd::pair<vector_double, vector_double> get_bounds() const;
get_bounds()
method is part of the interface for the definition of a problem (see pagmo::problem).Public Static Attributes
-
static constexpr bool value = implementation_defined#
Value of the type trait.
-
static constexpr bool value = implementation_defined#
-
template<typename T>
class has_e_constraints# Detect
get_nec()
method.This type trait will be
true
ifT
provides a method with the following signature:Thevector_double::size_type get_nec() const;
get_nec()
method is part of the interface for the definition of a problem (see pagmo::problem).Public Static Attributes
-
static constexpr bool value = implementation_defined#
Value of the type trait.
-
static constexpr bool value = implementation_defined#
-
template<typename T>
class has_i_constraints# Detect
get_nic()
method.This type trait will be
true
ifT
provides a method with the following signature:Thevector_double::size_type get_nic() const;
get_nic()
method is part of the interface for the definition of a problem (see pagmo::problem).Public Static Attributes
-
static constexpr bool value = implementation_defined#
Value of the type trait.
-
static constexpr bool value = implementation_defined#
-
template<typename T>
class has_integer_part# Detect
get_nix()
method.This type trait will be
true
ifT
provides a method with the following signature:Thevector_double::size_type get_nix() const;
get_nix()
method is part of the interface for the definition of a problem (see pagmo::problem).Public Static Attributes
-
static constexpr bool value = implementation_defined#
Value of the type trait.
-
static constexpr bool value = implementation_defined#
-
template<typename T>
class has_name# Detect
get_name()
method.This type trait will be
true
ifT
provides a method with the following signature:Thestd::string get_name() const;
get_name()
method is part of the interface for the definition of problems and algorithms (see pagmo::problem and pagmo::algorithm).Public Static Attributes
-
static const bool value = implementation_defined#
Value of the type trait.
-
static const bool value = implementation_defined#
-
template<typename T>
class has_extra_info# Detect
get_extra_info()
method.This type trait will be
true
ifT
provides a method with the following signature:Thestd::string get_extra_info() const;
get_extra_info()
method is part of the interface for the definition of problems and algorithms (see pagmo::problem and pagmo::algorithm).Public Static Attributes
-
static const bool value = implementation_defined#
Value of the type trait.
-
static const bool value = implementation_defined#
-
template<typename T>
class has_get_thread_safety# Detect
get_thread_safety()
method.This type trait will be
true
ifT
provides a method with the following signature:Thepagmo::thread_safety get_thread_safety() const;
get_thread_safety()
method is part of the interface for the definition of problems and algorithms (see pagmo::problem and pagmo::algorithm).Public Static Attributes
-
static const bool value = implementation_defined#
Value of the type trait.
-
static const bool value = implementation_defined#
-
template<typename T>
class has_gradient# Detect
gradient()
method.This type trait will be
true
ifT
provides a method with the following signature:Thevector_double gradient(const vector_double &) const;
gradient()
method is part of the interface for the definition of a problem (see pagmo::problem).Public Static Attributes
-
static constexpr bool value = implementation_defined#
Value of the type trait.
-
static constexpr bool value = implementation_defined#
-
template<typename T>
class override_has_gradient# Detect
has_gradient()
method.This type trait will be
true
ifT
provides a method with the following signature:Thebool has_gradient() const;
has_gradient()
method is part of the interface for the definition of a problem (see pagmo::problem).Public Static Attributes
-
static constexpr bool value = implementation_defined#
Value of the type trait.
-
static constexpr bool value = implementation_defined#
-
template<typename T>
class has_gradient_sparsity# Detect
gradient_sparsity()
method.This type trait will be
true
ifT
provides a method with the following signature:Thesparsity_pattern gradient_sparsity() const;
gradient_sparsity()
method is part of the interface for the definition of a problem (see pagmo::problem).Public Static Attributes
-
static constexpr bool value = implementation_defined#
Value of the type trait.
-
static constexpr bool value = implementation_defined#
-
template<typename T>
class override_has_gradient_sparsity# Detect
has_gradient_sparsity()
method.This type trait will be
true
ifT
provides a method with the following signature:Thebool has_gradient_sparsity() const;
has_gradient_sparsity()
method is part of the interface for the definition of a problem (see pagmo::problem).Public Static Attributes
-
static constexpr bool value = implementation_defined#
Value of the type trait.
-
static constexpr bool value = implementation_defined#
-
template<typename T>
class has_hessians# Detect
hessians()
method.This type trait will be
true
ifT
provides a method with the following signature:Thestd::vector<vector_double> hessians(const vector_double &) const;
hessians()
method is part of the interface for the definition of a problem (see pagmo::problem).Public Static Attributes
-
static constexpr bool value = implementation_defined#
Value of the type trait.
-
static constexpr bool value = implementation_defined#
-
template<typename T>
class override_has_hessians# Detect
has_hessians()
method.This type trait will be
true
ifT
provides a method with the following signature:Thebool has_hessians() const;
has_hessians()
method is part of the interface for the definition of a problem (see pagmo::problem).Public Static Attributes
-
static constexpr bool value = implementation_defined#
Value of the type trait.
-
static constexpr bool value = implementation_defined#
-
template<typename T>
class has_hessians_sparsity# Detect
hessians_sparsity()
method.This type trait will be
true
ifT
provides a method with the following signature:Thestd::vector<sparsity_pattern> hessians_sparsity() const;
hessians_sparsity()
method is part of the interface for the definition of a problem (see pagmo::problem).Public Static Attributes
-
static constexpr bool value = implementation_defined#
Value of the type trait.
-
static constexpr bool value = implementation_defined#
-
template<typename T>
class override_has_hessians_sparsity# Detect
has_hessians_sparsity()
method.This type trait will be
true
ifT
provides a method with the following signature:Thebool has_hessians_sparsity() const;
has_hessians_sparsity()
method is part of the interface for the definition of a problem (see pagmo::problem).Public Static Attributes
-
static constexpr bool value = implementation_defined#
Value of the type trait.
-
static constexpr bool value = implementation_defined#
-
template<typename T>
class has_set_verbosity# Detect
set_verbosity()
method.This type trait will be
true
ifT
provides a method with the following signature:Thevoid set_verbosity(unsigned);
set_verbosity()
method is part of the interface for the definition of an algorithm (see pagmo::algorithm).Public Static Attributes
-
static const bool value = implementation_defined#
Value of the type trait.
-
static const bool value = implementation_defined#
-
template<typename T>
class override_has_set_verbosity# Detect
has_set_verbosity()
method.This type trait will be
true
ifT
provides a method with the following signature:Thebool has_set_verbosity() const;
has_set_verbosity()
method is part of the interface for the definition of an algorithm (see pagmo::algorithm).Public Static Attributes
-
static const bool value = implementation_defined#
Value of the type trait.
-
static const bool value = implementation_defined#
-
template<typename T>
class has_evolve# Detect
evolve()
method.This type trait will be
true
ifT
provides a method with the following signature:Thepopulation evolve(const population &) const;
evolve()
method is part of the interface for the definition of an algorithm (see pagmo::algorithm).Public Static Attributes
-
static const bool value = implementation_defined#
Value of the type trait.
-
static const bool value = implementation_defined#
-
template<typename T>
class has_get_nobj# Detect
get_nobj()
method.This type trait will be
true
ifT
provides a method with the following signature:Thevector_double::size_type get_nobj() const;
get_nobj()
method is part of the interface for the definition of a problem (see pagmo::problem).Public Static Attributes
-
static constexpr bool value = implementation_defined#
Value of the type trait.
-
static constexpr bool value = implementation_defined#
-
template<typename T>
class has_set_seed# Detect
set_seed()
method.This type trait will be
true
ifT
provides a method with the following signature:Thevoid set_seed(unsigned);
set_seed()
method is part of the interface for the definition of problems and algorithms (see pagmo::problem and pagmo::algorithm).Public Static Attributes
-
static const bool value = implementation_defined#
Value of the type trait.
-
static const bool value = implementation_defined#
-
template<typename T>
class override_has_set_seed# Detect
has_set_seed()
method.This type trait will be
true
ifT
provides a method with the following signature:Thebool has_set_seed() const;
has_set_seed()
method is part of the interface for the definition of problems and algorithms (see pagmo::problem and pagmo::algorithm).Public Static Attributes
-
static const bool value = implementation_defined#
Value of the type trait.
-
static const bool value = implementation_defined#
-
template<typename T>
class has_run_evolve# Detect
run_evolve()
method.This type trait will be
true
ifT
provides a method with the following signature:Thevoid run_evolve(island &) const;
run_evolve()
method is part of the interface for the definition of an island (see pagmo::island).Public Static Attributes
-
static const bool value = implementation_defined#
Value of the type trait.
-
static const bool value = implementation_defined#
-
template<typename T>
class is_udi# Detect user-defined islands (UDI).
This type trait will be
true
ifT
is not cv/reference qualified, it is destructible, default, copy and move constructible, and if it satisfies the pagmo::has_run_evolve type trait.Types satisfying this type trait can be used as user-defined islands (UDI) in pagmo::island.
Public Static Attributes
-
static const bool value = implementation_defined#
Value of the type trait.
-
static const bool value = implementation_defined#