@@ -373,19 +373,21 @@ cdef class LP:
373
373
return SCIPlpiIsOptimal(self .lpi)
374
374
375
375
def getObjVal (self ):
376
- """ Returns the objective value of the last LP solve."""
377
- assert self .isOptimal(), " LP is not optimal"
378
-
376
+ """
377
+ Returns the objective value of the last LP solve.
378
+ Please note that infeasible or unbounded LPs might return unexpected results.
379
+ """
379
380
cdef SCIP_Real objval
380
381
381
382
PY_SCIP_CALL(SCIPlpiGetSol(self .lpi, & objval, NULL , NULL , NULL , NULL ))
382
383
383
384
return objval
384
385
385
386
def getPrimal (self ):
386
- """ Returns the primal solution of the last LP solve."""
387
- assert self .isOptimal(), " LP is not optimal"
388
-
387
+ """
388
+ Returns the primal solution of the last LP solve.
389
+ Please note that infeasible or unbounded LPs might return unexpected results.
390
+ """
389
391
cdef int ncols = self .ncols()
390
392
cdef SCIP_Real* c_primalsol = < SCIP_Real* > malloc(ncols * sizeof(SCIP_Real))
391
393
cdef int i
@@ -403,9 +405,10 @@ cdef class LP:
403
405
return SCIPlpiIsPrimalFeasible(self .lpi)
404
406
405
407
def getDual (self ):
406
- """ Returns the dual solution of the last LP solve."""
407
- assert self .isOptimal(), " LP is not optimal"
408
-
408
+ """
409
+ Returns the dual solution of the last LP solve.
410
+ Please note that infeasible or unbounded LPs might return unexpected results.
411
+ """
409
412
cdef int nrows = self .nrows()
410
413
cdef SCIP_Real* c_dualsol = < SCIP_Real* > malloc(nrows * sizeof(SCIP_Real))
411
414
cdef int i
@@ -471,9 +474,10 @@ cdef class LP:
471
474
return niters
472
475
473
476
def getActivity (self ):
474
- """ Returns the row activity vector of the last LP solve."""
475
- assert self .isOptimal(), " LP is not optimal"
476
-
477
+ """
478
+ Returns the row activity vector of the last LP solve.
479
+ Please note that infeasible or unbounded LPs might return unexpected results.
480
+ """
477
481
cdef int nrows = self .nrows()
478
482
cdef SCIP_Real* c_activity = < SCIP_Real* > malloc(nrows * sizeof(SCIP_Real))
479
483
cdef int i
@@ -489,9 +493,10 @@ cdef class LP:
489
493
return activity
490
494
491
495
def getRedcost (self ):
492
- """ Returns the reduced cost vector of the last LP solve."""
493
- assert self .isOptimal(), " LP is not optimal"
494
-
496
+ """
497
+ Returns the reduced cost vector of the last LP solve.
498
+ Please note that infeasible or unbounded LPs might return unexpected results.
499
+ """
495
500
cdef int ncols = self .ncols()
496
501
cdef SCIP_Real* c_redcost = < SCIP_Real* > malloc(ncols * sizeof(SCIP_Real))
497
502
cdef int i
0 commit comments