-
Notifications
You must be signed in to change notification settings - Fork 162
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #296 from bluescarni/pr/topo
(WIP) Migration
- Loading branch information
Showing
113 changed files
with
15,402 additions
and
349 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,14 @@ | ||
Archipelago | ||
=========== | ||
|
||
*#include <pagmo/archipelago.hpp>* | ||
|
||
.. doxygenclass:: pagmo::archipelago | ||
:members: | ||
|
||
Types | ||
----- | ||
|
||
.. doxygenenum:: pagmo::migration_type | ||
|
||
.. doxygenenum:: pagmo::migrant_handling |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,35 @@ | ||
Island | ||
====== | ||
|
||
*#include <pagmo/island.hpp>* | ||
|
||
.. doxygenclass:: pagmo::island | ||
:members: | ||
|
||
Functions | ||
--------- | ||
|
||
.. cpp:namespace-push:: pagmo | ||
|
||
.. cpp:function:: std::ostream &operator<<(std::ostream &os, const island &isl) | ||
|
||
Stream operator for :cpp:class:`pagmo::island`. | ||
|
||
This operator will stream to *os* a human-readable representation of *isl*. | ||
|
||
It is safe to call this method while the island is evolving. | ||
|
||
:param os: the target stream. | ||
:param isl: the input island. | ||
|
||
:return: a reference to *os*. | ||
|
||
:exception unspecified: any exception trown by the stream operators of fundamental types or by | ||
the public interface of :cpp:class:`pagmo::island` and of all its members. | ||
|
||
.. cpp:namespace-pop:: | ||
|
||
Types | ||
----- | ||
|
||
.. doxygenenum:: pagmo::evolve_status |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,128 @@ | ||
Fair replacement policy | ||
======================= | ||
|
||
.. versionadded:: 2.11 | ||
|
||
*#include <pagmo/r_policies/fair_replace.hpp>* | ||
|
||
.. cpp:namespace-push:: pagmo | ||
|
||
.. cpp:class:: fair_replace | ||
|
||
This user-defined replacement policy (UDRP) will replace individuals in | ||
a group only if the candidate replacement individuals are *better* than | ||
the original individuals. | ||
|
||
In this context, *better* means the following: | ||
|
||
* in single-objective unconstrained problems, an individual is better | ||
than another one if its fitness is lower, | ||
* in single-objective constrained problems, individuals are ranked | ||
via :cpp:func:`~pagmo::sort_population_con()`, | ||
* in multi-objective unconstrained problems, individuals are ranked | ||
via :cpp:func:`~pagmo::sort_population_mo()`. | ||
|
||
See the documentation of :cpp:func:`~pagmo::fair_replace::replace()` for | ||
more details on the replacement algorithm implemented by this UDRP. | ||
|
||
Note that this user-defined replacement policy currently does *not* support | ||
multi-objective constrained problems. | ||
|
||
.. cpp:function:: fair_replace() | ||
|
||
Default constructor. | ||
|
||
The default constructor initialises a policy with an absolute migration rate of 1 | ||
(that is, 1 individual in the original population is considered for replacement). | ||
|
||
.. cpp:function:: template <typename T> explicit fair_replace(T x) | ||
|
||
Constructor from a migration rate. | ||
|
||
This constructor participates in overload resolution only if ``T`` is a C++ | ||
integral or a floating-point type. The input migration rate, *x*, is used to indicate | ||
how many individuals will be replaced in an input population by the | ||
:cpp:func:`~pagmo::fair_replace::replace()` member function. | ||
|
||
If *x* is a floating point value in the :math:`\left[0,1\right]` range, | ||
then it represents a *fractional* migration rate. That is, it indicates, | ||
the fraction of individuals that may be replaced in the input population: | ||
a value of 0 means that no individuals will be replaced, a value of 1 means that | ||
all individuals may be replaced. | ||
|
||
If *x* is an integral value, then it represents an *absolute* migration rate, that is, | ||
the exact number of individuals that may be replaced in the input population. | ||
|
||
:param x: the fractional or absolute migration rate. | ||
|
||
:exception std\:\:invalid_argument: if the supplied fractional migration rate is not finite | ||
or not in the :math:`\left[0,1\right]` range. | ||
:exception unspecified: any exception raised by ``boost::numeric_cast()`` while trying | ||
to convert the input absolute migration rate to :cpp:type:`~pagmo::pop_size_t`. | ||
|
||
.. cpp:function:: individuals_group_t replace(const individuals_group_t &inds, const vector_double::size_type &, \ | ||
const vector_double::size_type &, const vector_double::size_type &nobj, \ | ||
const vector_double::size_type &nec, const vector_double::size_type &nic, \ | ||
const vector_double &tol, const individuals_group_t &mig) const | ||
|
||
This member function will replace individuals in *inds* with individuals from *mig*. | ||
|
||
The replacement algorithm determines first how many individuals in *inds* can be replaced. This depends both on | ||
the migration rate specified upon construction, and on the size :math:`S` of *inds*. | ||
|
||
After having established the number :math:`N` of individuals that can be replaced in *inds*, | ||
the algorithm then selects the top :math:`N` individuals from *mig*, merges them | ||
with *inds* into a new population, and returns the top :math:`S` individuals | ||
from the new population. The ranking of individuals in *mig* and in the new population | ||
depends on the problem's properties: | ||
|
||
* in single-objective unconstrained problems, the individuals are ranked according to their | ||
(scalar) fitnesses, | ||
* in single-objective constrained problems, the ranking of individuals | ||
is done via :cpp:func:`~pagmo::sort_population_con()`, | ||
* in multi-objective unconstrained problems, the ranking of individuals | ||
is done via :cpp:func:`~pagmo::sort_population_mo()`. | ||
|
||
Note that this user-defined replacement policy currently does *not* support | ||
multi-objective constrained problems. | ||
|
||
:param inds: the input individuals. | ||
:param nobj: the number of objectives of the problem the individuals in *inds* and *mig* refer to. | ||
:param nec: the number of equality constraints of the problem the individuals in *inds* and *mig* refer to. | ||
:param nic: the number of inequality constraints of the problem the individuals in *inds* and *mig* refer to. | ||
:param tol: the vector of constraint tolerances of the problem the individuals in *inds* and *mig* refer to. | ||
:param mig: the individuals that may replace individuals in *inds*. | ||
|
||
:return: the new population resulting from replacing individuals in *inds* with individuals from *mig*. | ||
|
||
:exception std\:\:invalid_argument: in the following cases: | ||
|
||
* the problem the individuals in *inds* and *mig* refer to is | ||
multi-objective and constrained, | ||
* an absolute migration rate larger than the number of input individuals | ||
was specified. | ||
|
||
:exception unspecified: any exception raised by one of the invoked ranking functions or by memory | ||
allocation errors in standard containers. | ||
|
||
.. cpp:function:: std::string get_name() const | ||
|
||
Get the name of the policy. | ||
|
||
:return: ``"Fair replace"``. | ||
|
||
.. cpp:function:: std::string get_extra_info() const | ||
|
||
:return: Human-readable extra info about this replacement policy. | ||
|
||
.. cpp:function:: template <typename Archive> void serialize(Archive &ar, unsigned) | ||
|
||
Serialisation support. | ||
|
||
This member function is used to implement the (de)serialisation of this replacement policy to/from an archive. | ||
|
||
:param ar: the input/output archive. | ||
|
||
:exception unspecified: any exception raised by the (de)serialisation of primitive types. | ||
|
||
.. cpp:namespace-pop:: |
Oops, something went wrong.