PySCIPOpt
Python Interface to the SCIP Optimization Suite
pricer.pxi
Go to the documentation of this file.
1 ##@file pricer.pxi
2 #@brief Base class of the Pricers Plugin
3 cdef class Pricer:
4  cdef public Model model
5 
6  def pricerfree(self):
7  '''calls destructor and frees memory of variable pricer '''
8  pass
9 
10  def pricerinit(self):
11  '''initializes variable pricer'''
12  pass
13 
14  def pricerexit(self):
15  '''calls exit method of variable pricer'''
16  pass
17 
18  def pricerinitsol(self):
19  '''informs variable pricer that the branch and bound process is being started '''
20  pass
21 
22  def pricerexitsol(self):
23  '''informs variable pricer that the branch and bound process data is being freed'''
24  pass
25 
26  def pricerredcost(self):
27  '''calls reduced cost pricing method of variable pricer'''
28  print("python error in pricerredcost: this method needs to be implemented")
29  return {}
30 
31  def pricerfarkas(self):
32  '''calls Farkas pricing method of variable pricer'''
33  return {}
34 
35 
36 
37 cdef SCIP_RETCODE PyPricerCopy (SCIP* scip, SCIP_PRICER* pricer, SCIP_Bool* valid):
38  return SCIP_OKAY
39 
40 cdef SCIP_RETCODE PyPricerFree (SCIP* scip, SCIP_PRICER* pricer):
41  cdef SCIP_PRICERDATA* pricerdata
42  pricerdata = SCIPpricerGetData(pricer)
43  PyPricer = <Pricer>pricerdata
44  PyPricer.pricerfree()
45  Py_DECREF(PyPricer)
46  return SCIP_OKAY
47 
48 cdef SCIP_RETCODE PyPricerInit (SCIP* scip, SCIP_PRICER* pricer):
49  cdef SCIP_PRICERDATA* pricerdata
50  pricerdata = SCIPpricerGetData(pricer)
51  PyPricer = <Pricer>pricerdata
52  PyPricer.pricerinit()
53  return SCIP_OKAY
54 
55 cdef SCIP_RETCODE PyPricerExit (SCIP* scip, SCIP_PRICER* pricer):
56  cdef SCIP_PRICERDATA* pricerdata
57  pricerdata = SCIPpricerGetData(pricer)
58  PyPricer = <Pricer>pricerdata
59  PyPricer.pricerexit()
60  return SCIP_OKAY
61 
62 cdef SCIP_RETCODE PyPricerInitsol (SCIP* scip, SCIP_PRICER* pricer):
63  cdef SCIP_PRICERDATA* pricerdata
64  pricerdata = SCIPpricerGetData(pricer)
65  PyPricer = <Pricer>pricerdata
66  PyPricer.pricerinitsol()
67  return SCIP_OKAY
68 
69 cdef SCIP_RETCODE PyPricerExitsol (SCIP* scip, SCIP_PRICER* pricer):
70  cdef SCIP_PRICERDATA* pricerdata
71  pricerdata = SCIPpricerGetData(pricer)
72  PyPricer = <Pricer>pricerdata
73  PyPricer.pricerexitsol()
74  return SCIP_OKAY
75 
76 cdef SCIP_RETCODE PyPricerRedcost (SCIP* scip, SCIP_PRICER* pricer, SCIP_Real* lowerbound, SCIP_Bool* stopearly, SCIP_RESULT* result):
77  cdef SCIP_PRICERDATA* pricerdata
78  pricerdata = SCIPpricerGetData(pricer)
79  PyPricer = <Pricer>pricerdata
80  result_dict = PyPricer.pricerredcost()
81  result[0] = result_dict.get("result", <SCIP_RESULT>result[0])
82  lowerbound[0] = result_dict.get("lowerbound", <SCIP_Real>lowerbound[0])
83  stopearly[0] = result_dict.get("stopearly", <SCIP_Bool>stopearly[0])
84  return SCIP_OKAY
85 
86 cdef SCIP_RETCODE PyPricerFarkas (SCIP* scip, SCIP_PRICER* pricer, SCIP_RESULT* result):
87  cdef SCIP_PRICERDATA* pricerdata
88  pricerdata = SCIPpricerGetData(pricer)
89  PyPricer = <Pricer>pricerdata
90  result[0] = PyPricer.pricerfarkas().get("result", <SCIP_RESULT>result[0])
91  return SCIP_OKAY
SCIP_PRICERDATA * SCIPpricerGetData(SCIP_PRICER *pricer)