@@ -531,6 +531,66 @@ cdef class LP:
531531
532532 return binds
533533
534+ def getBase (self ):
535+ """ Returns the basis status of columns and rows.
536+
537+ Status values are defined in SCIP_BASESTAT: LOWER, BASIC, UPPER, ZERO.
538+
539+ Returns
540+ -------
541+ tuple of (list of int, list of int)
542+ Column basis statuses and row basis statuses.
543+
544+ """
545+ cdef int ncols = self .ncols()
546+ cdef int nrows = self .nrows()
547+ cdef int * c_cstat = < int * > malloc(ncols * sizeof(int ))
548+ cdef int * c_rstat = < int * > malloc(nrows * sizeof(int ))
549+ cdef int i
550+
551+ PY_SCIP_CALL(SCIPlpiGetBase(self .lpi, c_cstat, c_rstat))
552+
553+ cstat = [c_cstat[i] for i in range (ncols)]
554+ rstat = [c_rstat[i] for i in range (nrows)]
555+
556+ free(c_rstat)
557+ free(c_cstat)
558+
559+ return cstat, rstat
560+
561+ def setBase (self , cstat , rstat ):
562+ """ Sets the basis status of columns and rows.
563+
564+ Status values are defined in SCIP_BASESTAT: LOWER, BASIC, UPPER, ZERO.
565+
566+ Parameters
567+ ----------
568+ cstat : list of int
569+ Column basis statuses (length must equal ncols).
570+ rstat : list of int
571+ Row basis statuses (length must equal nrows).
572+
573+ """
574+ cdef int ncols = self .ncols()
575+ cdef int nrows = self .nrows()
576+ if len (cstat) != ncols:
577+ raise ValueError (f" cstat has length {len(cstat)}, expected {ncols}" )
578+ if len (rstat) != nrows:
579+ raise ValueError (f" rstat has length {len(rstat)}, expected {nrows}" )
580+ cdef int * c_cstat = < int * > malloc(ncols * sizeof(int ))
581+ cdef int * c_rstat = < int * > malloc(nrows * sizeof(int ))
582+ cdef int i
583+
584+ for i in range (ncols):
585+ c_cstat[i] = cstat[i]
586+ for i in range (nrows):
587+ c_rstat[i] = rstat[i]
588+
589+ PY_SCIP_CALL(SCIPlpiSetBase(self .lpi, c_cstat, c_rstat))
590+
591+ free(c_rstat)
592+ free(c_cstat)
593+
534594 # Parameter Methods
535595
536596 def setIntParam (self , param , value ):
0 commit comments