PySCIPOpt  5.1.1
Python Interface for the SCIP Optimization Suite
presol.pxi
Go to the documentation of this file.
1 
3 cdef class Presol:
4  cdef public Model model
5 
6  def presolfree(self):
7  '''frees memory of presolver'''
8  pass
9 
10  def presolinit(self):
11  '''initializes presolver'''
12  pass
13 
14  def presolexit(self):
15  '''deinitializes presolver'''
16  pass
17 
18  def presolinitpre(self):
19  '''informs presolver that the presolving process is being started'''
20  pass
21 
22  def presolexitpre(self):
23  '''informs presolver that the presolving process is finished'''
24  pass
25 
26  def presolexec(self, nrounds, presoltiming):
27  '''executes presolver'''
28  print("python error in presolexec: this method needs to be implemented")
29  return {}
30 
31 
32 
33 cdef SCIP_RETCODE PyPresolCopy (SCIP* scip, SCIP_PRESOL* presol) noexcept with gil:
34  return SCIP_OKAY
35 
36 cdef SCIP_RETCODE PyPresolFree (SCIP* scip, SCIP_PRESOL* presol) noexcept with gil:
37  cdef SCIP_PRESOLDATA* presoldata
38  presoldata = SCIPpresolGetData(presol)
39  PyPresol = <Presol>presoldata
40  PyPresol.presolfree()
41  Py_DECREF(PyPresol)
42  return SCIP_OKAY
43 
44 cdef SCIP_RETCODE PyPresolInit (SCIP* scip, SCIP_PRESOL* presol) noexcept with gil:
45  cdef SCIP_PRESOLDATA* presoldata
46  presoldata = SCIPpresolGetData(presol)
47  PyPresol = <Presol>presoldata
48  PyPresol.presolinit()
49  return SCIP_OKAY
50 
51 cdef SCIP_RETCODE PyPresolExit (SCIP* scip, SCIP_PRESOL* presol) noexcept with gil:
52  cdef SCIP_PRESOLDATA* presoldata
53  presoldata = SCIPpresolGetData(presol)
54  PyPresol = <Presol>presoldata
55  PyPresol.presolexit()
56  return SCIP_OKAY
57 
58 
59 cdef SCIP_RETCODE PyPresolInitpre (SCIP* scip, SCIP_PRESOL* presol) noexcept with gil:
60  cdef SCIP_PRESOLDATA* presoldata
61  presoldata = SCIPpresolGetData(presol)
62  PyPresol = <Presol>presoldata
63  PyPresol.presolinitpre()
64  return SCIP_OKAY
65 
66 cdef SCIP_RETCODE PyPresolExitpre (SCIP* scip, SCIP_PRESOL* presol) noexcept with gil:
67  cdef SCIP_PRESOLDATA* presoldata
68  presoldata = SCIPpresolGetData(presol)
69  PyPresol = <Presol>presoldata
70  PyPresol.presolexitpre()
71  return SCIP_OKAY
72 
73 cdef SCIP_RETCODE PyPresolExec (SCIP* scip, SCIP_PRESOL* presol, int nrounds, SCIP_PRESOLTIMING presoltiming,
74  int nnewfixedvars, int nnewaggrvars, int nnewchgvartypes, int nnewchgbds, int nnewholes,
75  int nnewdelconss, int nnewaddconss, int nnewupgdconss, int nnewchgcoefs, int nnewchgsides,
76  int* nfixedvars, int* naggrvars, int* nchgvartypes, int* nchgbds, int* naddholes,
77  int* ndelconss, int* naddconss, int* nupgdconss, int* nchgcoefs, int* nchgsides, SCIP_RESULT* result) noexcept with gil:
78  cdef SCIP_PRESOLDATA* presoldata
79  presoldata = SCIPpresolGetData(presol)
80  PyPresol = <Presol>presoldata
81  result_dict = PyPresol.presolexec(nrounds, presoltiming)
82  result[0] = result_dict.get("result", <SCIP_RESULT>result[0])
83  nfixedvars[0] += result_dict.get("nnewfixedvars", 0)
84  naggrvars[0] += result_dict.get("nnewaggrvars", 0)
85  nchgvartypes[0] += result_dict.get("nnewchgvartypes", 0)
86  nchgbds[0] += result_dict.get("nnewchgbds", 0)
87  naddholes[0] += result_dict.get("nnewaddholes", 0)
88  ndelconss[0] += result_dict.get("nnewdelconss", 0)
89  naddconss[0] += result_dict.get("nnewaddconss", 0)
90  nupgdconss[0] += result_dict.get("nnewupgdconss", 0)
91  nchgcoefs[0] += result_dict.get("nnewchgcoefs", 0)
92  nchgsides[0] += result_dict.get("nnewchgsides", 0)
93  return SCIP_OKAY
SCIPpresolGetData
SCIP_PRESOLDATA * SCIPpresolGetData(SCIP_PRESOL *presol)
pyscipopt.presol.Presol.presolexec
def presolexec(self, nrounds, presoltiming)
Definition: presol.pxi:26
pyscipopt.presol.Presol.presolexit
def presolexit(self)
Definition: presol.pxi:14
pyscipopt.presol.Presol.presolexitpre
def presolexitpre(self)
Definition: presol.pxi:22
pyscipopt.presol.Presol.presolinitpre
def presolinitpre(self)
Definition: presol.pxi:18
pyscipopt.presol.Presol.presolinit
def presolinit(self)
Definition: presol.pxi:10
pyscipopt.presol.Presol
Definition: presol.pxi:3
pyscipopt.presol.Presol.presolfree
def presolfree(self)
Definition: presol.pxi:6