Code Monkey home page Code Monkey logo

learn2branch's People

Contributors

antoineprv avatar dchetelat avatar gasse avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

learn2branch's Issues

git_hash.cpp missing

hi,I downloaded soplex-release-401.tar.gz and tried installing soplex. When I execute
Cmake S- B build DCMAKE_ INSTALL_ PREFIX=$SCIPOPTDIR
An error occurred
/Home/cc/download/oplex-release-401/src/soplex/spxgitash. cpp: 17:10: fatal error: soplex/git_ Hash.cpp: There is no such file or directory
I went to check and it was indeed not there. How should I solve this problem?
In addition, I installed it based on the following website: https://github.com/ds4dm/learn2branch/blob/master/INSTALL.md . According to its instructions, I should have downloaded softx-4.0.1.tgz, but the download was not successful, so I downloaded softx-release-401. tar.gz
I want to know how to solve this problem
thank you

AttributeError: 'pyscipopt.scip.Model' object has no attribute 'getKhalilState'

Hi, when I run the 02_generate_dataset.py file, I get the following error:
AttributeError: 'pyscipopt.scip.Model' object has no attribute 'getKhalilState

I have followed the installation instructions on the .md file.
I have tried both versions of PySCIPOpt (the one you used and the newest PiPy version).

I can't find where this attribute comes from as it is not available when I look at the list of pyscipopt.scip.Model attributes.

Issues about file 01_generate_instances.py

Hi,

For the code snippet that maintains at least 2 rows per col, at least 1 column per row showing below,

# compute number of rows per column
    indices = rng.choice(ncols, size=nnzrs)  # random column indexes
    indices[:2 * ncols] = np.repeat(np.arange(ncols), 2)  # force at leats 2 rows per col
    _, col_nrows = np.unique(indices, return_counts=True)

    # for each column, sample random rows
indices[:nrows] = rng.permutation(nrows) # force at least 1 column per row

I consider the sequential assignment of indices[:2 * ncols] and indices[:nrows] cannot provide those guarantees.

What about you think?

Thanks.

Actual amount of epochs for setcover instances

What are the actual amount of epochs it took to train the ML model for the 1000 columns, 500 rows, 0.05d setcover instances?

I can see that the default max amount of epochs is 1000 and that early stopping is used. But I am assuming that considering the 14 hours it took to train, the actual amount of epochs is a lot less than a thousand.

How to deal with the "Converting sparse IndexedSlices to a dense Tensor of unknown shape." problem

Hi,

When I am running the codes in 03_train_gcnn.py there is a problem as following:

/root/miniconda3/envs/myenv/lib/python3.7/site-packages/tensorflow/python/ops/gradients_util.py:93: UserWarning: Converting sparse IndexedSlices to a dense Tensor of unknown shape. This may consume a large amount of memory.
"Converting sparse IndexedSlices to a dense Tensor of unknown shape. "

I think this problem may happen due to the tf.gather() function you use in line 150.

        logits = model(batched_states)
        logits = tf.expand_dims(tf.gather(tf.squeeze(logits, 0), cands), 0)  # filter candidate variables
        logits = model.pad_output(logits, n_cands.numpy())  # apply padding now
        loss = tf.losses.sparse_softmax_cross_entropy(labels=actions, logits=logits)

I wonder if there is any substitute for tf.gather() to deal with this problem.
Thank you.

How to improve accuracy of gcnn?

Hi,
I am running the codes on a combinatorial optimization problem defined by myself, which is similar to Capacitated Facility Location problem. However, the accuracy of the GCNN is low. The acc@10 is about 45% . What parameters of GCNN should I first consider to adjust? The training usually stops at 140 epochs with no improve for 20 on validation.
Uploading image.png…

Thank you.

Is it possible to run the algorithem for VRP variants?

Hi & goog day!

I've serached through the codes and paper a little bit and am wondering whether it's possible to work on a variant of VRP and recieve the soultion.
I mean, I have an MILP formulation for VRPTW and wonder how to solve that with Learn2Branch? I thank you and appreciate any advice.

how to get a solution using this model

Hi,

This might be a silly question, I want to know that if I have one sample case, e.g, an indset problem in lp format, how can I use this model to get a solution to the exact sample? As far as I can tell, the model takes in some states extracted from the SCIP backend and uses these states to predict which branch action to do. Doesn't that mean I need to run the SCIP solver every time I have a new graph?

Thank you!

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

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.

How to improve the accuracy of svmrank?

Hi, gasse!
Recently,I am running your code on a MILP problem defined by myself. I find out the model: SVMRANK and GCNN do not work well on my problem.Do you suggest add some new candidate features to improve the model"SVMRANK".If so,how to add some candidate features on your code?
Thanks a lot!

ImportError: dlopen...Library not loaded: libscip.6.0.dylib...Reason: image not found

Dear Professor,

after I finished the install.md, I try to run the 'python 01_generate_instances.py setcover' but I got this error.
截屏2021-01-18 下午6 25 39

(base) gaoyijie@vlan-2605-10-16-25-94 learn2branch % python3 01_generate_instances.py setcover
Traceback (most recent call last):
File "01_generate_instances.py", line 5, in
import utilities
File "/Users/gaoyijie/Desktop/learn2branch/utilities.py", line 4, in
import pyscipopt as scip
File "/Users/gaoyijie/opt/anaconda3/lib/python3.7/site-packages/pyscipopt/init.py", line 5, in
from pyscipopt.scip import Model
ImportError: dlopen(/Users/gaoyijie/opt/anaconda3/lib/python3.7/site-packages/pyscipopt/scip.cpython-37m-darwin.so, 2): Library not loaded: libscip.6.0.dylib
Referenced from: /Users/gaoyijie/opt/anaconda3/lib/python3.7/site-packages/pyscipopt/scip.cpython-37m-darwin.so
Reason: image not found

Could you please help me to solve this? Appreciate you.

BiPartiteGraphConvolution implementation

Hi,
In your paper you mention that the graph-convolution layer uses the following update rule:
image
image

In models/baseline/model.py L196,
you add up the features for c_i, v_j and e_{i,j} before passing it through feature_module_final layer which I assume stands for $g_C$ in the paper.
Shouldn't this be the concatenation operation instead of addition. Isn't that more standard way to parameterize $g_C(c_i, v_j, e_{i,j})$

Thanks!

tensorflow.python.framework.errors_impl.InternalError: Blas GEMM launch failed

Hello,
Thanks for your great work. I am currently trying to reproduce it and stuck with some problems about tensorflow. I have successfully generated training dataset for setcover and meet the following Error when I run the python 03_train_gcnn.py setcover -m baseline:

[2023-02-04 16:21:35.606917] EPOCH 0...
2023-02-04 16:21:51.414814: E tensorflow/stream_executor/cuda/cuda_blas.cc:652] failed to run cuBLAS routine cublasSgemm_v2: CUBLAS_STATUS_EXECUTION_FAILED
Traceback (most recent call last):
  File "03_train_gcnn.py", line 253, in <module>
    n = pretrain(model=model, dataloader=pretrain_data)
  File "03_train_gcnn.py", line 49, in pretrain
    if not model.pre_train(batched_states, tf.convert_to_tensor(True)):
  File "/scratch/anji/rush_exps/learn2branch/models/baseline/model.py", line 260, in pre_train
    self.call(*args, **kwargs)
  File "/scratch/anji/rush_exps/learn2branch/models/baseline/model.py", line 418, in call
    constraint_features = self.cons_embedding(constraint_features)
  File "/home/anji/softwares/miniconda3/envs/py36/lib/python3.6/site-packages/tensorflow/python/keras/engine/base_layer.py", line 757, in __call__
    outputs = self.call(inputs, *args, **kwargs)
  File "/home/anji/softwares/miniconda3/envs/py36/lib/python3.6/site-packages/tensorflow/python/keras/engine/sequential.py", line 232, in call
    inputs, training=training, mask=mask)
  File "/home/anji/softwares/miniconda3/envs/py36/lib/python3.6/site-packages/tensorflow/python/keras/engine/sequential.py", line 250, in _call_and_compute_mask
    x = layer.call(x, **kwargs)
  File "/home/anji/softwares/miniconda3/envs/py36/lib/python3.6/site-packages/tensorflow/python/keras/layers/core.py", line 970, in call
    outputs = gen_math_ops.mat_mul(inputs, self.kernel)
  File "/home/anji/softwares/miniconda3/envs/py36/lib/python3.6/site-packages/tensorflow/python/ops/gen_math_ops.py", line 4586, in mat_mul
    _six.raise_from(_core._status_to_exception(e.code, message), None)
  File "<string>", line 3, in raise_from
tensorflow.python.framework.errors_impl.InternalError: Blas GEMM launch failed : a.shape=(66090, 5), b.shape=(5, 64), m=66090, n=64, k=5 [Op:MatMul]

I am wondering if there is something wrong with my environment. But I followed the install.md and use python 3.6 and tensorflow-gpu 1.12.0. I will appreciate it if you could help solve the problem.

What is getKhalilstate?

Hi Iam facing this error in utilities.py

scip_state = model.getKhalilState(root_buffer, candidates)

getKhalilState is not defined. Could you please help me with this.

patch is hanging up

It might be that the patch command should be -

patch -p1 < `path of the file`

because the one in the document is hanging up the kernel.

About install issues (Patch & PySCIPOpt)

Hello gasse,

I have been read your paper very impressively.
Currently, I am working on a task to solve the MILP problem of 100,000 by 100,000 sizes.
Many attempts have been made to adapt your model.
However, the following problems occurred.

My computer details are as follows.
-Linux 86X

1. patch issues

I had to patch after installing SCIP, but I couldn't patch because the scip/benders_default.o file was not found.

--- a/Makefile
+++ b/Makefile
@@ -512,6 +512,7 @@ SCIPPLUGINLIBOBJ= scip/benders_default.o \
 scip/branch_pscost.o \
 scip/branch_random.o \
 scip/branch_relpscost.o \
+ scip/branch_vanillafullstrong.o \
 scip/cons_abspower.o \
 scip/compr_largestrepr.o \
 scip/compr_weakcompr.o \

2. Install PySCIOpt
This also gave me the following error:

Collecting pyscipopt
  WARNING: Keyring is skipped due to an exception: Failed to create the collection: Prompt dismissed..
  Downloading http://mirror.kakao.com/pypi/packages/bd/1e/72203205f44999ab8982a75efa4a6b32343382d58235a4d607d2197df417/PySCIPOpt-3.0.1.tar.gz (615 kB)
     |████████████████████████████████| 615 kB 3.4 MB/s
Building wheels for collected packages: pyscipopt
  Building wheel for pyscipopt (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /home/sugyeong/anaconda3/bin/python -u -c'import sys, setuptools, tokenize; sys.argv[0] ='"'"'/tmp/pip-install-kkbly572/pyscipopt/setup.py'"'"'; __file__='"'"'/tmp/pip-install-kkbly572/pyscipopt/setup.py'"'"';f=getattr(tokenize,'"'"'open'"'"', open)(__file__) ;code=f.read().replace('"'"'\r\n'"'"','"'"'\n'"'"');f.close();exec(compile( code, __file__,'"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-6esiywdm
       cwd: /tmp/pip-install-kkbly572/pyscipopt/
  Complete output (37 lines):


...

  src/pyscipopt/scip.c:629:10: fatal error: scip/scip.h: No such file or directory
    629 | #include "scip/scip.h"
        | ^~~~~~~~~~~~~
  compilation terminated.
  error: command'gcc' failed with exit status 1

...

Probably, the problem occurred because the install did not work properly.
(I think it is an extension of the patch problem.)
As far as I know, pyscipopt is not needed on Linux.
Therefore, in the generating part, pysciopt was excluded from the utility, and it worked well. But in the second file, I need to use scip.Branchrule, which seems to be without pysciopt.

Sorry for asking too little of a problem.
Please answer if you are not very busy.

Where can I see doc on this method

"

update state from state_buffer if any

scip_state = model.getKhalilState(root_buffer, candidates)

"

This seems to be a SCIP method but I can't find any docs over it, can you point me in the right direction?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.