Skip to content
This repository has been archived by the owner on May 10, 2023. It is now read-only.

Commit

Permalink
Merge pull request #28 from garciparedes/master
Browse files Browse the repository at this point in the history
Issue 27
  • Loading branch information
garciparedes authored Aug 15, 2019
2 parents 97713e5 + 7e5dbb3 commit 749625a
Show file tree
Hide file tree
Showing 79 changed files with 4,717 additions and 239 deletions.
3 changes: 3 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# These are supported funding model platforms

patreon: garciparedes
38 changes: 38 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''

---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Desktop (please complete the following information):**
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]

**Smartphone (please complete the following information):**
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]

**Additional context**
Add any other context about the problem here.
20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''

---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.
17 changes: 17 additions & 0 deletions .github/ISSUE_TEMPLATE/version_release.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
name: Version release
about: Publish a new version
title: ''
labels: ''
assignees: ''

---

**Set a release date**
A date and time specifying the release of the new version.

**Describe the change respect to the past version**
A clear and concise description of what the new version will contain.

**Additional context**
Add any other context about the new version here here.
45 changes: 45 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# PR Details

<!--- Provide a general summary of your changes in the Title above -->

## Description

<!--- Describe your changes in detail -->

## Related Issue

<!--- This project only accepts pull requests related to open issues -->
<!--- If suggesting a new feature or change, please discuss it in an issue first -->
<!--- If fixing a bug, there should be an issue describing it with steps to reproduce -->
<!--- Please link to the issue here: -->

## Motivation and Context

<!--- Why is this change required? What problem does it solve? -->

## How Has This Been Tested

<!--- Please describe in detail how you tested your changes. -->
<!--- Include details of your testing environment, and the tests you ran to -->
<!--- see how your change affects other areas of the code, etc. -->

## Types of changes

<!--- What types of changes does your code introduce? Put an `x` in all the boxes that apply: -->

- [ ] Docs change / refactoring / dependency upgrade
- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to change)

## Checklist

<!--- Go over all the following points, and put an `x` in all the boxes that apply. -->
<!--- If you're unsure about any of these, don't hesitate to ask. We're here to help! -->

- [ ] My code follows the code style of this project.
- [ ] My change requires a change to the documentation.
- [ ] I have updated the documentation accordingly.
- [ ] I have read the **CONTRIBUTING** document.
- [ ] I have added tests to cover my changes.
- [ ] All new and existing tests passed.
76 changes: 76 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# Contributor Covenant Code of Conduct

## Our Pledge

In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, sex characteristics, gender identity and expression,
level of experience, education, socio-economic status, nationality, personal
appearance, race, religion, or sexual identity and orientation.

## Our Standards

Examples of behavior that contributes to creating a positive environment
include:

* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting

## Our Responsibilities

Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.

Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.

## Scope

This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. Examples of
representing a project or community include using an official project e-mail
address, posting via an official social media account, or acting as an appointed
representative at an online or offline event. Representation of a project may be
further defined and clarified by project maintainers.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at sergio@garciparedes.me. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.

Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html

[homepage]: https://www.contributor-covenant.org

For answers to common questions about this code of conduct, see
https://www.contributor-covenant.org/faq
20 changes: 20 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Contributing

We love contributions from everyone.
By participating in this project,
you agree to abide by the thoughtbot [code of conduct].

[code of conduct]: CODE_OF_CONDUCT.md

We expect everyone to follow the code of conduct
anywhere in thoughtbot's project codebases,
issue trackers, chatrooms, and mailing lists.

## Contributing Code

1. Fork it!
2. Create an issue explaining the changes you want to apply.
2. Create your a branch for in which you will apply your change: `git checkout -b issue-[ISSUE_NUMBER_WITHOUT_HASHTAG]`
3. Commit your changes: `git commit -am 'Add some feature'`
4. Push to the branch: `git push origin issue-[ISSUE_NUMBER_WITHOUT_HASHTAG]`
5. Submit a pull request to the `master` branch of this repositoy 🙂
19 changes: 14 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
[![PyPI](https://img.shields.io/pypi/v/jinete.svg)](https://pypi.org/project/jinete)
[![Read the Docs](https://img.shields.io/readthedocs/jinete.svg)](https://jinete.readthedocs.io/)
[![Travis (.org) branch](https://img.shields.io/travis/garciparedes/jinete/master.svg)](https://travis-ci.org/garciparedes/jinete/branches)
[![Codecov](https://img.shields.io/codecov/c/github/garciparedes/jinete.svg)](https://coveralls.io/github/garciparedes/jinete)
[![Codecov](https://img.shields.io/codecov/c/github/garciparedes/jinete.svg)](https://codecov.io/gh/garciparedes/jinete)
[![GitHub](https://img.shields.io/github/license/garciparedes/jinete.svg)](https://github.com/garciparedes/jinete/blob/master/LICENSE)
[![GitHub stars](https://img.shields.io/github/stars/garciparedes/jinete.svg)](https://github.com/garciparedes/jinete)

Expand All @@ -16,7 +16,7 @@ High Performance solving suite for the Pickup and Delivery Problem and its relat

*IMPORTANT*: This project is still under its early stage of development. So it's not recommended yet to use on real world projects.

This library has been inspired (and created) by development from a Final Degree Project, which you can read at: https://github.com/garciparedes/tfg-pickup-and-delivery
This library has been inspired (and created) by a Final Degree Project, which you can read at: https://github.com/garciparedes/tfg-pickup-and-delivery


## How to install
Expand Down Expand Up @@ -88,9 +88,18 @@ pipenv python -m unittest discover tests

* [`examples`](https://github.com/garciparedes/jinete/tree/master/examples/): Basic examples to start using the library.
* [`jinete`](https://github.com/garciparedes/jinete/tree/master/jinete/): The source code of the library.
* [`algorithms`](https://github.com/garciparedes/jinete/tree/master/algorithms/): [TODO]
* [`dispatchers`](https://github.com/garciparedes/jinete/tree/master/dispatchers/): [TODO]
* ...
* [`algorithms`](https://github.com/garciparedes/jinete/tree/master/jinete/algorithms/): [TODO]
* [`exacts`](https://github.com/garciparedes/jinete/tree/master/jinete/algorithms/exacts): [TODO]
* [`heuristics`](https://github.com/garciparedes/jinete/tree/master/jinete/algorithms/heuristics): [TODO]
* [`metaheuristics`](https://github.com/garciparedes/jinete/tree/master/jinete/algorithms/metaheuristics): [TODO]
* [`utils`](https://github.com/garciparedes/jinete/tree/master/jinete/algorithms/utils): [TODO]
* [`crossers`](https://github.com/garciparedes/jinete/tree/master/jinete/algorithms/utils/crossers): [TODO]
* [`dispatchers`](https://github.com/garciparedes/jinete/tree/master/jinete/dispatchers/): [TODO]
* [`loaders`](https://github.com/garciparedes/jinete/tree/master/jinete/loaders/): [TODO]
* [`formatters`](https://github.com/garciparedes/jinete/tree/master/jinete/loaders/formatters/): [TODO]
* [`models`](https://github.com/garciparedes/jinete/tree/master/jinete/models/): [TODO]
* [`storers`](https://github.com/garciparedes/jinete/tree/master/jinete/storers/): [TODO]
* [`formatters`](https://github.com/garciparedes/jinete/tree/master/jinete/storers/formatters/): [TODO]
* [`setup.py`](https://github.com/garciparedes/jinete/tree/master/setup.py): The builder of this library.
* [`tests`](https://github.com/garciparedes/jinete/tree/master/tests/): The library tests.

Expand Down
57 changes: 57 additions & 0 deletions examples/main_cordeau.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import logging
from pathlib import Path

import coloredlogs

import jinete as jit

level = logging.INFO
logging.basicConfig(level=level)
coloredlogs.install(level=level)

logger = logging.getLogger(__name__)

BASE_PATH = Path(__file__).parents[1]
DATASETS_PATH = BASE_PATH / 'res' / 'datasets'


def main():
logger.info('Starting...')

file_path = DATASETS_PATH / 'cordeau-laporte' / 'R1a.txt'

class MyLoader(jit.FileLoader):
def __init__(self, *args, **kwargs):
super().__init__(
file_path=file_path,
formatter_cls=jit.CordeauLaporteLoaderFormatter,
*args, **kwargs,
)

class MyAlgorithm(jit.InsertionAlgorithm):
def __init__(self, *args, **kwargs):
super().__init__(
neighborhood_max_size=500,
*args, **kwargs,
)

class MyStorer(jit.PromptStorer):
def __init__(self, *args, **kwargs):
super().__init__(
formatter_cls=jit.ColumnarStorerFormatter,
*args, **kwargs,
)

dispatcher = jit.StaticDispatcher(
MyLoader,
MyAlgorithm,
MyStorer,
)

result = dispatcher.run()

logger.info('Finished...')


if __name__ == '__main__':
main()
11 changes: 4 additions & 7 deletions examples/main_dispatcher.py → examples/main_hashcode.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def main():
'e': 'e_high_bonus.in',
}

file_path = DATASETS_PATH / 'hashcode' / FILES['b']
file_path = DATASETS_PATH / 'hashcode' / FILES['c']

class MyLoader(jit.FileLoader):
def __init__(self, *args, **kwargs):
Expand All @@ -36,14 +36,11 @@ def __init__(self, *args, **kwargs):
*args, **kwargs,
)

class MyAlgorithm(jit.GraspAlgorithm):
class MyAlgorithm(jit.InsertionAlgorithm):
def __init__(self, *args, **kwargs):
super().__init__(
episodes=20,
algorithm_cls=jit.InsertionAlgorithm,
crosser_cls=jit.RandomizedCrosser,
randomized_size=3,
neighborhood_max_size=150,
neighborhood_max_size=200,
criterion_cls=jit.HashCodePlannedTripCriterion,
*args, **kwargs,
)

Expand Down
22 changes: 19 additions & 3 deletions jinete/__init__.py
Original file line number Diff line number Diff line change
@@ -1,29 +1,45 @@
from ._version import (
__version__,
VERSION,
)

from .models import (
Position,
GeometricPosition,
Surface,
GeometricSurface,
METRIC,
DistanceMetric,
Trip,
Job,
PlannedTrip,
Vehicle,
Fleet,
Route,
Planning,
PlannedTrip,
Result,
DirectionObjective,

OptimizationDirection,

Objective,
DialARideObjective,
TaxiSharingObjective,
HashCodeObjective,

PlannedTripCriterion,
ShortestTimePlannedTripCriterion,
LongestTimePlannedTripCriterion,
LongestUtilTimePlannedTripCriterion,
HashCodePlannedTripCriterion,
)

from .loaders import (
LoaderException,
LoaderFormatterException,
Loader,
FileLoader,
LoaderFormatter,
HashCodeLoaderFormatter,
CordeauLaporteLoaderFormatter,
)

from .dispatchers import (
Expand Down
Loading

0 comments on commit 749625a

Please sign in to comment.