Problem#

#include <pagmo/problem.hpp>

class problem#

Problem class.

../../_images/prob_no_text.png

This class represents a generic mathematical programming or evolutionary optimization problem in the form:

\[\begin{split} \begin{array}{rl} \mbox{find:} & \mathbf {lb} \le \mathbf x \le \mathbf{ub}\\ \mbox{to minimize: } & \mathbf f(\mathbf x, s) \in \mathbb R^{n_{obj}}\\ \mbox{subject to:} & \mathbf {c}_e(\mathbf x, s) = 0 \\ & \mathbf {c}_i(\mathbf x, s) \le 0 \end{array} \end{split}\]

where \(\mathbf x \in \mathbb R^{n_{cx}} \times \mathbb Z^{n_{ix}}\) is called decision vector or chromosome, and is made of \(n_{cx}\) real numbers and \(n_{ix}\) integers (all represented as doubles). The total problem dimension is then indicated with \(n_x = n_{cx} + n_{ix}\). \(\mathbf{lb}, \mathbf{ub} \in \mathbb R^{n_{cx}} \times \mathbb Z^{n_{ix}}\) are the box-bounds, \( \mathbf f: \mathbb R^{n_{cx}} \times \mathbb Z^{n_{ix}} \rightarrow \mathbb R^{n_{obj}}\) define the objectives, \( \mathbf c_e: \mathbb R^{n_{cx}} \times \mathbb Z^{n_{ix}} \rightarrow \mathbb R^{n_{ec}}\) are non linear equality constraints, and \( \mathbf c_i: \mathbb R^{n_{cx}} \times \mathbb Z^{n_{ix}} \rightarrow \mathbb R^{n_{ic}}\) are non linear inequality constraints. Note that the objectives and constraints may also depend from an added value \(s\) seeding the values of any number of stochastic variables. This allows also for stochastic programming tasks to be represented by this class. A tolerance is also considered for all constraints and set, by default, to zero. It can be modified via the problem::set_c_tol() method.

In order to define an optimization problem in pagmo, the user must first define a class (or a struct) whose methods describe the properties of the problem and allow to compute the objective function, the gradient, the constraints, etc. In pagmo, we refer to such a class as a user-defined problem, or UDP for short. Once defined and instantiated, a UDP can then be used to construct an instance of this class, pagmo::problem, which provides a generic interface to optimization problems.

Every UDP must implement at least the following two methods:

vector_double fitness(const vector_double &) const;
std::pair<vector_double, vector_double> get_bounds() const;

The fitness() method is expected to return the fitness of the input decision vector ( concatenating the objectives, the equality and the inequality constraints), while get_bounds() is expected to return the box bounds of the problem, \((\mathbf{lb}, \mathbf{ub})\), which also implicitly define the dimension of the problem. The fitness() and get_bounds() methods of the UDP are accessible from the corresponding problem::fitness() and problem::get_bounds() methods (see their documentation for details). In addition to providing the above methods, a UDP must also be default, copy and move constructible.

The two mandatory methods above allow to define a continuous, single objective, deterministic, derivative-free, unconstrained optimization problem. In order to consider more complex cases, the UDP may implement one or more of the following methods:

vector_double::size_type get_nobj() const;
vector_double::size_type get_nec() const;
vector_double::size_type get_nic() const;
vector_double::size_type get_nix() const;
vector_double batch_fitness(const vector_double &) const;
bool has_batch_fitness() const;
bool has_gradient() const;
vector_double gradient(const vector_double &) const;
bool has_gradient_sparsity() const;
sparsity_pattern gradient_sparsity() const;
bool has_hessians() const;
std::vector<vector_double> hessians(const vector_double &) const;
bool has_hessians_sparsity() const;
std::vector<sparsity_pattern> hessians_sparsity() const;
bool has_set_seed() const;
void set_seed(unsigned);
std::string get_name() const;
std::string get_extra_info() const;
thread_safety get_thread_safety() const;

See the documentation of the corresponding methods in this class for details on how the optional methods in the UDP are used by pagmo::problem.

Warning

The only operations allowed on a moved-from pagmo::problem are destruction, assignment, and the invocation of the is_valid() member function. Any other operation will result in undefined behaviour.

Public Functions

problem()#

Default constructor.

The default constructor will initialize a pagmo::problem containing a pagmo::null_problem.

Throws

unspecified – any exception thrown by the constructor from UDP.

template<typename T, generic_ctor_enabler<T> = 0>
inline explicit problem(T &&x)#

Constructor from a user-defined problem of type T.

This constructor will construct a pagmo::problem from the UDP (user-defined problem) x of type T. In order for the construction to be successful, the UDP must implement a minimal set of methods, as described in the documentation of pagmo::problem. The constructor will examine the properties of x and store them as data members of this.

Note

This constructor is not enabled if, after the removal of cv and reference qualifiers, T is of type pagmo::problem (that is, this constructor does not compete with the copy/move constructors of pagmo::problem), or if T does not satisfy pagmo::is_udp.

Parameters

x – the UDP.

Throws
  • std::invalid_argument – in the following cases:

    • the number of objectives of the UDP is zero,

    • the number of objectives, equality or inequality constraints is larger than an implementation-defined value,

    • the problem bounds are invalid (e.g., they contain NaNs, the dimensionality of the lower bounds is different from the dimensionality of the upper bounds, the bounds relative to the integer part are not integers, etc. - note that infinite bounds are allowed),

    • the gradient_sparsity() and hessians_sparsity() methods of the UDP fail basic sanity checks (e.g., they return vectors with repeated indices, they contain indices exceeding the problem’s dimensions, etc.).

    • the integer part of the problem is larger than the problem size.

  • unspecified – any exception thrown by methods of the UDP invoked during construction or by memory errors in strings and standard containers.

problem(const problem&)#

Copy constructor.

The copy constructor will deep copy the input problem other.

Parameters

other – the problem to be copied.

Throws

unspecified – any exception thrown by:

  • memory allocation errors in standard containers,

  • the copying of the internal UDP.

problem(problem&&) noexcept#

Move constructor.

Parameters

other – the problem from which this will be move-constructed.

problem &operator=(problem&&) noexcept#

Move assignment operator.

Parameters

other – the assignment target.

Returns

a reference to this.

problem &operator=(const problem&)#

Copy assignment operator.

Copy assignment is implemented as a copy constructor followed by a move assignment.

Parameters

other – the assignment target.

Throws

unspecified – any exception thrown by the copy constructor.

Returns

a reference to this.

template<typename T, generic_ctor_enabler<T> = 0>
inline problem &operator=(T &&x)#

Assignment from a user-defined problem of type T.

This operator will set the internal UDP to x by constructing a pagmo::problem from x, and then move-assigning the result to this.

Note

This operator is not enabled if, after the removal of cv and reference qualifiers, T is of type pagmo::problem (that is, this operator does not compete with the copy/move assignment operators of pagmo::problem), or if T does not satisfy pagmo::is_udp.

Parameters

x – the UDP.

Throws

unspecified – any exception thrown by the constructor from UDP.

Returns

a reference to this.

template<typename T>
inline const T *extract() const noexcept#

Extract a const pointer to the UDP used for construction.

This method will extract a const pointer to the internal instance of the UDP. If T is not the same type as the UDP used during construction (after removal of cv and reference qualifiers), this method will return nullptr.

Note

The returned value is a raw non-owning pointer: the lifetime of the pointee is tied to the lifetime of this, and delete must never be called on the pointer.

Returns

a const pointer to the internal UDP, or nullptr if T does not correspond exactly to the original UDP type used in the constructor.

template<typename T>
inline T *extract() noexcept#

Extract a pointer to the UDP used for construction.

This method will extract a pointer to the internal instance of the UDP. If T is not the same type as the UDP used during construction (after removal of cv and reference qualifiers), this method will return nullptr.

Note

The returned value is a raw non-owning pointer: the lifetime of the pointee is tied to the lifetime of this, and delete must never be called on the pointer.

Note

The ability to extract a mutable pointer is provided only in order to allow to call non-const methods on the internal UDP instance. Assigning a new UDP via this pointer is undefined behaviour.

Returns

a pointer to the internal UDP, or nullptr if T does not correspond exactly to the original UDP type used in the constructor.

template<typename T>
inline bool is() const noexcept#

Check if the UDP used for construction is of type T.

Returns

true if the UDP used for construction is of type T, false otherwise.

vector_double fitness(const vector_double&) const#

Fitness.

This method will invoke the fitness() method of the UDP to compute the fitness of the input decision vector dv. The return value of the fitness() method of the UDP is expected to have a dimension of \(n_{f} = n_{obj} + n_{ec} + n_{ic}\) and to contain the concatenated values of \(\mathbf f, \mathbf c_e\) and \(\mathbf c_i\) (in this order). Equality constraints are all assumed in the form \(c_{e_i}(\mathbf x) = 0\) while inequalities are assumed in the form \(c_{i_i}(\mathbf x) <= 0\) so that negative values are associated to satisfied inequalities.

In addition to invoking the fitness() method of the UDP, this method will perform sanity checks on dv and on the returned fitness vector. A successful call of this method will increase the internal fitness evaluation counter (see problem::get_fevals()).

Parameters

dv – the decision vector.

Throws
  • std::invalid_argument – if either

    • the length of dv differs from the value returned by get_nx(), or

    • the length of the returned fitness vector differs from the value returned by get_nf().

  • unspecified – any exception thrown by the fitness() method of the UDP.

Returns

the fitness of dv.

vector_double batch_fitness(const vector_double&) const#

Batch fitness.

This method implements the evaluation of multiple decision vectors in batch mode by invoking the batch_fitness() method of the UDP. The batch_fitness() method of the UDP accepts in input a batch of decision vectors, dvs, stored contiguously: for a problem with dimension \( n \), the first decision vector in dvs occupies the index range \( \left[0, n\right) \), the second decision vector occupies the range \( \left[n, 2n\right) \), and so on. The return value is the batch of fitness vectors fvs resulting from computing the fitness of the input decision vectors. fvs is also stored contiguously: for a problem with fitness dimension \( f \), the first fitness vector will occupy the index range \( \left[0, f\right) \), the second fitness vector will occupy the range \( \left[f, 2f\right) \), and so on.

If the UDP satisfies pagmo::has_batch_fitness, this method will forward dvs to the batch_fitness() method of the UDP after sanity checks. The output of the batch_fitness() method of the UDP will also be checked before being returned. If the UDP does not satisfy pagmo::has_batch_fitness, an error will be raised.

A successful call of this method will increase the internal fitness evaluation counter (see problem::get_fevals()).

Parameters

dvs – the input batch of decision vectors.

Throws
  • std::invalid_argument – if either dvs or the return value are incompatible with the properties of this problem.

  • not_implemented_error – if the UDP does not have a batch_fitness() method.

  • unspecified – any exception thrown by the batch_fitness() method of the UDP.

Returns

the fitnesses of the decision vectors in dvs.

inline bool has_batch_fitness() const#

Check if the UDP is capable of fitness evaluation in batch mode.

This method will return true if the UDP is capable of fitness evaluation in batch mode, false otherwise.

The batch fitness evaluation capability of the UDP is determined as follows:

Returns

a flag signalling the availability of fitness evaluation in batch mode in the UDP.

vector_double gradient(const vector_double&) const#

Gradient.

This method will compute the gradient of the input decision vector dv by invoking the gradient() method of the UDP. The gradient() method of the UDP must return a sparse representation of the gradient: the \( k\)-th term of the gradient vector is expected to contain \( \frac{\partial f_i}{\partial x_j}\), where the pair \((i,j)\) is the \(k\)-th element of the sparsity pattern (collection of index pairs), as returned by problem::gradient_sparsity().

If the UDP satisfies pagmo::has_gradient, this method will forward dv to the gradient() method of the UDP after sanity checks. The output of the gradient() method of the UDP will also be checked before being returned. If the UDP does not satisfy pagmo::has_gradient, an error will be raised.

A successful call of this method will increase the internal gradient evaluation counter (see problem::get_gevals()).

Parameters

dv – the decision vector whose gradient will be computed.

Throws
Returns

the gradient of dv.

inline bool has_gradient() const#

Check if the gradient is available in the UDP.

This method will return true if the gradient is available in the UDP, false otherwise.

The availability of the gradient is determined as follows:

Returns

a flag signalling the availability of the gradient in the UDP.

sparsity_pattern gradient_sparsity() const#

Gradient sparsity pattern.

This method will return the gradient sparsity pattern of the problem. The gradient sparsity pattern is a lexicographically sorted collection of the indices \((i,j)\) of the non-zero elements of \( g_{ij} = \frac{\partial f_i}{\partial x_j}\).

If problem::has_gradient_sparsity() returns true, then the gradient_sparsity() method of the UDP will be invoked, and its result returned (after sanity checks). Otherwise, a a dense pattern is assumed and the returned vector will be \(((0,0),(0,1), ... (0,n_x-1), ...(n_f-1,n_x-1))\).

Throws
  • std::invalid_argument – if the sparsity pattern returned by the UDP is invalid (specifically, if it is not strictly sorted lexicographically, or if the indices in the pattern are incompatible with the properties of the problem, or if the size of the returned pattern is different from the size recorded upon construction).

  • unspecified – memory errors in standard containers.

Returns

the gradient sparsity pattern.

inline bool has_gradient_sparsity() const#

Check if the gradient sparsity is available in the UDP.

This method will return true if the gradient sparsity is available in the UDP, false otherwise.

The availability of the gradient sparsity is determined as follows:

Note

Regardless of what this method returns, the problem::gradient_sparsity() method will always return a sparsity pattern: if the UDP does not provide the gradient sparsity, PaGMO will assume that the sparsity pattern of the gradient is dense. See problem::gradient_sparsity() for more details.

Returns

a flag signalling the availability of the gradient sparsity in the UDP.

std::vector<vector_double> hessians(const vector_double&) const#

Hessians.

This method will compute the hessians of the input decision vector dv by invoking the hessians() method of the UDP. The hessians() method of the UDP must return a sparse representation of the hessians: the element \( l\) of the returned vector contains \( h^l_{ij} = \frac{\partial f^2_l}{\partial x_i\partial x_j}\) in the order specified by the \( l\)-th element of the hessians sparsity pattern (a vector of index pairs \((i,j)\)) as returned by problem::hessians_sparsity(). Since the hessians are symmetric, their sparse representation contains only lower triangular elements.

If the UDP satisfies pagmo::has_hessians, this method will forward dv to the hessians() method of the UDP after sanity checks. The output of the hessians() method of the UDP will also be checked before being returned. If the UDP does not satisfy pagmo::has_hessians, an error will be raised.

A successful call of this method will increase the internal hessians evaluation counter (see problem::get_hevals()).

Parameters

dv – the decision vector whose hessians will be computed.

Throws
  • std::invalid_argument – if either:

    • the length of dv differs from the output of get_nx(), or

    • the length of the returned hessians does not match the corresponding hessians sparsity pattern dimensions, or

    • the size of the return value is not equal to the fitness dimension.

  • not_implemented_error – if the UDP does not satisfy pagmo::has_hessians.

  • unspecified – any exception thrown by the hessians() method of the UDP.

Returns

the hessians of dv.

inline bool has_hessians() const#

Check if the hessians are available in the UDP.

This method will return true if the hessians are available in the UDP, false otherwise.

The availability of the hessians is determined as follows:

Returns

a flag signalling the availability of the hessians in the UDP.

std::vector<sparsity_pattern> hessians_sparsity() const#

Hessians sparsity pattern.

This method will return the hessians sparsity pattern of the problem. Each component \( l\) of the hessians sparsity pattern is a lexicographically sorted collection of the indices \((i,j)\) of the non-zero elements of \(h^l_{ij} = \frac{\partial f^l}{\partial x_i\partial x_j}\). Since the Hessian matrix is symmetric, only lower triangular elements are allowed.

If problem::has_hessians_sparsity() returns true, then the hessians_sparsity() method of the UDP will be invoked, and its result returned (after sanity checks). Otherwise, a dense pattern is assumed and \(n_f\) sparsity patterns containing \(((0,0),(1,0), (1,1), (2,0) ... (n_x-1,n_x-1))\) will be returned.

Throws

std::invalid_argument – if a sparsity pattern returned by the UDP is invalid (specifically, if if it is not strictly sorted lexicographically, if the returned indices do not correspond to a lower triangular representation of a symmetric matrix, or if the size of the pattern differs from the size recorded upon construction).

Returns

the hessians sparsity pattern.

inline bool has_hessians_sparsity() const#

Check if the hessians sparsity is available in the UDP.

This method will return true if the hessians sparsity is available in the UDP, false otherwise.

The availability of the hessians sparsity is determined as follows:

Note

Regardless of what this method returns, the problem::hessians_sparsity() method will always return a vector of sparsity patterns: if the UDP does not provide the hessians sparsity, PaGMO will assume that the sparsity pattern of the hessians is dense. See problem::hessians_sparsity() for more details.

Returns

a flag signalling the availability of the hessians sparsity in the UDP.

inline vector_double::size_type get_nobj() const#

Number of objectives.

This method will return \( n_{obj}\), the number of objectives of the optimization problem. If the UDP satisfies the pagmo::has_get_nobj type traits, then the output of its get_nobj() method will be returned. Otherwise, this method will return 1.

Returns

the number of objectives of the problem.

inline vector_double::size_type get_nx() const#

Dimension.

Returns

\( n_{x}\), the dimension of the problem as established by the length of the bounds returned by problem::get_bounds().

inline vector_double::size_type get_nix() const#

Integer Dimension.

This method will return \( n_{ix} \), the dimension of the integer part of the problem. If the UDP satisfies pagmo::has_integer_part, then the output of its get_nix() method will be returned. Otherwise, this method will return 0. Note that integer variables must be appended after continuous variables in the decision vector \( x \).

Returns

\( n_{ix}\), the integer dimension of the problem.

inline vector_double::size_type get_ncx() const#

Continuous Dimension.

Returns

\( n_{cx}\), the continuous dimension of the problem as established by the relation \(n_{cx} = n_{x} - n_{ix} \).

Returns

\( n_{cx}\), the continuous dimension of the problem.

inline vector_double::size_type get_nf() const#

Fitness dimension.

Returns

\( n_{f}\), the dimension of the fitness, which is the sum of \(n_{obj}\), \(n_{ec}\) and \(n_{ic}\)

std::pair<vector_double, vector_double> get_bounds() const#

Box-bounds.

Throws

unspecified – any exception thrown by memory errors in standard containers.

Returns

\( (\mathbf{lb}, \mathbf{ub}) \), the box-bounds, as returned by the get_bounds() method of the UDP. Infinities in the bounds are allowed.

inline const vector_double &get_lb() const#

Lower bounds.

Returns

a const reference to the vector of lower box bounds for this problem.

inline const vector_double &get_ub() const#

Upper bounds.

Returns

a const reference to the vector of upper box bounds for this problem.

inline vector_double::size_type get_nec() const#

Number of equality constraints.

This method will return \( n_{ec} \), the number of equality constraints of the problem. If the UDP satisfies pagmo::has_e_constraints, then the output of its get_nec() method will be returned. Otherwise, this method will return 0.

Returns

the number of equality constraints of the problem.

inline vector_double::size_type get_nic() const#

Number of inequality constraints.

This method will return \( n_{ic} \), the number of inequality constraints of the problem. If the UDP satisfies pagmo::has_i_constraints, then the output of its get_nic() method will be returned. Otherwise, this method will return 0.

Returns

the number of inequality constraints of the problem.

void set_c_tol(const vector_double&)#

Set the constraint tolerance (from a vector of doubles).

Parameters

c_tol – a vector containing the tolerances to use when checking for constraint feasibility.

Throws

std::invalid_argument – if the size of c_tol differs from the number of constraints, or if any of its elements is negative or NaN.

void set_c_tol(double)#

Set the constraint tolerance (from a single double value).

Parameters

c_tol – the tolerance to use when checking for all constraint feasibilities.

Throws

std::invalid_argument – if c_tol is negative or NaN.

inline vector_double get_c_tol() const#

Get the constraint tolerance.

This method will return a vector of dimension \(n_{ec} + n_{ic}\) containing tolerances to be used when checking constraint feasibility. The constraint tolerance is zero-filled upon problem construction, and it can be set via problem::set_c_tol().

Returns

a pagmo::vector_double containing the tolerances to use when checking for constraint feasibility.

inline vector_double::size_type get_nc() const#

Total number of constraints.

Returns

the sum of the output of get_nic() and get_nec() (i.e., the total number of constraints).

inline unsigned long long get_fevals() const#

Number of fitness evaluations.

Each time a call to problem::fitness() successfully completes, an internal counter is increased by one. The counter is initialised to zero upon problem construction and it is never reset. Copy and move operations copy the counter as well.

Returns

the number of times problem::fitness() was successfully called.

inline void increment_fevals(unsigned long long n) const#

Increment the number of fitness evaluations.

This method will increase the internal counter of fitness evaluations by n.

Parameters

n – the amount by which the internal counter of fitness evaluations will be increased.

inline unsigned long long get_gevals() const#

Number of gradient evaluations.

Each time a call to problem::gradient() successfully completes, an internal counter is increased by one. The counter is initialised to zero upon problem construction and it is never reset. Copy and move operations copy the counter as well.

Returns

the number of times problem::gradient() was successfully called.

inline unsigned long long get_hevals() const#

Number of hessians evaluations.

Each time a call to problem::hessians() successfully completes, an internal counter is increased by one. The counter is initialised to zero upon problem construction and it is never reset. Copy and move operations copy the counter as well.

Returns

the number of times problem::hessians() was successfully called.

void set_seed(unsigned)#

Set the seed for the stochastic variables.

Sets the seed to be used in the fitness function to instantiate all stochastic variables. If the UDP satisfies pagmo::has_set_seed, then its set_seed() method will be invoked. Otherwise, an error will be raised.

Parameters

seed – seed.

Throws
bool feasibility_x(const vector_double&) const#

Feasibility of a decision vector.

This method will check the feasibility of the fitness corresponding to a decision vector x against the tolerances returned by problem::get_c_tol().

Note

One call of this method will cause one call to the fitness function.

Parameters

x – a decision vector.

Throws

unspecified – any exception thrown by problem::feasibility_f() or problem::fitness().

Returns

true if the decision vector results in a feasible fitness, false otherwise.

bool feasibility_f(const vector_double&) const#

Feasibility of a fitness vector.

This method will check the feasibility of a fitness vector f against the tolerances returned by problem::get_c_tol().

Parameters

f – a fitness vector.

Throws

std::invalid_argument – if the size of f is not the same as the output of problem::get_nf().

Returns

true if the fitness vector is feasible, false otherwise.

inline bool has_set_seed() const#

Check if a set_seed() method is available in the UDP.

This method will return true if a set_seed() method is available in the UDP, false otherwise.

The availability of the a set_seed() method is determined as follows:

Returns

a flag signalling the availability of the set_seed() method in the UDP.

inline bool is_stochastic() const#

Alias for problem::has_set_seed().

Returns

the output of problem::has_set_seed().

inline std::string get_name() const#

Problem’s name.

If the UDP satisfies pagmo::has_name, then this method will return the output of its get_name() method. Otherwise, an implementation-defined name based on the type of the UDP will be returned.

Throws

unspecified – any exception thrown by copying an std::string object.

Returns

the problem’s name.

std::string get_extra_info() const#

Problem’s extra info.

If the UDP satisfies pagmo::has_extra_info, then this method will return the output of its get_extra_info() method. Otherwise, an empty string will be returned.

Throws

unspecified – any exception thrown by the get_extra_info() method of the UDP.

Returns

extra info about the UDP.

inline thread_safety get_thread_safety() const#

Problem’s thread safety level.

If the UDP satisfies pagmo::has_get_thread_safety, then this method will return the output of its get_thread_safety() method. Otherwise, thread_safety::basic will be returned. That is, pagmo assumes by default that is it safe to operate concurrently on distinct UDP instances.

Returns

the thread safety level of the UDP.

bool is_valid() const#

Check if the problem is in a valid state.

Returns

false if this was moved from, true otherwise.

std::type_index get_type_index() const#

Get the type of the UDP.

New in version 2.15.

This function will return the type of the UDP stored within this problem instance.

Returns

the type of the UDP.

const void *get_ptr() const#

Get a const pointer to the UDP.

New in version 2.15.

This function will return a raw const pointer to the internal UDP instance. Differently from extract(), this function does not require to pass the correct type in input. It is however the user’s responsibility to cast the returned void pointer to the correct type.

Note

The returned value is a raw non-owning pointer: the lifetime of the pointee is tied to the lifetime of this, and delete must never be called on the pointer.

Returns

a pointer to the internal UDP.

void *get_ptr()#

Get a mutable pointer to the UDP.

New in version 2.15.

This function will return a raw pointer to the internal UDP instance. Differently from extract(), this function does not require to pass the correct type in input. It is however the user’s responsibility to cast the returned void pointer to the correct type.

Note

The returned value is a raw non-owning pointer: the lifetime of the pointee is tied to the lifetime of this, and delete must never be called on the pointer.

Note

The ability to extract a mutable pointer is provided only in order to allow to call non-const methods on the internal UDP instance. Assigning a new UDP via this pointer is undefined behaviour.

Returns

a pointer to the internal UDP.

Associated type traits#

template<typename T>
class has_batch_fitness#

This type trait detects if T provides a member function whose signature is compatible with

vector_double batch_fitness(const vector_double &) const;

The batch_fitness() member function is part of the interface for the definition of a user-defined problem (see the problem documentation for details).

static const bool value#

The value of the type trait.

template<typename T>
class override_has_batch_fitness#

This type trait detects if T provides a member function whose signature is compatible with

bool has_batch_fitness() const;

The has_batch_fitness() member function is part of the interface for the definition of a user-defined problem (see the problem documentation for details).

static const bool value#

The value of the type trait.