Skip to content

Commit c473fd7

Browse files
committed
Revert "Typed loop variables"
This reverts commit d07a684.
1 parent 5cefe5c commit c473fd7

File tree

8 files changed

+14
-123
lines changed

8 files changed

+14
-123
lines changed

CHANGELOG.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
## Unreleased
44
### Added
5-
- Added cdef to loop variables for slight speedup
65
- Added wrappers for setting and getting heuristic timing
76
- Added transformed option to getVarDict, updated test
87
- Added categorical data example

src/pyscipopt/benders.pxi

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,6 @@ cdef SCIP_RETCODE PyBendersSolvesub (SCIP* scip, SCIP_BENDERS* benders, SCIP_SOL
175175
cdef SCIP_RETCODE PyBendersPostsolve (SCIP* scip, SCIP_BENDERS* benders, SCIP_SOL* sol,
176176
SCIP_BENDERSENFOTYPE type, int* mergecands, int npriomergecands, int nmergecands, SCIP_Bool checkint,
177177
SCIP_Bool infeasible, SCIP_Bool* merged) noexcept with gil:
178-
cdef int i
179178
cdef SCIP_BENDERSDATA* bendersdata
180179
bendersdata = SCIPbendersGetData(benders)
181180
PyBenders = <Benders>bendersdata

src/pyscipopt/conshdlr.pxi

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,6 @@ cdef SCIP_RETCODE PyConsFree (SCIP* scip, SCIP_CONSHDLR* conshdlr) noexcept with
169169

170170
cdef SCIP_RETCODE PyConsInit (SCIP* scip, SCIP_CONSHDLR* conshdlr, SCIP_CONS** conss, int nconss) noexcept with gil:
171171
PyConshdlr = getPyConshdlr(conshdlr)
172-
cdef int i
173172
cdef constraints = []
174173
for i in range(nconss):
175174
constraints.append(getPyCons(conss[i]))
@@ -179,7 +178,6 @@ cdef SCIP_RETCODE PyConsInit (SCIP* scip, SCIP_CONSHDLR* conshdlr, SCIP_CONS** c
179178
cdef SCIP_RETCODE PyConsExit (SCIP* scip, SCIP_CONSHDLR* conshdlr, SCIP_CONS** conss, int nconss) noexcept with gil:
180179
PyConshdlr = getPyConshdlr(conshdlr)
181180
cdef constraints = []
182-
cdef int i
183181
for i in range(nconss):
184182
constraints.append(getPyCons(conss[i]))
185183
PyConshdlr.consexit(constraints)
@@ -188,7 +186,6 @@ cdef SCIP_RETCODE PyConsExit (SCIP* scip, SCIP_CONSHDLR* conshdlr, SCIP_CONS** c
188186
cdef SCIP_RETCODE PyConsInitpre (SCIP* scip, SCIP_CONSHDLR* conshdlr, SCIP_CONS** conss, int nconss) noexcept with gil:
189187
PyConshdlr = getPyConshdlr(conshdlr)
190188
cdef constraints = []
191-
cdef int i
192189
for i in range(nconss):
193190
constraints.append(getPyCons(conss[i]))
194191
PyConshdlr.consinitpre(constraints)
@@ -197,7 +194,6 @@ cdef SCIP_RETCODE PyConsInitpre (SCIP* scip, SCIP_CONSHDLR* conshdlr, SCIP_CONS*
197194
cdef SCIP_RETCODE PyConsExitpre (SCIP* scip, SCIP_CONSHDLR* conshdlr, SCIP_CONS** conss, int nconss) noexcept with gil:
198195
PyConshdlr = getPyConshdlr(conshdlr)
199196
cdef constraints = []
200-
cdef int i
201197
for i in range(nconss):
202198
constraints.append(getPyCons(conss[i]))
203199
PyConshdlr.consexitpre(constraints)
@@ -206,7 +202,6 @@ cdef SCIP_RETCODE PyConsExitpre (SCIP* scip, SCIP_CONSHDLR* conshdlr, SCIP_CONS*
206202
cdef SCIP_RETCODE PyConsInitsol (SCIP* scip, SCIP_CONSHDLR* conshdlr, SCIP_CONS** conss, int nconss) noexcept with gil:
207203
PyConshdlr = getPyConshdlr(conshdlr)
208204
cdef constraints = []
209-
cdef int i
210205
for i in range(nconss):
211206
constraints.append(getPyCons(conss[i]))
212207
PyConshdlr.consinitsol(constraints)
@@ -215,7 +210,6 @@ cdef SCIP_RETCODE PyConsInitsol (SCIP* scip, SCIP_CONSHDLR* conshdlr, SCIP_CONS*
215210
cdef SCIP_RETCODE PyConsExitsol (SCIP* scip, SCIP_CONSHDLR* conshdlr, SCIP_CONS** conss, int nconss, SCIP_Bool restart) noexcept with gil:
216211
PyConshdlr = getPyConshdlr(conshdlr)
217212
cdef constraints = []
218-
cdef int i
219213
for i in range(nconss):
220214
constraints.append(getPyCons(conss[i]))
221215
PyConshdlr.consexitsol(constraints, restart)
@@ -252,7 +246,6 @@ cdef SCIP_RETCODE PyConsTrans (SCIP* scip, SCIP_CONSHDLR* conshdlr, SCIP_CONS* s
252246
cdef SCIP_RETCODE PyConsInitlp (SCIP* scip, SCIP_CONSHDLR* conshdlr, SCIP_CONS** conss, int nconss, SCIP_Bool* infeasible) noexcept with gil:
253247
PyConshdlr = getPyConshdlr(conshdlr)
254248
cdef constraints = []
255-
cdef int i
256249
for i in range(nconss):
257250
constraints.append(getPyCons(conss[i]))
258251
result_dict = PyConshdlr.consinitlp(constraints)
@@ -262,7 +255,6 @@ cdef SCIP_RETCODE PyConsInitlp (SCIP* scip, SCIP_CONSHDLR* conshdlr, SCIP_CONS**
262255
cdef SCIP_RETCODE PyConsSepalp (SCIP* scip, SCIP_CONSHDLR* conshdlr, SCIP_CONS** conss, int nconss, int nusefulconss, SCIP_RESULT* result) noexcept with gil:
263256
PyConshdlr = getPyConshdlr(conshdlr)
264257
cdef constraints = []
265-
cdef int i
266258
for i in range(nconss):
267259
constraints.append(getPyCons(conss[i]))
268260
result_dict = PyConshdlr.conssepalp(constraints, nusefulconss)
@@ -273,7 +265,6 @@ cdef SCIP_RETCODE PyConsSepasol (SCIP* scip, SCIP_CONSHDLR* conshdlr, SCIP_CONS*
273265
SCIP_SOL* sol, SCIP_RESULT* result) noexcept with gil:
274266
PyConshdlr = getPyConshdlr(conshdlr)
275267
cdef constraints = []
276-
cdef int i
277268
for i in range(nconss):
278269
constraints.append(getPyCons(conss[i]))
279270
solution = Solution.create(scip, sol)
@@ -285,7 +276,6 @@ cdef SCIP_RETCODE PyConsEnfolp (SCIP* scip, SCIP_CONSHDLR* conshdlr, SCIP_CONS**
285276
SCIP_Bool solinfeasible, SCIP_RESULT* result) noexcept with gil:
286277
PyConshdlr = getPyConshdlr(conshdlr)
287278
cdef constraints = []
288-
cdef int i
289279
for i in range(nconss):
290280
constraints.append(getPyCons(conss[i]))
291281
result_dict = PyConshdlr.consenfolp(constraints, nusefulconss, solinfeasible)
@@ -295,7 +285,6 @@ cdef SCIP_RETCODE PyConsEnfolp (SCIP* scip, SCIP_CONSHDLR* conshdlr, SCIP_CONS**
295285
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:
296286
PyConshdlr = getPyConshdlr(conshdlr)
297287
cdef constraints = []
298-
cdef int i
299288
for i in range(nconss):
300289
constraints.append(getPyCons(conss[i]))
301290
solution = Solution.create(scip, sol)
@@ -307,7 +296,6 @@ cdef SCIP_RETCODE PyConsEnfops (SCIP* scip, SCIP_CONSHDLR* conshdlr, SCIP_CONS**
307296
SCIP_Bool solinfeasible, SCIP_Bool objinfeasible, SCIP_RESULT* result) noexcept with gil:
308297
PyConshdlr = getPyConshdlr(conshdlr)
309298
cdef constraints = []
310-
cdef int i
311299
for i in range(nconss):
312300
constraints.append(getPyCons(conss[i]))
313301
result_dict = PyConshdlr.consenfops(constraints, nusefulconss, solinfeasible, objinfeasible)
@@ -318,7 +306,6 @@ cdef SCIP_RETCODE PyConsCheck (SCIP* scip, SCIP_CONSHDLR* conshdlr, SCIP_CONS**
318306
SCIP_Bool checklprows, SCIP_Bool printreason, SCIP_Bool completely, SCIP_RESULT* result) noexcept with gil:
319307
PyConshdlr = getPyConshdlr(conshdlr)
320308
cdef constraints = []
321-
cdef int i
322309
for i in range(nconss):
323310
constraints.append(getPyCons(conss[i]))
324311
solution = Solution.create(scip, sol)
@@ -330,7 +317,6 @@ cdef SCIP_RETCODE PyConsProp (SCIP* scip, SCIP_CONSHDLR* conshdlr, SCIP_CONS** c
330317
SCIP_PROPTIMING proptiming, SCIP_RESULT* result) noexcept with gil:
331318
PyConshdlr = getPyConshdlr(conshdlr)
332319
cdef constraints = []
333-
cdef int i
334320
for i in range(nconss):
335321
constraints.append(getPyCons(conss[i]))
336322
result_dict = PyConshdlr.consprop(constraints, nusefulconss, nmarkedconss, proptiming)
@@ -344,7 +330,6 @@ cdef SCIP_RETCODE PyConsPresol (SCIP* scip, SCIP_CONSHDLR* conshdlr, SCIP_CONS**
344330
int* ndelconss, int* naddconss, int* nupgdconss, int* nchgcoefs, int* nchgsides, SCIP_RESULT* result) noexcept with gil:
345331
PyConshdlr = getPyConshdlr(conshdlr)
346332
cdef constraints = []
347-
cdef int i
348333
for i in range(nconss):
349334
constraints.append(getPyCons(conss[i]))
350335
# dictionary for input/output parameters
@@ -418,7 +403,6 @@ cdef SCIP_RETCODE PyConsDisable (SCIP* scip, SCIP_CONSHDLR* conshdlr, SCIP_CONS*
418403
cdef SCIP_RETCODE PyConsDelvars (SCIP* scip, SCIP_CONSHDLR* conshdlr, SCIP_CONS** conss, int nconss) noexcept with gil:
419404
PyConshdlr = getPyConshdlr(conshdlr)
420405
cdef constraints = []
421-
cdef int i
422406
for i in range(nconss):
423407
constraints.append(getPyCons(conss[i]))
424408
PyConshdlr.consdelvars(constraints)

src/pyscipopt/cutsel.pxi

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ cdef SCIP_RETCODE PyCutselExitsol (SCIP* scip, SCIP_CUTSEL* cutsel) noexcept wit
7272
cdef SCIP_RETCODE PyCutselSelect (SCIP* scip, SCIP_CUTSEL* cutsel, SCIP_ROW** cuts, int ncuts,
7373
SCIP_ROW** forcedcuts, int nforcedcuts, SCIP_Bool root, int maxnselectedcuts,
7474
int* nselectedcuts, SCIP_RESULT* result) noexcept with gil:
75-
cdef int i
7675
cdef SCIP_CUTSELDATA* cutseldata
7776
cdef SCIP_ROW* scip_row
7877
cutseldata = SCIPcutselGetData(cutsel)

src/pyscipopt/lp.pxi

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ cdef class LP:
6363
lb -- lower bound (default 0.0)
6464
ub -- upper bound (default infinity)
6565
"""
66-
cdef int i
6766
nnonz = len(entries)
6867

6968
cdef SCIP_Real* c_coefs = <SCIP_Real*> malloc(nnonz * sizeof(SCIP_Real))
@@ -96,8 +95,7 @@ cdef class LP:
9695
lbs -- lower bounds (default 0.0)
9796
ubs -- upper bounds (default infinity)
9897
"""
99-
cdef int i
100-
98+
10199
ncols = len(entrieslist)
102100
nnonz = sum(len(entries) for entries in entrieslist)
103101

@@ -160,8 +158,6 @@ cdef class LP:
160158
lhs -- left-hand side of the row (default 0.0)
161159
rhs -- right-hand side of the row (default infinity)
162160
"""
163-
cdef int i
164-
165161
beg = 0
166162
nnonz = len(entries)
167163

@@ -192,8 +188,6 @@ cdef class LP:
192188
lhss -- left-hand side of the row (default 0.0)
193189
rhss -- right-hand side of the row (default infinity)
194190
"""
195-
cdef int i
196-
197191
nrows = len(entrieslist)
198192
nnonz = sum(len(entries) for entries in entrieslist)
199193

@@ -238,8 +232,6 @@ cdef class LP:
238232
firstcol -- first column (default 0)
239233
lastcol -- last column (default ncols - 1)
240234
"""
241-
cdef int i
242-
243235
lastcol = lastcol if lastcol != None else self.ncols() - 1
244236

245237
if firstcol > lastcol:
@@ -269,8 +261,6 @@ cdef class LP:
269261
firstrow -- first row (default 0)
270262
lastrow -- last row (default nrows - 1)
271263
"""
272-
cdef int i
273-
274264
lastrow = lastrow if lastrow != None else self.nrows() - 1
275265

276266
if firstrow > lastrow:
@@ -373,8 +363,6 @@ cdef class LP:
373363

374364
def getPrimal(self):
375365
"""Returns the primal solution of the last LP solve."""
376-
cdef int i
377-
378366
ncols = self.ncols()
379367
cdef SCIP_Real* c_primalsol = <SCIP_Real*> malloc(ncols * sizeof(SCIP_Real))
380368
PY_SCIP_CALL(SCIPlpiGetSol(self.lpi, NULL, c_primalsol, NULL, NULL, NULL))
@@ -391,8 +379,6 @@ cdef class LP:
391379

392380
def getDual(self):
393381
"""Returns the dual solution of the last LP solve."""
394-
cdef int i
395-
396382
nrows = self.nrows()
397383
cdef SCIP_Real* c_dualsol = <SCIP_Real*> malloc(nrows * sizeof(SCIP_Real))
398384
PY_SCIP_CALL(SCIPlpiGetSol(self.lpi, NULL, NULL, c_dualsol, NULL, NULL))
@@ -409,8 +395,6 @@ cdef class LP:
409395

410396
def getPrimalRay(self):
411397
"""Returns a primal ray if possible, None otherwise."""
412-
cdef int i
413-
414398
if not SCIPlpiHasPrimalRay(self.lpi):
415399
return None
416400
ncols = self.ncols()
@@ -425,8 +409,6 @@ cdef class LP:
425409

426410
def getDualRay(self):
427411
"""Returns a dual ray if possible, None otherwise."""
428-
cdef int i
429-
430412
if not SCIPlpiHasDualRay(self.lpi):
431413
return None
432414
nrows = self.nrows()
@@ -447,8 +429,6 @@ cdef class LP:
447429

448430
def getRedcost(self):
449431
"""Returns the reduced cost vector of the last LP solve."""
450-
cdef int i
451-
452432
ncols = self.ncols()
453433

454434
cdef SCIP_Real* c_redcost = <SCIP_Real*> malloc(ncols * sizeof(SCIP_Real))
@@ -463,8 +443,6 @@ cdef class LP:
463443

464444
def getBasisInds(self):
465445
"""Returns the indices of the basic columns and rows; index i >= 0 corresponds to column i, index i < 0 to row -i-1"""
466-
cdef int i
467-
468446
nrows = self.nrows()
469447
cdef int* c_binds = <int*> malloc(nrows * sizeof(int))
470448

src/pyscipopt/reader.pxi

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ cdef SCIP_RETCODE PyReaderWrite (SCIP* scip, SCIP_READER* reader, FILE* file,
4545
SCIP_VAR** fixedvars, int nfixedvars, int startnvars,
4646
SCIP_CONS** conss, int nconss, int maxnconss, int startnconss,
4747
SCIP_Bool genericnames, SCIP_RESULT* result) noexcept with gil:
48-
cdef int i
4948
cdef SCIP_READERDATA* readerdata
5049
readerdata = SCIPreaderGetData(reader)
5150
cdef int fd = fileno(file)

0 commit comments

Comments
 (0)