PySCIPOpt
Python Interface to the SCIP Optimization Suite
relax.pxi
Go to the documentation of this file.
1 ##@file relax.pxi
2 #@brief Base class of the Relaxator Plugin
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):
34  return SCIP_OKAY
35 
36 cdef SCIP_RETCODE PyRelaxFree (SCIP* scip, SCIP_RELAX* relax):
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):
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):
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):
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):
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):
73  cdef SCIP_RELAXDATA* relaxdata
74  relaxdata = SCIPrelaxGetData(relax)
75  PyRelax = <Relax>relaxdata
76  PyRelax.relaxexec()
77  return SCIP_OKAY
78 
SCIP_RELAXDATA * SCIPrelaxGetData(SCIP_RELAX *relax)