PySCIPOpt  5.1.1
Python Interface for the SCIP Optimization Suite
relax.pxi
Go to the documentation of this file.
1 
3 cdef class Relax:
4  cdef public Model model
5  cdef public str name
6 
7  def relaxfree(self):
8  '''calls destructor and frees memory of relaxation handler'''
9  pass
10 
11  def relaxinit(self):
12  '''initializes relaxation handler'''
13  pass
14 
15  def relaxexit(self):
16  '''calls exit method of relaxation handler'''
17  pass
18 
19  def relaxinitsol(self):
20  '''informs relaxaton handler that the branch and bound process is being started'''
21  pass
22 
23  def relaxexitsol(self):
24  '''informs relaxation handler that the branch and bound process data is being freed'''
25  pass
26 
27  def relaxexec(self):
28  '''callls execution method of relaxation handler'''
29  print("python error in relaxexec: this method needs to be implemented")
30  return{}
31 
32 
33 cdef SCIP_RETCODE PyRelaxCopy (SCIP* scip, SCIP_RELAX* relax) noexcept with gil:
34  return SCIP_OKAY
35 
36 cdef SCIP_RETCODE PyRelaxFree (SCIP* scip, SCIP_RELAX* relax) noexcept with gil:
37  cdef SCIP_RELAXDATA* relaxdata
38  relaxdata = SCIPrelaxGetData(relax)
39  PyRelax = <Relax>relaxdata
40  PyRelax.relaxfree()
41  Py_DECREF(PyRelax)
42  return SCIP_OKAY
43 
44 cdef SCIP_RETCODE PyRelaxInit (SCIP* scip, SCIP_RELAX* relax) noexcept with gil:
45  cdef SCIP_RELAXDATA* relaxdata
46  relaxdata = SCIPrelaxGetData(relax)
47  PyRelax = <Relax>relaxdata
48  PyRelax.relaxinit()
49  return SCIP_OKAY
50 
51 cdef SCIP_RETCODE PyRelaxExit (SCIP* scip, SCIP_RELAX* relax) noexcept with gil:
52  cdef SCIP_RELAXDATA* relaxdata
53  relaxdata = SCIPrelaxGetData(relax)
54  PyRelax = <Relax>relaxdata
55  PyRelax.relaxexit()
56  return SCIP_OKAY
57 
58 cdef SCIP_RETCODE PyRelaxInitsol (SCIP* scip, SCIP_RELAX* relax) noexcept with gil:
59  cdef SCIP_RELAXDATA* relaxdata
60  relaxdata = SCIPrelaxGetData(relax)
61  PyRelax = <Relax>relaxdata
62  PyRelax.relaxinitsol()
63  return SCIP_OKAY
64 
65 cdef SCIP_RETCODE PyRelaxExitsol (SCIP* scip, SCIP_RELAX* relax) noexcept with gil:
66  cdef SCIP_RELAXDATA* relaxdata
67  relaxdata = SCIPrelaxGetData(relax)
68  PyRelax = <Relax>relaxdata
69  PyRelax.relaxexitsol()
70  return SCIP_OKAY
71 
72 cdef SCIP_RETCODE PyRelaxExec (SCIP* scip, SCIP_RELAX* relax, SCIP_Real* lowerbound, SCIP_RESULT* result) noexcept with gil:
73  cdef SCIP_RELAXDATA* relaxdata
74  relaxdata = SCIPrelaxGetData(relax)
75  PyRelax = <Relax>relaxdata
76  result_dict = PyRelax.relaxexec()
77  assert isinstance(result_dict, dict), "relaxexec() must return a dictionary."
78  lowerbound[0] = result_dict.get("lowerbound", <SCIP_Real>lowerbound[0])
79  result[0] = result_dict.get("result", <SCIP_RESULT>result[0])
80  return SCIP_OKAY
pyscipopt.relax.relaxinitsol
def relaxinitsol(self)
Definition: relax.pxi:19
pyscipopt.relax.relaxfree
def relaxfree(self)
Definition: relax.pxi:7
pyscipopt.relax.relaxexitsol
def relaxexitsol(self)
Definition: relax.pxi:23
pyscipopt.relax.relaxexit
def relaxexit(self)
Definition: relax.pxi:15
pyscipopt.relax.Relax
Definition: relax.pxi:3
SCIPrelaxGetData
SCIP_RELAXDATA * SCIPrelaxGetData(SCIP_RELAX *relax)
pyscipopt.relax.relaxinit
def relaxinit(self)
Definition: relax.pxi:11
pyscipopt.relax.relaxexec
def relaxexec(self)
Definition: relax.pxi:27