forked from scipopt/PySCIPOpt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpricer.pxi
82 lines (65 loc) · 2.49 KB
/
pricer.pxi
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
cdef class Pricer:
cdef public Model model
def pricerfree(self):
pass
def pricerinit(self):
pass
def pricerexit(self):
pass
def pricerinitsol(self):
pass
def pricerexitsol(self):
pass
def pricerredcost(self):
print("python error in pricerredcost: this method needs to be implemented")
return {}
def pricerfarkas(self):
return {}
cdef SCIP_RETCODE PyPricerCopy (SCIP* scip, SCIP_PRICER* pricer, SCIP_Bool* valid):
return SCIP_OKAY
cdef SCIP_RETCODE PyPricerFree (SCIP* scip, SCIP_PRICER* pricer):
cdef SCIP_PRICERDATA* pricerdata
pricerdata = SCIPpricerGetData(pricer)
PyPricer = <Pricer>pricerdata
PyPricer.pricerfree()
Py_DECREF(PyPricer)
return SCIP_OKAY
cdef SCIP_RETCODE PyPricerInit (SCIP* scip, SCIP_PRICER* pricer):
cdef SCIP_PRICERDATA* pricerdata
pricerdata = SCIPpricerGetData(pricer)
PyPricer = <Pricer>pricerdata
PyPricer.pricerinit()
return SCIP_OKAY
cdef SCIP_RETCODE PyPricerExit (SCIP* scip, SCIP_PRICER* pricer):
cdef SCIP_PRICERDATA* pricerdata
pricerdata = SCIPpricerGetData(pricer)
PyPricer = <Pricer>pricerdata
PyPricer.pricerexit()
return SCIP_OKAY
cdef SCIP_RETCODE PyPricerInitsol (SCIP* scip, SCIP_PRICER* pricer):
cdef SCIP_PRICERDATA* pricerdata
pricerdata = SCIPpricerGetData(pricer)
PyPricer = <Pricer>pricerdata
PyPricer.pricerinitsol()
return SCIP_OKAY
cdef SCIP_RETCODE PyPricerExitsol (SCIP* scip, SCIP_PRICER* pricer):
cdef SCIP_PRICERDATA* pricerdata
pricerdata = SCIPpricerGetData(pricer)
PyPricer = <Pricer>pricerdata
PyPricer.pricerexitsol()
return SCIP_OKAY
cdef SCIP_RETCODE PyPricerRedcost (SCIP* scip, SCIP_PRICER* pricer, SCIP_Real* lowerbound, SCIP_Bool* stopearly, SCIP_RESULT* result):
cdef SCIP_PRICERDATA* pricerdata
pricerdata = SCIPpricerGetData(pricer)
PyPricer = <Pricer>pricerdata
result_dict = PyPricer.pricerredcost()
result[0] = result_dict.get("result", <SCIP_RESULT>result[0])
lowerbound[0] = result_dict.get("lowerbound", <SCIP_Real>lowerbound[0])
stopearly[0] = result_dict.get("stopearly", <SCIP_Bool>stopearly[0])
return SCIP_OKAY
cdef SCIP_RETCODE PyPricerFarkas (SCIP* scip, SCIP_PRICER* pricer, SCIP_RESULT* result):
cdef SCIP_PRICERDATA* pricerdata
pricerdata = SCIPpricerGetData(pricer)
PyPricer = <Pricer>pricerdata
result[0] = PyPricer.pricerfarkas().get("result", <SCIP_RESULT>result[0])
return SCIP_OKAY