File tree 1 file changed +6
-2
lines changed 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -329,18 +329,19 @@ def compute_IIS(self):
329
329
"""
330
330
self .poi .computeIIS ()
331
331
332
+ @for_solvers ("gurobi" )
332
333
def dispose (self ):
333
334
"""
334
335
Tries to close the solver connection by deleting the model and forcing the garbage collector to run.
335
336
336
- Once this method is called, this model is no longer usable.
337
+ Gurobi only. Once this method is called, this model is no longer usable.
337
338
338
339
This method will not work if you have a variable that references self.poi.
339
340
Unfortunately, this is a limitation from the underlying solver interface library.
340
341
See https://github.com/metab0t/PyOptInterface/issues/36 for context.
341
342
342
343
Examples:
343
- >>> m = pf.Model()
344
+ >>> m = pf.Model(solver="gurobi" )
344
345
>>> m.X = pf.Variable(ub=1)
345
346
>>> m.maximize = m.X
346
347
>>> m.optimize()
@@ -354,8 +355,11 @@ def dispose(self):
354
355
"""
355
356
import gc
356
357
358
+ env = self .poi ._env
357
359
del self .poi
358
360
gc .collect ()
361
+ del env
362
+ gc .collect ()
359
363
360
364
def _set_param (self , name , value ):
361
365
self .poi .set_raw_parameter (name , value )
You can’t perform that action at this time.
0 commit comments