Skip to content

Commit

Permalink
RC2 0.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
bruscalia committed Nov 2, 2023
1 parent b7061e3 commit 2888405
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 16 deletions.
4 changes: 3 additions & 1 deletion .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,6 @@ formats:
# See https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html
python:
install:
- requirements: docs/requirements.txt
- requirements: docs/requirements.txt
- method: pip
path: .
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Here is a minimum working example in which a symmetric distances matrix is produ
# Imports
import numpy as np
from scipy.spatial.distance import pdist, squareform
from tspgrasp.grasp import Grasp
from tspgrasp import Grasp
```

```python
Expand Down
16 changes: 8 additions & 8 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
ipykernel
sphinx
sphinx_rtd_theme
sphinxcontrib-bibtex
pandoc
numpydoc
nbsphinx
matplotlib
urllib3==1.*
sphinx==7.2.6
sphinx_rtd_theme==1.3.0
sphinxcontrib-bibtex==2.5.0
pandoc==2.3
numpydoc==1.6.0
nbsphinx==0.9.3
matplotlib==3.*
urllib3==1.*
2 changes: 2 additions & 0 deletions docs/source/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
tspgrasp
========

The operators listed here are intended to be easily available for the user, so they can be imported directy from `tspgrap`.

Grasp
-----

Expand Down
2 changes: 1 addition & 1 deletion docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Use
# Imports
import numpy as np
from scipy.spatial.distance import pdist, squareform
from tspgrasp.grasp import Grasp
from tspgrasp import Grasp
# Create distances matrix
X = np.random.random((100, 2))
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
name = 'tspgrasp',
package_dir={'': "src"},
packages = find_packages(where='src'),
version = '0.1.0.rc1',
version = '0.1.0.rc2',
license='Apache License 2.0',
description = 'GRASP for TSP',
long_description_content_type="text/markdown",
Expand Down
2 changes: 1 addition & 1 deletion src/tspgrasp/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def __call__(
Maximum number of local search moves, by default 100000
time_limit : float, optional
Time limit to interrupt the solution, by default float("inf")
Time limit (s) to interrupt the solution, by default float("inf")
target : float, optional
Taget value for objective which interrupts optimization process, by default -float("inf")
Expand Down
10 changes: 7 additions & 3 deletions src/tspgrasp/environ.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,19 @@ def __call__(self, D: np.ndarray) -> Solution:

class SemiGreedy(tspconstr.SemiGreedy):

def __init__(self, seed: int = None):
"""Greedy adaptive construction for the TSP inserting the next node at the end of the partial tour.
def __init__(self, alpha=(0.0, 1.0), seed=None):
"""Greedy-randomized constructive heuristic for the TSP.
Parameters
----------
alpha : tuple, optional
Alpha parameter - randomly generated at each iteration between range or fixed scalar.
Use values closer to one for a more greedy approach. By default (0.0, 1.0).
seed : int, optional
Random generator seed (differs behavior from cython to python), by default None
"""
super().__init__(seed)
super().__init__(alpha=alpha, seed=seed)

def __call__(self, D: np.ndarray) -> Solution:
"""Solves a TSP based on a pairwise distances matrix.
Expand Down

0 comments on commit 2888405

Please sign in to comment.