PySCIPOpt  5.1.1
Python Interface for the SCIP Optimization Suite
branchrule.pxi
Go to the documentation of this file.
1 
3 cdef class Branchrule:
4  cdef public Model model
5 
6  def branchfree(self):
7  '''frees memory of branching rule'''
8  pass
9 
10  def branchinit(self):
11  '''initializes branching rule'''
12  pass
13 
14  def branchexit(self):
15  '''deinitializes branching rule'''
16  pass
17 
18  def branchinitsol(self):
19  '''informs branching rule that the branch and bound process is being started '''
20  pass
21 
22  def branchexitsol(self):
23  '''informs branching rule that the branch and bound process data is being freed'''
24  pass
25 
26  def branchexeclp(self, allowaddcons):
27  '''executes branching rule for fractional LP solution'''
28  raise NotImplementedError("branchexeclp() is a fundamental callback and should be implemented in the derived "
29  "class")
30 
31  def branchexecext(self, allowaddcons):
32  '''executes branching rule for external branching candidates '''
33  raise NotImplementedError("branchexecext() is a fundamental callback and should be implemented in the derived class")
34 
35  def branchexecps(self, allowaddcons):
36  '''executes branching rule for not completely fixed pseudo solution '''
37  # this method needs to be implemented by the user
38  raise NotImplementedError("branchexecps() is a fundamental callback and should be implemented in the derived class")
39 
40 
41 
42 cdef SCIP_RETCODE PyBranchruleCopy (SCIP* scip, SCIP_BRANCHRULE* branchrule) noexcept with gil:
43  return SCIP_OKAY
44 
45 cdef SCIP_RETCODE PyBranchruleFree (SCIP* scip, SCIP_BRANCHRULE* branchrule) noexcept with gil:
46  cdef SCIP_BRANCHRULEDATA* branchruledata
47  branchruledata = SCIPbranchruleGetData(branchrule)
48  PyBranchrule = <Branchrule>branchruledata
49  PyBranchrule.branchfree()
50  Py_DECREF(PyBranchrule)
51  return SCIP_OKAY
52 
53 cdef SCIP_RETCODE PyBranchruleInit (SCIP* scip, SCIP_BRANCHRULE* branchrule) noexcept with gil:
54  cdef SCIP_BRANCHRULEDATA* branchruledata
55  branchruledata = SCIPbranchruleGetData(branchrule)
56  PyBranchrule = <Branchrule>branchruledata
57  PyBranchrule.branchinit()
58  return SCIP_OKAY
59 
60 cdef SCIP_RETCODE PyBranchruleExit (SCIP* scip, SCIP_BRANCHRULE* branchrule) noexcept with gil:
61  cdef SCIP_BRANCHRULEDATA* branchruledata
62  branchruledata = SCIPbranchruleGetData(branchrule)
63  PyBranchrule = <Branchrule>branchruledata
64  PyBranchrule.branchexit()
65  return SCIP_OKAY
66 
67 cdef SCIP_RETCODE PyBranchruleInitsol (SCIP* scip, SCIP_BRANCHRULE* branchrule) noexcept with gil:
68  cdef SCIP_BRANCHRULEDATA* branchruledata
69  branchruledata = SCIPbranchruleGetData(branchrule)
70  PyBranchrule = <Branchrule>branchruledata
71  PyBranchrule.branchinitsol()
72  return SCIP_OKAY
73 
74 cdef SCIP_RETCODE PyBranchruleExitsol (SCIP* scip, SCIP_BRANCHRULE* branchrule) noexcept with gil:
75  cdef SCIP_BRANCHRULEDATA* branchruledata
76  branchruledata = SCIPbranchruleGetData(branchrule)
77  PyBranchrule = <Branchrule>branchruledata
78  PyBranchrule.branchexitsol()
79  return SCIP_OKAY
80 
81 cdef SCIP_RETCODE PyBranchruleExeclp (SCIP* scip, SCIP_BRANCHRULE* branchrule, SCIP_Bool allowaddcons, SCIP_RESULT* result) noexcept with gil:
82  cdef SCIP_BRANCHRULEDATA* branchruledata
83  branchruledata = SCIPbranchruleGetData(branchrule)
84  PyBranchrule = <Branchrule>branchruledata
85  result_dict = PyBranchrule.branchexeclp(allowaddcons)
86  result[0] = result_dict.get("result", <SCIP_RESULT>result[0])
87  return SCIP_OKAY
88 
89 cdef SCIP_RETCODE PyBranchruleExecext(SCIP* scip, SCIP_BRANCHRULE* branchrule, SCIP_Bool allowaddcons, SCIP_RESULT* result) noexcept with gil:
90  cdef SCIP_BRANCHRULEDATA* branchruledata
91  branchruledata = SCIPbranchruleGetData(branchrule)
92  PyBranchrule = <Branchrule>branchruledata
93  result_dict = PyBranchrule.branchexecext(allowaddcons)
94  result[0] = result_dict.get("result", <SCIP_RESULT>result[0])
95  return SCIP_OKAY
96 
97 cdef SCIP_RETCODE PyBranchruleExecps(SCIP* scip, SCIP_BRANCHRULE* branchrule, SCIP_Bool allowaddcons, SCIP_RESULT* result) noexcept with gil:
98  cdef SCIP_BRANCHRULEDATA* branchruledata
99  branchruledata = SCIPbranchruleGetData(branchrule)
100  PyBranchrule = <Branchrule>branchruledata
101  result_dict = PyBranchrule.branchexecps(allowaddcons)
102  result[0] = result_dict.get("result", <SCIP_RESULT>result[0])
103  return SCIP_OKAY
pyscipopt.branchrule.branchexecext
def branchexecext(self, allowaddcons)
Definition: branchrule.pxi:31
pyscipopt.branchrule.branchexeclp
def branchexeclp(self, allowaddcons)
Definition: branchrule.pxi:26
pyscipopt.branchrule.branchexit
def branchexit(self)
Definition: branchrule.pxi:14
pyscipopt.branchrule.branchinitsol
def branchinitsol(self)
Definition: branchrule.pxi:18
SCIPbranchruleGetData
SCIP_BRANCHRULEDATA * SCIPbranchruleGetData(SCIP_BRANCHRULE *branchrule)
pyscipopt.branchrule.branchexecps
def branchexecps(self, allowaddcons)
Definition: branchrule.pxi:35
pyscipopt.branchrule.branchexitsol
def branchexitsol(self)
Definition: branchrule.pxi:22
pyscipopt.branchrule.branchinit
def branchinit(self)
Definition: branchrule.pxi:10
pyscipopt.branchrule.Branchrule
Definition: branchrule.pxi:3
pyscipopt.branchrule.branchfree
def branchfree(self)
Definition: branchrule.pxi:6