Skip to content

Commit 0aff74b

Browse files
committed
Also on conshdlr, even though it looks ugly
1 parent 3cea4a6 commit 0aff74b

File tree

1 file changed

+32
-16
lines changed

1 file changed

+32
-16
lines changed

src/pyscipopt/conshdlr.pxi

Lines changed: 32 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -168,54 +168,60 @@ cdef SCIP_RETCODE PyConsFree (SCIP* scip, SCIP_CONSHDLR* conshdlr) noexcept with
168168
return SCIP_OKAY
169169

170170
cdef SCIP_RETCODE PyConsInit (SCIP* scip, SCIP_CONSHDLR* conshdlr, SCIP_CONS** conss, int nconss) noexcept with gil:
171-
PyConshdlr = getPyConshdlr(conshdlr)
172171
cdef int i
172+
173+
PyConshdlr = getPyConshdlr(conshdlr)
173174
cdef constraints = []
174175
for i in range(nconss):
175176
constraints.append(getPyCons(conss[i]))
176177
PyConshdlr.consinit(constraints)
177178
return SCIP_OKAY
178179

179180
cdef SCIP_RETCODE PyConsExit (SCIP* scip, SCIP_CONSHDLR* conshdlr, SCIP_CONS** conss, int nconss) noexcept with gil:
181+
cdef int i
182+
180183
PyConshdlr = getPyConshdlr(conshdlr)
181184
cdef constraints = []
182-
cdef int i
183185
for i in range(nconss):
184186
constraints.append(getPyCons(conss[i]))
185187
PyConshdlr.consexit(constraints)
186188
return SCIP_OKAY
187189

188190
cdef SCIP_RETCODE PyConsInitpre (SCIP* scip, SCIP_CONSHDLR* conshdlr, SCIP_CONS** conss, int nconss) noexcept with gil:
191+
cdef int i
192+
189193
PyConshdlr = getPyConshdlr(conshdlr)
190194
cdef constraints = []
191-
cdef int i
192195
for i in range(nconss):
193196
constraints.append(getPyCons(conss[i]))
194197
PyConshdlr.consinitpre(constraints)
195198
return SCIP_OKAY
196199

197200
cdef SCIP_RETCODE PyConsExitpre (SCIP* scip, SCIP_CONSHDLR* conshdlr, SCIP_CONS** conss, int nconss) noexcept with gil:
201+
cdef int i
202+
198203
PyConshdlr = getPyConshdlr(conshdlr)
199204
cdef constraints = []
200-
cdef int i
201205
for i in range(nconss):
202206
constraints.append(getPyCons(conss[i]))
203207
PyConshdlr.consexitpre(constraints)
204208
return SCIP_OKAY
205209

206210
cdef SCIP_RETCODE PyConsInitsol (SCIP* scip, SCIP_CONSHDLR* conshdlr, SCIP_CONS** conss, int nconss) noexcept with gil:
211+
cdef int i
212+
207213
PyConshdlr = getPyConshdlr(conshdlr)
208214
cdef constraints = []
209-
cdef int i
210215
for i in range(nconss):
211216
constraints.append(getPyCons(conss[i]))
212217
PyConshdlr.consinitsol(constraints)
213218
return SCIP_OKAY
214219

215220
cdef SCIP_RETCODE PyConsExitsol (SCIP* scip, SCIP_CONSHDLR* conshdlr, SCIP_CONS** conss, int nconss, SCIP_Bool restart) noexcept with gil:
221+
cdef int i
222+
216223
PyConshdlr = getPyConshdlr(conshdlr)
217224
cdef constraints = []
218-
cdef int i
219225
for i in range(nconss):
220226
constraints.append(getPyCons(conss[i]))
221227
PyConshdlr.consexitsol(constraints, restart)
@@ -250,19 +256,21 @@ cdef SCIP_RETCODE PyConsTrans (SCIP* scip, SCIP_CONSHDLR* conshdlr, SCIP_CONS* s
250256
return SCIP_OKAY
251257

252258
cdef SCIP_RETCODE PyConsInitlp (SCIP* scip, SCIP_CONSHDLR* conshdlr, SCIP_CONS** conss, int nconss, SCIP_Bool* infeasible) noexcept with gil:
259+
cdef int i
260+
253261
PyConshdlr = getPyConshdlr(conshdlr)
254262
cdef constraints = []
255-
cdef int i
256263
for i in range(nconss):
257264
constraints.append(getPyCons(conss[i]))
258265
result_dict = PyConshdlr.consinitlp(constraints)
259266
infeasible[0] = result_dict.get("infeasible", infeasible[0])
260267
return SCIP_OKAY
261268

262269
cdef SCIP_RETCODE PyConsSepalp (SCIP* scip, SCIP_CONSHDLR* conshdlr, SCIP_CONS** conss, int nconss, int nusefulconss, SCIP_RESULT* result) noexcept with gil:
270+
cdef int i
271+
263272
PyConshdlr = getPyConshdlr(conshdlr)
264273
cdef constraints = []
265-
cdef int i
266274
for i in range(nconss):
267275
constraints.append(getPyCons(conss[i]))
268276
result_dict = PyConshdlr.conssepalp(constraints, nusefulconss)
@@ -271,9 +279,10 @@ cdef SCIP_RETCODE PyConsSepalp (SCIP* scip, SCIP_CONSHDLR* conshdlr, SCIP_CONS**
271279

272280
cdef SCIP_RETCODE PyConsSepasol (SCIP* scip, SCIP_CONSHDLR* conshdlr, SCIP_CONS** conss, int nconss, int nusefulconss,
273281
SCIP_SOL* sol, SCIP_RESULT* result) noexcept with gil:
282+
cdef int i
283+
274284
PyConshdlr = getPyConshdlr(conshdlr)
275285
cdef constraints = []
276-
cdef int i
277286
for i in range(nconss):
278287
constraints.append(getPyCons(conss[i]))
279288
solution = Solution.create(scip, sol)
@@ -283,19 +292,21 @@ cdef SCIP_RETCODE PyConsSepasol (SCIP* scip, SCIP_CONSHDLR* conshdlr, SCIP_CONS*
283292

284293
cdef SCIP_RETCODE PyConsEnfolp (SCIP* scip, SCIP_CONSHDLR* conshdlr, SCIP_CONS** conss, int nconss, int nusefulconss,
285294
SCIP_Bool solinfeasible, SCIP_RESULT* result) noexcept with gil:
295+
cdef int i
296+
286297
PyConshdlr = getPyConshdlr(conshdlr)
287298
cdef constraints = []
288-
cdef int i
289299
for i in range(nconss):
290300
constraints.append(getPyCons(conss[i]))
291301
result_dict = PyConshdlr.consenfolp(constraints, nusefulconss, solinfeasible)
292302
result[0] = result_dict.get("result", <SCIP_RESULT>result[0])
293303
return SCIP_OKAY
294304

295305
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:
306+
cdef int i
307+
296308
PyConshdlr = getPyConshdlr(conshdlr)
297309
cdef constraints = []
298-
cdef int i
299310
for i in range(nconss):
300311
constraints.append(getPyCons(conss[i]))
301312
solution = Solution.create(scip, sol)
@@ -305,9 +316,10 @@ cdef SCIP_RETCODE PyConsEnforelax (SCIP* scip, SCIP_SOL* sol, SCIP_CONSHDLR* con
305316

306317
cdef SCIP_RETCODE PyConsEnfops (SCIP* scip, SCIP_CONSHDLR* conshdlr, SCIP_CONS** conss, int nconss, int nusefulconss,
307318
SCIP_Bool solinfeasible, SCIP_Bool objinfeasible, SCIP_RESULT* result) noexcept with gil:
319+
cdef int i
320+
308321
PyConshdlr = getPyConshdlr(conshdlr)
309322
cdef constraints = []
310-
cdef int i
311323
for i in range(nconss):
312324
constraints.append(getPyCons(conss[i]))
313325
result_dict = PyConshdlr.consenfops(constraints, nusefulconss, solinfeasible, objinfeasible)
@@ -316,9 +328,10 @@ cdef SCIP_RETCODE PyConsEnfops (SCIP* scip, SCIP_CONSHDLR* conshdlr, SCIP_CONS**
316328

317329
cdef SCIP_RETCODE PyConsCheck (SCIP* scip, SCIP_CONSHDLR* conshdlr, SCIP_CONS** conss, int nconss, SCIP_SOL* sol, SCIP_Bool checkintegrality,
318330
SCIP_Bool checklprows, SCIP_Bool printreason, SCIP_Bool completely, SCIP_RESULT* result) noexcept with gil:
331+
cdef int i
332+
319333
PyConshdlr = getPyConshdlr(conshdlr)
320334
cdef constraints = []
321-
cdef int i
322335
for i in range(nconss):
323336
constraints.append(getPyCons(conss[i]))
324337
solution = Solution.create(scip, sol)
@@ -328,9 +341,10 @@ cdef SCIP_RETCODE PyConsCheck (SCIP* scip, SCIP_CONSHDLR* conshdlr, SCIP_CONS**
328341

329342
cdef SCIP_RETCODE PyConsProp (SCIP* scip, SCIP_CONSHDLR* conshdlr, SCIP_CONS** conss, int nconss, int nusefulconss, int nmarkedconss,
330343
SCIP_PROPTIMING proptiming, SCIP_RESULT* result) noexcept with gil:
344+
cdef int i
345+
331346
PyConshdlr = getPyConshdlr(conshdlr)
332347
cdef constraints = []
333-
cdef int i
334348
for i in range(nconss):
335349
constraints.append(getPyCons(conss[i]))
336350
result_dict = PyConshdlr.consprop(constraints, nusefulconss, nmarkedconss, proptiming)
@@ -342,9 +356,10 @@ cdef SCIP_RETCODE PyConsPresol (SCIP* scip, SCIP_CONSHDLR* conshdlr, SCIP_CONS**
342356
int nnewdelconss, int nnewaddconss, int nnewupgdconss, int nnewchgcoefs, int nnewchgsides,
343357
int* nfixedvars, int* naggrvars, int* nchgvartypes, int* nchgbds, int* naddholes,
344358
int* ndelconss, int* naddconss, int* nupgdconss, int* nchgcoefs, int* nchgsides, SCIP_RESULT* result) noexcept with gil:
359+
cdef int i
360+
345361
PyConshdlr = getPyConshdlr(conshdlr)
346362
cdef constraints = []
347-
cdef int i
348363
for i in range(nconss):
349364
constraints.append(getPyCons(conss[i]))
350365
# dictionary for input/output parameters
@@ -416,9 +431,10 @@ cdef SCIP_RETCODE PyConsDisable (SCIP* scip, SCIP_CONSHDLR* conshdlr, SCIP_CONS*
416431
return SCIP_OKAY
417432

418433
cdef SCIP_RETCODE PyConsDelvars (SCIP* scip, SCIP_CONSHDLR* conshdlr, SCIP_CONS** conss, int nconss) noexcept with gil:
434+
cdef int i
435+
419436
PyConshdlr = getPyConshdlr(conshdlr)
420437
cdef constraints = []
421-
cdef int i
422438
for i in range(nconss):
423439
constraints.append(getPyCons(conss[i]))
424440
PyConshdlr.consdelvars(constraints)

0 commit comments

Comments
 (0)