Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 64 additions & 0 deletions .github/workflows/buildpublish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Build wheels+sdist and publish to PyPI

on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
workflow_dispatch:

jobs:
make_sdist:
name: Make SDist
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build SDist
run: pipx run build --sdist
- uses: actions/upload-artifact@v4
with:
name: cibw-sdist
path: dist/*.tar.gz
build_wheels:
name: Wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-13, macos-14]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: true
- uses: pypa/cibuildwheel@v2.23
env:
CIBW_ARCHS: auto64
CIBW_SKIP: "*musllinux* pp*"
CIBW_MANYLINUX_X86_64_IMAGE: quay.io/pypa/manylinux_2_34
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: cibw-wheels-${{ matrix.os }}
path: wheelhouse/*.whl
publish_all:
name: Publish on PyPI
needs: [build_wheels, make_sdist]
runs-on: ubuntu-latest
environment: pypi
permissions:
id-token: write
attestations: write
contents: read
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
pattern: cibw-*
path: dist
merge-multiple: true
- name: Generate artifact attestations
uses: actions/attest-build-provenance@v2.2.3
with:
subject-path: "dist/*"
- name: Upload to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
9 changes: 3 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install flake8 pytest
# if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
python -m pip install build flake8 pytest pytest-cov numpy

- name: Lint with flake8
run: |
Expand All @@ -42,13 +41,11 @@ jobs:

- name: Install and Build
run: |
pip install .
python setup.py build
python -m pip install .

- name: Test with pytest
run: |
pip install pytest-cov
pytest -s --cov=hygese --cov-report=xml
pytest -s --cov=hygese --cov-report=xml --pyargs hygese.tests

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v2
74 changes: 0 additions & 74 deletions .github/workflows/pypi.yml

This file was deleted.

36 changes: 36 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
cmake_minimum_required(VERSION 3.15)

set(CMAKE_INSTALL_PREFIX ${CMAKE_SOURCE_DIR} CACHE PATH "install prefix" FORCE)

if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif()

if(WIN32)
# MSBUILD toolchain names the shared library as hgscvrp.dll
# this forces it to use libhgscvrp.dll
set(CMAKE_SHARED_LIBRARY_PREFIX_CXX "lib")
endif()

project(
${SKBUILD_PROJECT_NAME}
VERSION ${SKBUILD_PROJECT_VERSION}
LANGUAGES CXX
)

set(CMAKE_CXX_STANDARD 17)

include(FetchContent)
FetchContent_Declare(
hgscvrp
GIT_REPOSITORY https://github.com/vidalt/HGS-CVRP.git
GIT_TAG 1a927955cd2861a29d978f0d359d6e647db9319c
)
FetchContent_MakeAvailable(hgscvrp)

# runtime library
if(CMAKE_HOST_WIN32)
install(TARGETS lib RUNTIME DESTINATION hygese)
else()
install(TARGETS lib LIBRARY DESTINATION hygese)
endif()
14 changes: 6 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,10 @@

This package provides a simple Python wrapper for the Hybrid Genetic Search solver for Capacitated Vehicle Routing Problems [(HGS-CVRP)](https://github.com/vidalt/HGS-CVRP).

The installation requires `gcc`, `make`, and `cmake` to build.
On Windows, for example, you can install them by `scoop install gcc make cmake` using [Scoop](scoop.sh).
Then, install the PyHygese package:
## Installation
```
pip install hygese
```
<!-- ```
python3 -m pip install git+https://github.com/chkwon/PyHygese
``` -->


## CVRP Example (random)
```python
Expand Down Expand Up @@ -148,9 +142,13 @@ class AlgorithmParameters:
lambda_: int = 40
nbElite: int = 4
nbClose: int = 5
nbIterPenaltyManagement: int = 100
targetFeasible: float = 0.2
seed: int = 1
penaltyDecrease: float = 0.85
penaltyIncrease: float = 1.2
seed: int = 0
nbIter: int = 20000
nbIterTraces: int = 500
timeLimit: float = 0.0
useSwapStar: bool = True
```
Expand Down
18 changes: 16 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
[project]
name = "hygese"
version = "0.0.0.11"
authors = [{name = "Changhyun Kwon"}]
description = "Wrapper for the Hybrid Genetic Search algorithm for Capacitated Vehicle Routing Problems (HGS-CVRP)"
readme = {file = "README.md", content-type = "text/markdown"}
requires-python=">=3.10"

[build-system]
requires = ["setuptools", "cmake"]
build-backend = "setuptools.build_meta"
requires = ["scikit-build-core"]
build-backend = "scikit_build_core.build"

[tool.scikit-build]
cmake.build-type = "Release"

[tool.coverage.paths]
source = ["src", "*/site-packages"]
134 changes: 0 additions & 134 deletions setup.py

This file was deleted.

File renamed without changes.
Loading