coin-or / python-mip

Python-MIP: collection of Python tools for the modeling and solution of Mixed-Integer Linear programs
Eclipse Public License 2.0
516 stars 90 forks source link

Use MIP in Web Assembly Pyodide #249

Open sebastianjhm opened 2 years ago

sebastianjhm commented 2 years ago

Hi MIP team, I'm trying run MIP in browser using pyodide. I'm installing mip whit .whl that I found in pip website and function perfect. The problem is whit cbc. Exist a way to make possible compile cbc in web assembly, or use as a python library? Or do you have suggestions for this problem?

<!DOCTYPE html>

image

sebheger commented 2 years ago

@SebastianJHM You got some answers at https://github.com/coin-or/Cbc/issues/484 already. Is that fine so far?

I guess your problem is similar to #199. It should be "forbidden/restricted" by pip to install mip on a platform where CBC (or gurobi) couldn't be executed.

sebastianjhm commented 2 years ago

No exactly. The problem is that previously I need to install a instance of CBC in webassembly. In this case MIP use cbclib, that I suposse is a python interface from CBC. In order that this function, we would need the .whl files for cbclib, I suposse. And the wheels must necessarily be for any OS.

sebheger commented 2 years ago

I guess I cannot answer your questions to your satisfaction.

The bundled cbc-binaries within python-mip are only suitable to be run under osx/linux/windows. cbclib is just a variable containing the C API wrapper to cbc. So if it is not defined during runtime, python-mip was not able to wrap an API around any (bundled or hand-installed) cbc binaries.