fikisipi / elkai

elkai is a Python library for solving travelling salesman problems (TSP) based on LKH 3
Other
177 stars 18 forks source link

Switch from Python.h to milksnake+cffi #3

Open Mortal opened 5 years ago

Mortal commented 5 years ago

This allows setup.py bdist_wheel to create a wheel that is independent of the Python version.

Move InvokeSolver() from _elkai.c into LKH-2.0.9/SRC/elkai.c, and reimplement solve() in elkai/_elkai.py.

Update LKH-2.0.9/SRC/Makefile to build a shared library named libelkai.so (instead of trying to build an executable without main).

Update setup.py to invoke make and generate CFFI bindings for LKH-2.0.9/SRC/INCLUDE/elkai.h (which only declares InvokeSolver()).

fikisipi commented 5 years ago

Also, keep in mind that the Makefile by LKH that you modified isn't used in the build process, it has to be CMake. Edit: actually never mind, I guess milkshake uses it?

Mortal commented 5 years ago

Also, keep in mind that the Makefile by LKH that you modified isn't used in the build process, it has to be CMake. Edit: actually never mind, I guess milkshake uses it?

I modified setup.py so that it invokes make in LKH. I also removed the dependency on skbuild, so CMake is not used.

fikisipi commented 5 years ago
  1. I apologize for spelling milksnake incorrectly. It's not a milkshake, huh 🤣
  2. I'm getting errors when doing a build:
    running bdist_wheel
    running build
    running build_py
    error: [WinError 2] The system cannot find the file specified

    I guess I'm missing Make. I will try it a Linux build tomorrow.

fikisipi commented 5 years ago

@Mortal I am getting the following error

process_begin: CreateProcess(NULL, cc -fPIC -c -o OBJ/Activate.o Activate.c -O3 -Wall -IINCLUDE -DTWO_LEVEL_TREE -g, ...) failed.
make (e=2): The system cannot find the file specified.
make[1]: *** [OBJ/Activate.o] Error 2
make[1]: Leaving directory `C:/Users/Filip/milk/milksnake/LKH-2.0.9/SRC'
MaoHeiHei commented 3 years ago

A s s e r t i o n f a i l e d : H T a b l e = ( H a s h T a b l e * ) m a l l o c ( s i z e o f ( H a s h T a b l e ) ) , f i l e . . \ . . \ . . \ L K H - 2 . 0 . 9 \ S R C \ A l l o c a t e S t r u c t u r e s . c , l i n e 3 5 What should I do if I make this mistake

MaoHeiHei commented 3 years ago

@Mortal

fikisipi commented 3 years ago

@MaoHeiHei More information? Do the wheels not work for you? Are you trying to compile?

MaoHeiHei commented 3 years ago

A s s e r t i o n   f a i l e d :   H T a b l e   =   ( H a s h T a b l e   * )   m a l l o c ( s i z e o f ( H a s h T a b l e ) ) ,   f i l e   . . \ . . \ . . \ L K H - 2 . 0 . 9 \ S R C \ A l l o c a t e S t r u c t u r e s . c ,   l i n e   3 5    Process finished with exit code -1073740791 (0xC0000409)

I don't know how to solve this error. Is there not enough memory  

------------------ 原始邮件 ------------------ 发件人: "fikisipi/elkai" @.>; 发送时间: 2021年7月24日(星期六) 晚上10:44 @.>; @.**@.>; 主题: Re: [fikisipi/elkai] Switch from Python.h to milksnake+cffi (#3)

@MaoHeiHei More information? Do the wheels not work for you? Are you trying to compile?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.