|
332 | 332 | cbc_progress_callback prgcbc, void *appData); |
333 | 333 |
|
334 | 334 | void Cbc_clearCallBack(Cbc_Model *model); |
| 335 | +
|
| 336 | + const double *Cbc_getRowPrice(Cbc_Model *model); |
| 337 | +
|
| 338 | + const double *Osi_getRowPrice(void *osi); |
335 | 339 | """) |
336 | 340 |
|
337 | 341 | CHAR_ONE = "{}".format(chr(1)).encode("utf-8") |
@@ -680,12 +684,18 @@ def var_get_lb(self, var: "Var") -> float: |
680 | 684 | raise Exception('Error while getting lower bound of variables') |
681 | 685 | return float(lb[var.idx]) |
682 | 686 |
|
| 687 | + def var_set_lb(self, var: "Var", value: float): |
| 688 | + cbclib.Cbc_setColLower(self._model, var.idx, value) |
| 689 | + |
683 | 690 | def var_get_ub(self, var: "Var") -> float: |
684 | 691 | ub = cbclib.Cbc_getColUpper(self._model) |
685 | 692 | if ub == ffi.NULL: |
686 | 693 | raise Exception('Error while getting upper bound of variables') |
687 | 694 | return float(ub[var.idx]) |
688 | 695 |
|
| 696 | + def var_set_ub(self, var: "Var", value: float): |
| 697 | + cbclib.Cbc_setColUpper(self._model, var.idx, value) |
| 698 | + |
689 | 699 | def var_get_name(self, idx: int) -> str: |
690 | 700 | namep = self.__name_space |
691 | 701 | cbclib.Cbc_getColName(self._model, idx, namep, MAX_NAME_SIZE) |
@@ -906,6 +916,12 @@ def get_pump_passes(self) -> int: |
906 | 916 | def set_pump_passes(self, passes: int): |
907 | 917 | self.__pumpp = passes |
908 | 918 |
|
| 919 | + def constr_get_pi(self, constr: Constr) -> float: |
| 920 | + rp = cbclib.Cbc_getRowPrice(self._model) |
| 921 | + if rp == ffi.NULL: |
| 922 | + raise Exception('row prices not available') |
| 923 | + return float(rp[constr.idx]) |
| 924 | + |
909 | 925 |
|
910 | 926 | class ModelOsi(Model): |
911 | 927 | def __init__(self, osi_ptr: CData): |
|
0 commit comments