Skip to content

Commit 98a903d

Browse files
committed
Add ReducedCost variable attribute
1 parent 64deec9 commit 98a903d

File tree

20 files changed

+92
-2
lines changed

20 files changed

+92
-2
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ __pycache__/
66
build/
77
.pytest_cache/
88
.mypy_cache/
9+
dist/
910

1011
.idea/
1112
.vscode/

CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ target_sources(xpress_model PRIVATE
245245
include/pyoptinterface/xpress_model.hpp
246246
lib/xpress_model.cpp
247247
)
248-
target_link_libraries(xpress_model PUBLIC core nlexpr nleval)
248+
target_link_libraries(xpress_model PUBLIC core nlexpr)
249249

250250
nanobind_add_module(
251251
xpress_model_ext
@@ -336,7 +336,7 @@ nanobind_add_stub(
336336
)
337337

338338
nanobind_add_stub(
339-
xpress_model_ext_stub
339+
xpress_model_ext_stub
340340
INSTALL_TIME
341341
MODULE pyoptinterface._src.xpress_model_ext
342342
OUTPUT ${POI_INSTALL_DIR}/xpress_model_ext.pyi

docs/source/attribute/copt.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,9 @@
9797
* - IISUpperBound
9898
-
9999
-
100+
* - ReducedCost
101+
-
102+
-
100103
:::
101104

102105
### Supported [constraint attribute](#pyoptinterface.ConstraintAttribute)

docs/source/attribute/gurobi.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,9 @@
9797
* - IISUpperBound
9898
-
9999
-
100+
* - ReducedCost
101+
-
102+
-
100103
:::
101104

102105
### Supported [constraint attribute](#pyoptinterface.ConstraintAttribute)

docs/source/attribute/highs.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,9 @@
9797
* - IISUpperBound
9898
-
9999
-
100+
* - ReducedCost
101+
-
102+
-
100103
:::
101104

102105
### Supported [constraint attribute](#pyoptinterface.ConstraintAttribute)

docs/source/attribute/ipopt.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,9 @@
9797
* - IISUpperBound
9898
-
9999
-
100+
* - ReducedCost
101+
-
102+
-
100103
:::
101104

102105
### Supported [constraint attribute](#pyoptinterface.ConstraintAttribute)

docs/source/attribute/mosek.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,9 @@
9797
* - IISUpperBound
9898
-
9999
-
100+
* - ReducedCost
101+
-
102+
-
100103
:::
101104

102105
### Supported [constraint attribute](#pyoptinterface.ConstraintAttribute)

docs/source/variable.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ After a variable is created, we can query or modify its attributes. The followin
3636
- bool
3737
* - IISUpperBound
3838
- bool
39+
* - ReducedCost
40+
- float
3941
:::
4042

4143
```python

include/pyoptinterface/highs_model.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,9 @@ class POIHighsModel : public OnesideLinearConstraintMixin<POIHighsModel>,
193193
double get_constraint_primal(const ConstraintIndex &constraint);
194194
double get_constraint_dual(const ConstraintIndex &constraint);
195195

196+
// dual of variable as reduced cost
197+
double get_variable_dual(const VariableIndex &variable);
198+
196199
ObjectiveSense get_obj_sense();
197200
void set_obj_sense(ObjectiveSense sense);
198201
double get_obj_value();

include/pyoptinterface/mosek_model.hpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@
7070
B(MSK_putxxslice); \
7171
B(MSK_getxcslice); \
7272
B(MSK_getyslice); \
73+
B(MSK_getslxslice); \
74+
B(MSK_getsuxslice); \
7375
B(MSK_getconnamelen); \
7476
B(MSK_getconname); \
7577
B(MSK_getobjsense); \
@@ -226,6 +228,9 @@ class MOSEKModel : public OnesideLinearConstraintMixin<MOSEKModel>,
226228
void set_variable_upper_bound(const VariableIndex &variable, double ub);
227229
void set_variable_primal(const VariableIndex &variable, double primal);
228230

231+
// reduced cost of variable
232+
double get_variable_dual(const VariableIndex &variable);
233+
229234
double get_constraint_primal(const ConstraintIndex &constraint);
230235
double get_constraint_dual(const ConstraintIndex &constraint);
231236
std::string get_constraint_name(const ConstraintIndex &constraint);

0 commit comments

Comments
 (0)