Skip to content

Commit ccc3798

Browse files
lidingxulidingxu
andauthored
add parameter set and get functions for lpi (#965)
* add parameter set and get functions for lpi * remove some unavailbale set and get functions * add comments and assertation for lp test * change function order * remove parameter tests and add isFeasPositive --------- Co-authored-by: lidingxu <lidingxu.zz@gmail.com>
1 parent 76197c5 commit ccc3798

File tree

6 files changed

+484
-287
lines changed

6 files changed

+484
-287
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
## Unreleased
44
### Added
55
- Added getLinearConsIndicator
6+
- Added SCIP_LPPARAM, setIntParam, setRealParam, getIntParam, getRealParam for lpi
7+
- Added isFeasPositive
68
### Fixed
79
### Changed
810
### Removed

src/pyscipopt/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
from pyscipopt.scip import Reader
2727
from pyscipopt.scip import Sepa
2828
from pyscipopt.scip import LP
29+
from pyscipopt.scip import PY_SCIP_LPPARAM as SCIP_LPPARAM
2930
from pyscipopt.scip import readStatistics
3031
from pyscipopt.scip import Expr
3132
from pyscipopt.scip import MatrixExpr

src/pyscipopt/lp.pxi

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -476,3 +476,77 @@ cdef class LP:
476476
free(c_binds)
477477

478478
return binds
479+
480+
# Parameter Methods
481+
482+
def setIntParam(self, param, value):
483+
"""
484+
Set an int-valued parameter.
485+
If the parameter is not supported by the LP solver, KeyError will be raised.
486+
487+
Parameters
488+
----------
489+
param : SCIP_LPPARAM
490+
name of parameter
491+
value : int
492+
value of parameter
493+
494+
"""
495+
PY_SCIP_CALL(SCIPlpiSetIntpar(self.lpi, param, value))
496+
497+
def setRealParam(self, param, value):
498+
"""
499+
Set a real-valued parameter.
500+
If the parameter is not supported by the LP solver, KeyError will be raised.
501+
502+
Parameters
503+
----------
504+
param : SCIP_LPPARAM
505+
name of parameter
506+
value : float
507+
value of parameter
508+
509+
"""
510+
PY_SCIP_CALL(SCIPlpiSetRealpar(self.lpi, param, value))
511+
512+
def getIntParam(self, param):
513+
"""
514+
Get the value of a parameter of type int.
515+
If the parameter is not supported by the LP solver, KeyError will be raised.
516+
517+
Parameters
518+
----------
519+
param : SCIP_LPPARAM
520+
name of parameter
521+
522+
Returns
523+
-------
524+
int
525+
526+
"""
527+
cdef int value
528+
529+
PY_SCIP_CALL(SCIPlpiGetIntpar(self.lpi, param, &value))
530+
531+
return value
532+
533+
def getRealParam(self, param):
534+
"""
535+
Get the value of a parameter of type float.
536+
If the parameter is not supported by the LP solver, KeyError will be raised.
537+
538+
Parameters
539+
----------
540+
param : SCIP_LPPARAM
541+
name of parameter
542+
543+
Returns
544+
-------
545+
float
546+
547+
"""
548+
cdef SCIP_Real value
549+
550+
PY_SCIP_CALL(SCIPlpiGetRealpar(self.lpi, param, &value))
551+
552+
return value

0 commit comments

Comments
 (0)