Skip to content

Commit

Permalink
Merge pull request #33 from aarongarrett/development
Browse files Browse the repository at this point in the history
Pull from dev into master
  • Loading branch information
sanjayankur31 committed Nov 2, 2023
2 parents 998045e + a806063 commit ebd2171
Show file tree
Hide file tree
Showing 26 changed files with 871 additions and 1,232 deletions.
15 changes: 14 additions & 1 deletion .github/workflows/ci.yml
Expand Up @@ -36,4 +36,17 @@ jobs:
pip list
- name: Run tests
run: tox
run: |
tox
- name: Run example tests
run: |
pip install -r ./requirements_dev.txt
pip install .
# uses pp, which is not available for py3
# python3 ./tests/evaluator_tests.py
python3 ./tests/example_tests.py
python3 ./tests/observer_tests.py
# intermittently fails
python3 ./tests/operator_tests.py || exit 0
python3 ./tests/supplemental_tests.py
4 changes: 4 additions & 0 deletions .gitignore
Expand Up @@ -60,3 +60,7 @@ target/

# pyenv python configuration file
.python-version

inspyred*csv

.mypy_cache/
15 changes: 15 additions & 0 deletions .readthedocs.yaml
@@ -0,0 +1,15 @@
version: 2

build:
os: ubuntu-22.04
tools:
python: "3.11"


sphinx:
configuration: docs/conf.py


python:
install:
- requirements: requirements_dev.txt
30 changes: 0 additions & 30 deletions .travis.yml

This file was deleted.

10 changes: 5 additions & 5 deletions README.rst
Expand Up @@ -5,23 +5,23 @@

.. image:: https://img.shields.io/pypi/v/inspyred.svg
:target: https://pypi.python.org/pypi/inspyred
:alt: PyPi

.. image:: https://github.com/aarongarrett/inspyred/actions/workflows/ci.yml/badge.svg
:target: https://github.com/aarongarrett/inspyred/actions/workflows/ci.yml
:alt: GitHub Actions

.. image:: https://readthedocs.org/projects/inspyred/badge/?version=latest
:target: https://inspyred.readthedocs.io/en/latest/?badge=latest
:alt: Documentation Status

.. image:: https://img.shields.io/github/issues-pr/aarongarrett/inspyred
:target: https://github.com/aarongarrett/inspyred/pulls
:alt: PRs

.. image:: https://img.shields.io/github/issues/aarongarrett/inspyred
:target: https://github.com/aarongarrett/inspyred/issues

.. image:: https://pyup.io/repos/github/aarongarrett/inspyred/shield.svg
:target: https://pyup.io/repos/github/aarongarrett/inspyred/
:alt: Updates
:alt: Issues


inspyred is a free, open source framework for creating biologically-inspired
Expand Down Expand Up @@ -69,7 +69,7 @@ should be maximized::
Requirements
------------

* Requires at least Python 2.6+ or 3+.
* Requires Python 3+.
* Numpy and Pylab are required for several functions in ``ec.observers``.
* Pylab and Matplotlib are required for several functions in ``ec.analysis``.
* Parallel Python (pp) is required if ``ec.evaluators.parallel_evaluation_pp`` is used.
Expand Down
16 changes: 8 additions & 8 deletions docs/conf.py
Expand Up @@ -55,8 +55,8 @@
master_doc = 'index'

# General information about the project.
project = u'inspyred'
copyright = u"2017, Aaron Garrett"
project = 'inspyred'
copyright = "2017, 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 Expand Up @@ -209,8 +209,8 @@
# [howto/manual]).
latex_documents = [
('index', 'inspyred.tex',
u'inspyred Documentation',
u'Aaron Garrett', 'manual'),
'inspyred Documentation',
'Aaron Garrett', 'manual'),
]

# The name of an image file (relative to this directory) to place at
Expand Down Expand Up @@ -240,8 +240,8 @@
# (source start file, name, description, authors, manual section).
man_pages = [
('index', 'inspyred',
u'inspyred Documentation',
[u'Aaron Garrett'], 1)
'inspyred Documentation',
['Aaron Garrett'], 1)
]

# If true, show URL addresses after external links.
Expand All @@ -255,8 +255,8 @@
# dir menu entry, description, category)
texinfo_documents = [
('index', 'inspyred',
u'inspyred Documentation',
u'Aaron Garrett',
'inspyred Documentation',
'Aaron Garrett',
'inspyred',
'A framework for creating bio-inspired computational intelligence algorithms in Python.',
'Miscellaneous'),
Expand Down
4 changes: 2 additions & 2 deletions docs/moonshot.py
Expand Up @@ -29,7 +29,7 @@ def pairwise(iterable):
"""s -> (s0,s1), (s1,s2), (s2, s3), ..."""
a, b = itertools.tee(iterable)
next(b, None)
return itertools.izip(a, b)
return zip(a, b)

def distance_between(position_a, position_b):
return math.sqrt((position_a[0] - position_b[0])**2 + (position_a[1] - position_b[1])**2)
Expand Down Expand Up @@ -147,7 +147,7 @@ def moonshot(orbital_height, satellite_mass, boost_velocity, initial_y_velocity,
x = [p[0] for p in position]
y = [p[1] for p in position]
cm = plt.get_cmap('gist_rainbow')
lines = plt.scatter(x, y, c=range(len(x)), cmap=cm, marker='o', s=2)
lines = plt.scatter(x, y, c=list(range(len(x))), cmap=cm, marker='o', s=2)
plt.setp(lines, edgecolors='None')
plt.axis("equal")
plt.grid("on")
Expand Down
4 changes: 2 additions & 2 deletions docs/polyarea.py
Expand Up @@ -3,7 +3,7 @@
from time import time
from time import sleep
import inspyred
from Tkinter import *
from tkinter import *
import itertools
#end_imports

Expand All @@ -12,7 +12,7 @@ def area(p):
return 0.5 * abs(sum([x0*y1 - x1*y0 for ((x0, y0), (x1, y1)) in segments(p)]))

def segments(p):
return zip(p, p[1:] + [p[0]])
return list(zip(p, p[1:] + [p[0]]))

def generate_polygon(random, args):
size = args.get('num_vertices', 6)
Expand Down
2 changes: 1 addition & 1 deletion examples/custom/custom_variator_example.py
Expand Up @@ -12,7 +12,7 @@
def my_variator(random, candidates, args):
mutants = []
for c in candidates:
points = random.sample(range(len(c)), 2)
points = random.sample(list(range(len(c))), 2)
x, y = min(points), max(points)
if x == 0:
mutants.append(c[y::-1] + c[y+1:])
Expand Down
14 changes: 10 additions & 4 deletions inspyred/__init__.py
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
"""
This package allows the creation of bio-inspired computational intelligence algorithms.
.. Copyright 2012 Aaron Garrett
.. Permission is hereby granted, free of charge, to any person obtaining a copy
Expand All @@ -20,17 +20,23 @@
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
THE SOFTWARE.
.. moduleauthor:: Aaron Garrett <garrett@inspiredintelligence.io>
"""
try:
import importlib.metadata
__version__ = importlib.metadata.version("inspyred")
except ImportError:
import importlib_metadata
__version__ = importlib_metadata.version("inspyred")

from inspyred import benchmarks
from inspyred import cli
from inspyred import ec
from inspyred import swarm

__all__ = ['benchmarks', 'cli', 'ec', 'swarm']
__version__ = '1.0.1'
__author__ = """Aaron Garrett"""
__email__ = 'garrett@inspiredintelligence.io'
__url__ = 'http://inspyred.github.com'

0 comments on commit ebd2171

Please sign in to comment.