Skip to content

Commit

Permalink
docs: update copyright year, tweak emails
Browse files Browse the repository at this point in the history
  • Loading branch information
sanjayankur31 committed Nov 2, 2023
1 parent 904eb71 commit 78a8166
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 22 deletions.
4 changes: 2 additions & 2 deletions AUTHORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ Credits
Development Lead
----------------

* Aaron Garrett <garrett@inspiredintelligence.io>
* Aaron Garrett <garrett AT inspiredintelligence DOT io>

Contributors
------------

None yet. Why not be the first?
See: https://github.com/aarongarrett/inspyred/graphs/contributors
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@

# General information about the project.
project = 'inspyred'
copyright = "2017, Aaron Garrett"
copyright = "2023, Aaron Garrett"

# The version info for the project you're documenting, acts as replacement
# for |version| and |release|, also used in various other places throughout
Expand Down
38 changes: 19 additions & 19 deletions docs/tutorial.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Tutorial
********

This chapter presents three examples to which inspyred can be applied.
This chapter presents three examples to which inspyred can be applied.

======================
The Rastrigin Function
Expand All @@ -27,15 +27,15 @@ The Generator
.. literalinclude:: rastrigin.py
:start-after: #start_imports
:end-before: #end_imports

.. literalinclude:: rastrigin.py
:pyobject: generate_rastrigin

First, we import all the necessary libraries. ``random`` and ``time`` are needed for the random number generation; ``math`` is needed for the evaluation function; and ``inspyred`` is, of course, needed for the evolutionary computation.
First, we import all the necessary libraries. ``random`` and ``time`` are needed for the random number generation; ``math`` is needed for the evaluation function; and ``inspyred`` is, of course, needed for the evolutionary computation.

This function must take the random number generator object along with the keyword arguments. Notice that we can use the ``args`` variable to pass anything we like to our functions. There is nothing special about the ``num_inputs`` key. But, as we'll see, we can pass in that value as a keyword argument to the ``evolve`` method of our evolution strategy.
This function must take the random number generator object along with the keyword arguments. Notice that we can use the ``args`` variable to pass anything we like to our functions. There is nothing special about the ``num_inputs`` key. But, as we'll see, we can pass in that value as a keyword argument to the ``evolve`` method of our evolution strategy.

This code is pretty straightforward. We're simply generating a list of ``num_inputs`` uniform random values between -5.12 and 5.12. If ``num_inputs`` has not been specified, then we will default to generating 10 values.
This code is pretty straightforward. We're simply generating a list of ``num_inputs`` uniform random values between -5.12 and 5.12. If ``num_inputs`` has not been specified, then we will default to generating 10 values.

And now we can tackle the evaluator...

Expand All @@ -53,7 +53,7 @@ This function takes an iterable object containing the candidates along with the
The Evolutionary Computation
----------------------------

Now that we have decided upon our generator and evaluator, we can create the EC. In this case since our problem is real-coded, we'll choose a evolution strategy (ES) [#]_. The default for an ES is to select the entire population, use each to produce a child via Gaussian mutation, and then use "plus" replacement.
Now that we have decided upon our generator and evaluator, we can create the EC. In this case since our problem is real-coded, we'll choose a evolution strategy (ES) [#]_. The default for an ES is to select the entire population, use each to produce a child via Gaussian mutation, and then use "plus" replacement.

.. literalinclude:: rastrigin.py
:start-after: #start_main
Expand Down Expand Up @@ -94,7 +94,7 @@ The Generator
.. literalinclude:: polyarea.py
:start-after: #start_imports
:end-before: #end_imports

.. literalinclude:: polyarea.py
:pyobject: generate_polygon

Expand Down Expand Up @@ -125,7 +125,7 @@ The Bounder
.. literalinclude:: polyarea.py
:start-after: #start_bounder
:end-before: #end_bounder

Because our representation is a bit non-standard (a list of tuples), we need to create a bounding function that the EC can use to bound potential candidate solutions. Here, the bounding function is simple enough. It just make sure that each element of each tuple lies in the range [-1, 1]. The ``lower_bound`` and ``upper_bound`` attributes are added to the function so that the ``mutate_polygon`` function can make use of them without being hard-coded. While this is not strictly necessary, it does mimic the behavior of the ``Bounder`` callable class provided by inspyred.

------------
Expand All @@ -148,7 +148,7 @@ For this task, we'll create a custom evolutionary computation by selecting the o
:pyobject: mutate_polygon

Notice that this is essentially a Gaussian mutation on each coordinate of each tuple. Now we can create our custom EC.

.. literalinclude:: polyarea.py
:start-after: #start_main
:end-before: #end_main
Expand All @@ -170,7 +170,7 @@ The Generator
.. literalinclude:: moonshot.py
:start-after: #start_imports
:end-before: #end_imports

.. literalinclude:: moonshot.py
:pyobject: satellite_generator

Expand All @@ -184,27 +184,27 @@ The Evaluator
:pyobject: pairwise

This function breaks a one-dimensional list into a set of overlapping pairs. This is necessary because the trajectory of the satellite is a set of points, and the total distance traveled is calculated by summing the pairwise distances.

.. literalinclude:: moonshot.py
:pyobject: distance_between

This function calculates the Euclidean distance between points.

.. literalinclude:: moonshot.py
:pyobject: gravitational_force

This function calculates the gravitational force between the two given bodies.
This function calculates the gravitational force between the two given bodies.

.. literalinclude:: moonshot.py
:pyobject: force_on_satellite

This function calculates the force on the satellite from both the Earth and the Moon.

.. literalinclude:: moonshot.py
:pyobject: acceleration_of_satellite

This function calculates the acceleration of the satellite due to the forces acting upon it.

.. literalinclude:: moonshot.py
:pyobject: moonshot

Expand All @@ -218,7 +218,7 @@ The penalty/reward is 100000, and the fitness is designed to be minimized.
:pyobject: moonshot_evaluator

The evaluator simply calls the `moonshot` function.

----------------------------
The Evolutionary Computation
----------------------------
Expand All @@ -234,6 +234,6 @@ You can :download:`download the full example <moonshot.py>` to run it yourself.
:width: 600
:alt: Sample Results
:align: center
.. [#] This example was suggested and implemented by Mike Vella (vellamike@gmail.com).

.. [#] This example was suggested and implemented by Mike Vella (vellamike AT gmail DOT com).

0 comments on commit 78a8166

Please sign in to comment.