Skip to content
Closed
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
5 changes: 3 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,9 @@ jobs:

- name: Install and Build
run: |
pip install .
python setup.py build
pip install build
python -m build
pip install dist/hygese*.whl

- name: Test with pytest
run: |
Expand Down
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()
12 changes: 12 additions & 0 deletions hygese/hygese.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,13 @@ class CAlgorithmParameters(Structure):
("lambda", c_int),
("nbElite", c_int),
("nbClose", c_int),
("nbIterPenaltyManagement", c_int),
("targetFeasible", c_double),
("penaltyDecrease", c_double),
("penaltyIncrease", c_double),
("seed", c_int),
("nbIter", c_int),
("nbIterTraces", c_int),
("timeLimit", c_double),
("useSwapStar", c_int),
]
Expand All @@ -62,9 +66,13 @@ class AlgorithmParameters:
lambda_: int = 40
nbElite: int = 4
nbClose: int = 5
nbIterPenaltyManagement: int = 100
targetFeasible: float = 0.2
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 All @@ -76,9 +84,13 @@ def ctypes(self) -> CAlgorithmParameters:
self.lambda_,
self.nbElite,
self.nbClose,
self.nbIterPenaltyManagement,
self.targetFeasible,
self.penaltyDecrease,
self.penaltyIncrease,
self.seed,
self.nbIter,
self.nbIterTraces,
self.timeLimit,
int(self.useSwapStar),
)
Expand Down
15 changes: 13 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
[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"]
build-backend = "setuptools.build_meta"
requires = ["scikit-build-core"]
build-backend = "scikit_build_core.build"

[tool.scikit-build]
cmake.build-type = "Release"
134 changes: 0 additions & 134 deletions setup.py

This file was deleted.