ds4dm / learn2branch

Exact Combinatorial Optimization with Graph Convolutional Neural Networks (NeurIPS 2019)
https://arxiv.org/abs/1906.01629
MIT License
349 stars 103 forks source link

Regarding scip.Model.getState() for extracting the state of the solver #17

Open XiangyuYang-Opt opened 2 years ago

XiangyuYang-Opt commented 2 years ago

Hi, all,

I want to ask that what the alternatives are for the function scip.Model.getState()? It seems that .getState() is an old-fashioned usage, and it is not available to see on Model Class Reference (i.e., on SCIP Official website) anymore. Could anyone help with this?

Thanks in advance.

gasse commented 2 years ago

Hi @XiangyuYang-Opt ,

The alternative in Ecole is the NodeBipartite observation, available here: https://doc.ecole.ai/py/en/stable/reference/observations.html#node-bipartite

It basically extracts the same information, but has been re-engineered in C++ (including also minor bug fixes that were present in the original getState()).

Best, Maxime

XiangyuYang-Opt commented 2 years ago

Thanks @gasse for replying!

Further, I would like to ask if the original code for model.getState() can be provided in this project? As I understand, this model.getState() method is coded by yourself and is integrated into the SCIPopt package, e.g., the scip.pyx file.

Thanks.

gasse commented 2 years ago

You will find that function in a dedicated ml-branching branch in our PySCIPOpt fork here: https://github.com/ds4dm/PySCIPOpt/blob/9b88eddcfe99208e737236d39ccd6c9dd1a9bec4/src/pyscipopt/scip.pyx#L3917

Best, Maxime

LeonaireHo commented 2 years ago

Hi, @gasse Hello, after I installed it with your github branch, it still couldn't find the function getState in scip.Model. Is it normal? What else do I need to configure?

Thanks in advance.

gasse commented 2 years ago

Hi @LeonaireHo . Most likely you've installed from the main branch. The getState() function is only available in the ml-branching branch. You should be able to install using:

pip install git+https://github.com/ds4dm/PySCIPOpt.git@ml-branching
FosingC commented 1 year ago

Hi @gasse , when use the command pip install git+https://github.com/ds4dm/PySCIPOpt.git@ml-branching , the error information showed below: gcc -pthread -B /home/zhangliang/anaconda3/envs/rl11/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/tmp/pip-req-build-okb3jayy/include -I/home/zhangliang/anaconda3/envs/rl11/lib/python3.6/site-packages/numpy/core/include -I/home/zhangliang/anaconda3/envs/rl11/include/python3.6m -c src/pyscipopt/scip.c -o build/temp.linux-x86_64-3.6/src/pyscipopt/scip.o src/pyscipopt/scip.c:648:10: fatal error: scip/scip.h: No such file or directory 648 | #include "scip/scip.h" | ^~~~~ compilation terminated. error: command 'gcc' failed with exit status 1

how can I solve it? Thanks!