Skip to content

Commit

Permalink
Merge pull request #7 from igormcsouza/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
igormcsouza authored Jun 3, 2021
2 parents 3238c16 + b81b8cb commit 6cf05f5
Show file tree
Hide file tree
Showing 25 changed files with 813 additions and 4 deletions.
2 changes: 2 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[run]
relative_files = True
20 changes: 20 additions & 0 deletions .github/workflows/delivery.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Continuous Delivery

on:
pull_request:
branches:
- master

jobs:
package:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install pre-requisites
run: pip install poetry
- name: Install python requirements
run: poetry install
- name: Build package
run: poetry build
- name: Publish builded package
run: poetry publish -u ${{ secrets.USERNAME }} -p ${{ secrets.PASSWORD }}
29 changes: 29 additions & 0 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Continuous Integration

on: [push, pull_request]

jobs:
package:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install pre-requisites
run: pip install poetry
- name: Install python requirements
run: poetry install
- name: Run unit test and coverage
run: sh scripts/test.sh
- name: Update coveralls data
uses: AndreMiras/coveralls-python-action@develop
with:
parallel: true
flag-name: Unit Test

coveralls_finish:
needs: package
runs-on: ubuntu-latest
steps:
- name: Coveralls Finished
uses: AndreMiras/coveralls-python-action@develop
with:
parallel-finished: true
20 changes: 20 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Copyright (c) 2021 Igor Souza

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE 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.
56 changes: 53 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,59 @@
# PyMetaHeuristics
# Pymetaheuristics

Combinatorial Optimization problems with quickly good soving.

[![Continuous Integration](https://github.com/igormcsouza/pymetaheuristics/actions/workflows/integration.yml/badge.svg)](https://github.com/igormcsouza/pymetaheuristics/actions/workflows/integration.yml)
[![Coverage Status](https://coveralls.io/repos/github/igormcsouza/pymetaheuristics/badge.svg?branch=master)](https://coveralls.io/github/igormcsouza/pymetaheuristics?branch=master)


## Introduction

Pymetaheuristics is a package to help build and train Metaheuristics to solve
real world problems mathematically modeled. It strives to generalize the
overall idea of the technic and delivers to the user a friendly wrapper so the
cientist may focus on the problem modeling rather than the heuristic
implementation. This package is an open source project so feel free to send
your implementations and fixes so they may be helpful for others too.


## Subpackages

What Metaheuristics can be found on this project.
The idea is to implement all possible Metaheuristics found on the market today
and some helper functions to improve what is already there.
**Note: This package is under construction, new features will come up soon.**

What Metaheuristics can be found on this project?

1. Genetic Algorithm

## How to use

First install the package (available on pypi)
```bash
$ pip install pymetaheuristics
```

Import the algorithm model you want to use to solve you problem. Implement the
needed functions and pass to the model. Train and get the results.
```python
from pymetaheuristics.genetic_algorithm.model import GeneticAlgorithm

model = GeneticAlgorithm(
fitness_function=fitness_function,
genome_generator=genome_generator
)

result = model.train(
epochs=15, pop_size=10, crossover=pmx_single_point, verbose=True)
```

Every module has its integration test, which I submit the model for testing
with very know NP-Hard problems today (Knapsack, tsp, ...). If you want to see
how it goes, check out the integrations under the model testing folder.

## How to contribute

1. Genetic Algorithm
Your code and help is very appreciate! Please, send your issue and pr's
whenever is good for you! If needed, send an
[email](mailto:[email protected]) to me I'll be very glad to help. Let's
build up together.
104 changes: 103 additions & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Empty file.
2 changes: 2 additions & 0 deletions pymetaheuristics/genetic_algorithm/exceptions.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
class CrossOverException(BaseException):
pass
Loading

0 comments on commit 6cf05f5

Please sign in to comment.