Skip to content

Commit

Permalink
Reformat variable declarations
Browse files Browse the repository at this point in the history
  • Loading branch information
DominikKamp committed Feb 1, 2025
1 parent d81eb69 commit a9261a5
Show file tree
Hide file tree
Showing 6 changed files with 74 additions and 98 deletions.
4 changes: 1 addition & 3 deletions src/pyscipopt/benders.pxi
Original file line number Diff line number Diff line change
Expand Up @@ -175,10 +175,8 @@ cdef SCIP_RETCODE PyBendersSolvesub (SCIP* scip, SCIP_BENDERS* benders, SCIP_SOL
cdef SCIP_RETCODE PyBendersPostsolve (SCIP* scip, SCIP_BENDERS* benders, SCIP_SOL* sol,
SCIP_BENDERSENFOTYPE type, int* mergecands, int npriomergecands, int nmergecands, SCIP_Bool checkint,
SCIP_Bool infeasible, SCIP_Bool* merged) noexcept with gil:
cdef SCIP_BENDERSDATA* bendersdata
cdef SCIP_BENDERSDATA* bendersdata = SCIPbendersGetData(benders)
cdef int i

bendersdata = SCIPbendersGetData(benders)
PyBenders = <Benders>bendersdata
if sol == NULL:
solution = None
Expand Down
50 changes: 17 additions & 33 deletions src/pyscipopt/conshdlr.pxi
Original file line number Diff line number Diff line change
Expand Up @@ -168,60 +168,54 @@ cdef SCIP_RETCODE PyConsFree (SCIP* scip, SCIP_CONSHDLR* conshdlr) noexcept with
return SCIP_OKAY

cdef SCIP_RETCODE PyConsInit (SCIP* scip, SCIP_CONSHDLR* conshdlr, SCIP_CONS** conss, int nconss) noexcept with gil:
PyConshdlr = getPyConshdlr(conshdlr)
cdef int i

cdef constraints = []
PyConshdlr = getPyConshdlr(conshdlr)
constraints = []
for i in range(nconss):
constraints.append(getPyCons(conss[i]))
PyConshdlr.consinit(constraints)
return SCIP_OKAY

cdef SCIP_RETCODE PyConsExit (SCIP* scip, SCIP_CONSHDLR* conshdlr, SCIP_CONS** conss, int nconss) noexcept with gil:
cdef int i

PyConshdlr = getPyConshdlr(conshdlr)
cdef constraints = []
constraints = []
for i in range(nconss):
constraints.append(getPyCons(conss[i]))
PyConshdlr.consexit(constraints)
return SCIP_OKAY

cdef SCIP_RETCODE PyConsInitpre (SCIP* scip, SCIP_CONSHDLR* conshdlr, SCIP_CONS** conss, int nconss) noexcept with gil:
cdef int i

PyConshdlr = getPyConshdlr(conshdlr)
cdef constraints = []
constraints = []
for i in range(nconss):
constraints.append(getPyCons(conss[i]))
PyConshdlr.consinitpre(constraints)
return SCIP_OKAY

cdef SCIP_RETCODE PyConsExitpre (SCIP* scip, SCIP_CONSHDLR* conshdlr, SCIP_CONS** conss, int nconss) noexcept with gil:
cdef int i

PyConshdlr = getPyConshdlr(conshdlr)
cdef constraints = []
constraints = []
for i in range(nconss):
constraints.append(getPyCons(conss[i]))
PyConshdlr.consexitpre(constraints)
return SCIP_OKAY

cdef SCIP_RETCODE PyConsInitsol (SCIP* scip, SCIP_CONSHDLR* conshdlr, SCIP_CONS** conss, int nconss) noexcept with gil:
cdef int i

PyConshdlr = getPyConshdlr(conshdlr)
cdef constraints = []
constraints = []
for i in range(nconss):
constraints.append(getPyCons(conss[i]))
PyConshdlr.consinitsol(constraints)
return SCIP_OKAY

cdef SCIP_RETCODE PyConsExitsol (SCIP* scip, SCIP_CONSHDLR* conshdlr, SCIP_CONS** conss, int nconss, SCIP_Bool restart) noexcept with gil:
cdef int i

PyConshdlr = getPyConshdlr(conshdlr)
cdef constraints = []
constraints = []
for i in range(nconss):
constraints.append(getPyCons(conss[i]))
PyConshdlr.consexitsol(constraints, restart)
Expand Down Expand Up @@ -257,9 +251,8 @@ cdef SCIP_RETCODE PyConsTrans (SCIP* scip, SCIP_CONSHDLR* conshdlr, SCIP_CONS* s

cdef SCIP_RETCODE PyConsInitlp (SCIP* scip, SCIP_CONSHDLR* conshdlr, SCIP_CONS** conss, int nconss, SCIP_Bool* infeasible) noexcept with gil:
cdef int i

PyConshdlr = getPyConshdlr(conshdlr)
cdef constraints = []
constraints = []
for i in range(nconss):
constraints.append(getPyCons(conss[i]))
result_dict = PyConshdlr.consinitlp(constraints)
Expand All @@ -268,9 +261,8 @@ cdef SCIP_RETCODE PyConsInitlp (SCIP* scip, SCIP_CONSHDLR* conshdlr, SCIP_CONS**

cdef SCIP_RETCODE PyConsSepalp (SCIP* scip, SCIP_CONSHDLR* conshdlr, SCIP_CONS** conss, int nconss, int nusefulconss, SCIP_RESULT* result) noexcept with gil:
cdef int i

PyConshdlr = getPyConshdlr(conshdlr)
cdef constraints = []
constraints = []
for i in range(nconss):
constraints.append(getPyCons(conss[i]))
result_dict = PyConshdlr.conssepalp(constraints, nusefulconss)
Expand All @@ -280,9 +272,8 @@ cdef SCIP_RETCODE PyConsSepalp (SCIP* scip, SCIP_CONSHDLR* conshdlr, SCIP_CONS**
cdef SCIP_RETCODE PyConsSepasol (SCIP* scip, SCIP_CONSHDLR* conshdlr, SCIP_CONS** conss, int nconss, int nusefulconss,
SCIP_SOL* sol, SCIP_RESULT* result) noexcept with gil:
cdef int i

PyConshdlr = getPyConshdlr(conshdlr)
cdef constraints = []
constraints = []
for i in range(nconss):
constraints.append(getPyCons(conss[i]))
solution = Solution.create(scip, sol)
Expand All @@ -293,9 +284,8 @@ cdef SCIP_RETCODE PyConsSepasol (SCIP* scip, SCIP_CONSHDLR* conshdlr, SCIP_CONS*
cdef SCIP_RETCODE PyConsEnfolp (SCIP* scip, SCIP_CONSHDLR* conshdlr, SCIP_CONS** conss, int nconss, int nusefulconss,
SCIP_Bool solinfeasible, SCIP_RESULT* result) noexcept with gil:
cdef int i

PyConshdlr = getPyConshdlr(conshdlr)
cdef constraints = []
constraints = []
for i in range(nconss):
constraints.append(getPyCons(conss[i]))
result_dict = PyConshdlr.consenfolp(constraints, nusefulconss, solinfeasible)
Expand All @@ -304,9 +294,8 @@ cdef SCIP_RETCODE PyConsEnfolp (SCIP* scip, SCIP_CONSHDLR* conshdlr, SCIP_CONS**

cdef SCIP_RETCODE PyConsEnforelax (SCIP* scip, SCIP_SOL* sol, SCIP_CONSHDLR* conshdlr, SCIP_CONS** conss, int nconss, int nusefulconss, SCIP_Bool solinfeasible, SCIP_RESULT* result) noexcept with gil:
cdef int i

PyConshdlr = getPyConshdlr(conshdlr)
cdef constraints = []
constraints = []
for i in range(nconss):
constraints.append(getPyCons(conss[i]))
solution = Solution.create(scip, sol)
Expand All @@ -317,9 +306,8 @@ cdef SCIP_RETCODE PyConsEnforelax (SCIP* scip, SCIP_SOL* sol, SCIP_CONSHDLR* con
cdef SCIP_RETCODE PyConsEnfops (SCIP* scip, SCIP_CONSHDLR* conshdlr, SCIP_CONS** conss, int nconss, int nusefulconss,
SCIP_Bool solinfeasible, SCIP_Bool objinfeasible, SCIP_RESULT* result) noexcept with gil:
cdef int i

PyConshdlr = getPyConshdlr(conshdlr)
cdef constraints = []
constraints = []
for i in range(nconss):
constraints.append(getPyCons(conss[i]))
result_dict = PyConshdlr.consenfops(constraints, nusefulconss, solinfeasible, objinfeasible)
Expand All @@ -329,9 +317,8 @@ cdef SCIP_RETCODE PyConsEnfops (SCIP* scip, SCIP_CONSHDLR* conshdlr, SCIP_CONS**
cdef SCIP_RETCODE PyConsCheck (SCIP* scip, SCIP_CONSHDLR* conshdlr, SCIP_CONS** conss, int nconss, SCIP_SOL* sol, SCIP_Bool checkintegrality,
SCIP_Bool checklprows, SCIP_Bool printreason, SCIP_Bool completely, SCIP_RESULT* result) noexcept with gil:
cdef int i

PyConshdlr = getPyConshdlr(conshdlr)
cdef constraints = []
constraints = []
for i in range(nconss):
constraints.append(getPyCons(conss[i]))
solution = Solution.create(scip, sol)
Expand All @@ -342,9 +329,8 @@ cdef SCIP_RETCODE PyConsCheck (SCIP* scip, SCIP_CONSHDLR* conshdlr, SCIP_CONS**
cdef SCIP_RETCODE PyConsProp (SCIP* scip, SCIP_CONSHDLR* conshdlr, SCIP_CONS** conss, int nconss, int nusefulconss, int nmarkedconss,
SCIP_PROPTIMING proptiming, SCIP_RESULT* result) noexcept with gil:
cdef int i

PyConshdlr = getPyConshdlr(conshdlr)
cdef constraints = []
constraints = []
for i in range(nconss):
constraints.append(getPyCons(conss[i]))
result_dict = PyConshdlr.consprop(constraints, nusefulconss, nmarkedconss, proptiming)
Expand All @@ -357,9 +343,8 @@ cdef SCIP_RETCODE PyConsPresol (SCIP* scip, SCIP_CONSHDLR* conshdlr, SCIP_CONS**
int* nfixedvars, int* naggrvars, int* nchgvartypes, int* nchgbds, int* naddholes,
int* ndelconss, int* naddconss, int* nupgdconss, int* nchgcoefs, int* nchgsides, SCIP_RESULT* result) noexcept with gil:
cdef int i

PyConshdlr = getPyConshdlr(conshdlr)
cdef constraints = []
constraints = []
for i in range(nconss):
constraints.append(getPyCons(conss[i]))
# dictionary for input/output parameters
Expand Down Expand Up @@ -432,9 +417,8 @@ cdef SCIP_RETCODE PyConsDisable (SCIP* scip, SCIP_CONSHDLR* conshdlr, SCIP_CONS*

cdef SCIP_RETCODE PyConsDelvars (SCIP* scip, SCIP_CONSHDLR* conshdlr, SCIP_CONS** conss, int nconss) noexcept with gil:
cdef int i

PyConshdlr = getPyConshdlr(conshdlr)
cdef constraints = []
constraints = []
for i in range(nconss):
constraints.append(getPyCons(conss[i]))
PyConshdlr.consdelvars(constraints)
Expand Down
5 changes: 2 additions & 3 deletions src/pyscipopt/cutsel.pxi
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,10 @@ cdef SCIP_RETCODE PyCutselExitsol (SCIP* scip, SCIP_CUTSEL* cutsel) noexcept wit
cdef SCIP_RETCODE PyCutselSelect (SCIP* scip, SCIP_CUTSEL* cutsel, SCIP_ROW** cuts, int ncuts,
SCIP_ROW** forcedcuts, int nforcedcuts, SCIP_Bool root, int maxnselectedcuts,
int* nselectedcuts, SCIP_RESULT* result) noexcept with gil:
cdef SCIP_CUTSELDATA* cutseldata
cdef SCIP_CUTSELDATA* cutseldata = SCIPcutselGetData(cutsel)
cdef SCIP_ROW* scip_row
cdef int i

cutseldata = SCIPcutselGetData(cutsel)

PyCutsel = <Cutsel>cutseldata

# translate cuts to python
Expand Down
Loading

0 comments on commit a9261a5

Please sign in to comment.