Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error 0xC0000005 when changing the node selection method #819

Open
gwenmaudet opened this issue Mar 18, 2024 · 4 comments
Open

Error 0xC0000005 when changing the node selection method #819

gwenmaudet opened this issue Mar 18, 2024 · 4 comments

Comments

@gwenmaudet
Copy link

gwenmaudet commented Mar 18, 2024

Describe the bug
I want to give a score to a partial node according to the features of this node, and then execute Best First Search to define the search strategy of the branch-and-bound. However, for some scoring function, the program terminate with "Process finished with exit code -1073741819 (0xC0000005)".

You can find the instance file here :
er_n=50_m=737_p=0.60_SET2_setparam=100.00_alpha=0.50.txt
(attached as txt, maybe need to change it back to .lp)

To Reproduce

from pyscipopt import Model, Nodesel
from operator import *



def protectedDiv(left, right):
    try:
        return left / right
    except ZeroDivisionError:
        return 1

class CustomNodeSelector(Nodesel):

    def __init__(self, sel_policy='', comp_policy=''):
        self.sel_policy = sel_policy
        self.comp_policy = comp_policy


    def nodeselect(self):#### BFS policy
        print(self.model.getOpenNodes())## print open nodes list
        return {'selnode': self.model.getBestNode()}

    def nodecomp(self, node1, node2):#### give the score to a node according to policy, then compare the two score to deinfe which is the best

        val1 = self.policy(node1)
        val2 = self.policy(node2)
        if val1 < val2:
            return -1
        else:
            return 1

    def policy(self,node):#### the score is here an example of a randomly defined score. Most of the time, the definition allow the termination of the algorithm, but in this case, not
        return mul(self.model.getNVars(), protectedDiv(self.model.getDualbound(), self.model.getNVars()))


def perform_SCIP_instances_using_a_tuned_comp_policy(instances_folder="", comp_policy="",
                                                 sel_policy=""):  # solve one instance of the GISP problem
    instance_path = "er_n=50_m=737_p=0.60_SET2_setparam=100.00_alpha=0.50.lp"
    model = Model()
    model.hideOutput()
    model.readProblem(instance_path)
    oracle_ns = CustomNodeSelector(sel_policy=sel_policy, comp_policy=comp_policy)
    model.includeNodesel(oracle_ns, "oracle_recorder", "testing",
                     536870911, 53687091)  #
    model.optimize()

    return (model.getSolvingTime())


if __name__ == "__main__":
    perform_SCIP_instances_using_a_tuned_comp_policy()

Expected behavior
In most of the cases, the algorithm terminates, and return the solving time. In some specific scoring function (the one presented here), it doesn't finish. One weird thing is that the open node lists are all empty, normally meaning that the algorithm terminates properly..

Describe the bug

OS: Windows 10
PySCIPOpT version: 5.0.0
python version: 3.12

@gwenmaudet gwenmaudet changed the title 0xC0000005 when changing the node selection method Error 0xC0000005 when changing the node selection method Mar 18, 2024
@Opt-Mucca
Copy link
Collaborator

Hey @gwenmaudet
I took a small glance at this, and everything looks fine. On my system I can't recreate your error, and the general code concept doesn't look flawed.
I think this requires another set of eyes, or for you to get some backtrace.

@gwenmaudet
Copy link
Author

Hello,
thank you very much for that reply. Indeed, I re-installed the package properly, and it seems that that bugs disappeared. Also, thank you to confirm that this code doesn't look bad :)
Cheers

@gwenmaudet
Copy link
Author

gwenmaudet commented Apr 10, 2024

er_n=54_m=850_p=0.60_SET2_setparam=100.00_alpha=0.50.txt

Hello, finally, that code does not work.
You can also try this example, with the instance being the one attached, and the policy being :
def policy(self,node): return sub(node.getLowerbound(), protectedDiv(self.model.getLPObjVal(), node.getLowerbound()))

@gwenmaudet
Copy link
Author

To reproduce the problem please note that

  • I'm running on is a Conda with the specification described in conda-environment.yaml.txt,
  • the command I am using to launch the script is python error_test.py (you will need the files in the attached zip), and
  • the output of GDB is:
$ gdb python -c coredump
GNU gdb (GDB) Red Hat Enterprise Linux 8.2-20.el8
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from python...done.

warning: core file may not match specified executable file.
[New LWP 954748]
BFD: warning: /mnt/irisgpfs/users/gmaudet/micromamba/envs/pyscipopt/lib/python3.12/site-packages/pyscipopt/../../.././././././libicudata.so.73: unsupported GNU_PROPERTY_TYPE (5) type: 0xc0010001
BFD: warning: /mnt/irisgpfs/users/gmaudet/micromamba/envs/pyscipopt/lib/python3.12/site-packages/pyscipopt/../../.././././././libicudata.so.73: unsupported GNU_PROPERTY_TYPE (5) type: 0xc0010002
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
Core was generated by `python error_test.py'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x00007f00a311ad1d in SCIPnodeFocus () from /mnt/irisgpfs/users/gmaudet/micromamba/envs/pyscipopt/lib/python3.12/site-packages/pyscipopt/../../../libscip.so.9.0
Missing separate debuginfos, use: yum debuginfo-install glibc-2.28-236.el8.7.x86_64

Function SCIPnodeFocus() of libscip.so.9.0 is where the segfault occurs.

You can also find the coredump file in the zip file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants