4 cdef public Model model
8 '''calls destructor and frees memory of reader'''
12 '''calls read method of reader'''
15 def readerwrite(self, file, name, transformed, objsense, objscale, objoffset, binvars, intvars,
16 implvars, contvars, fixedvars, startnvars, conss, maxnconss, startnconss, genericnames):
17 '''calls write method of reader'''
21 cdef SCIP_RETCODE PyReaderCopy (SCIP* scip, SCIP_READER* reader) noexcept
with gil:
24 cdef SCIP_RETCODE PyReaderFree (SCIP* scip, SCIP_READER* reader) noexcept
with gil:
25 cdef SCIP_READERDATA* readerdata
27 PyReader = <Reader>readerdata
32 cdef SCIP_RETCODE PyReaderRead (SCIP* scip, SCIP_READER* reader, const char* filename, SCIP_RESULT* result) noexcept
with gil:
33 cdef SCIP_READERDATA* readerdata
35 PyReader = <Reader>readerdata
36 PyFilename = filename.decode(
'utf-8')
37 result_dict = PyReader.readerread(PyFilename)
38 result[0] = result_dict.get(
"result", <SCIP_RESULT>result[0])
41 cdef SCIP_RETCODE PyReaderWrite (SCIP* scip, SCIP_READER* reader, FILE* file,
42 const char* name, SCIP_PROBDATA* probdata, SCIP_Bool transformed,
43 SCIP_OBJSENSE objsense, SCIP_Real objscale, SCIP_Real objoffset,
44 SCIP_VAR** vars, int nvars, int nbinvars, int nintvars, int nimplvars, int ncontvars,
45 SCIP_VAR** fixedvars, int nfixedvars, int startnvars,
46 SCIP_CONS** conss, int nconss, int maxnconss, int startnconss,
47 SCIP_Bool genericnames, SCIP_RESULT* result) noexcept
with gil:
48 cdef SCIP_READERDATA* readerdata
50 cdef int fd = fileno(file)
51 PyFile = os.fdopen(fd,
"w", closefd=
False)
52 PyName = name.decode(
'utf-8')
53 PyBinVars = [Variable.create(vars[i])
for i
in range(nbinvars)]
54 PyIntVars = [Variable.create(vars[i])
for i
in range(nbinvars, nintvars)]
55 PyImplVars = [Variable.create(vars[i])
for i
in range(nintvars, nimplvars)]
56 PyContVars = [Variable.create(vars[i])
for i
in range(nimplvars, ncontvars)]
57 PyFixedVars = [Variable.create(fixedvars[i])
for i
in range(nfixedvars)]
58 PyConss = [Constraint.create(conss[i])
for i
in range(nconss)]
59 PyReader = <Reader>readerdata
60 result_dict = PyReader.readerwrite(PyFile, PyName, transformed, objsense, objscale, objoffset,
61 PyBinVars, PyIntVars, PyImplVars, PyContVars, PyFixedVars, startnvars,
62 PyConss, maxnconss, startnconss, genericnames)
63 result[0] = result_dict.get(
"result", <SCIP_RESULT>result[0])