Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion .github/workflows/build-bazel.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
name: build-bazel

on: [push, pull_request]
on:
push :
branches: [ master, main, Parthpore10_1590issue_fix ]
pull_request:
branches: [master,main]
workflow_dispatch:

jobs:
bazel:
Expand Down
13 changes: 12 additions & 1 deletion highs/highs_bindings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,16 @@ std::function<dense_array_t<T>(const Base&)> make_readonly_ptr(
};
}

template<typename Base, typename T>
std::function<void(Base&, dense_array_t<T>)> make_vector_setter(
std::vector<T> Base::* member){
return [member](Base& self,dense_array_t<T>values){
auto buf = values.request();
auto ptr = static_cast<T*>(buf.ptr);
(self.*member).assign(ptr, ptr + buf.size);
};
}

HighsStatus highs_passModel(Highs* h, HighsModel& model) {
return h->passModel(model);
}
Expand Down Expand Up @@ -1059,7 +1069,8 @@ PYBIND11_MODULE(_core, m, py::mod_gil_not_used()) {
.def(py::init<>())
.def_readwrite("num_col_", &HighsLp::num_col_)
.def_readwrite("num_row_", &HighsLp::num_row_)
.def_readwrite("col_cost_", &HighsLp::col_cost_)
.def_property("col_cost_", make_readonly_ptr(&HighsLp::col_cost_),
make_vector_setter(&HighsLp::col_cost_))
.def_readwrite("col_lower_", &HighsLp::col_lower_)
.def_readwrite("col_upper_", &HighsLp::col_upper_)
.def_readwrite("row_lower_", &HighsLp::row_lower_)
Expand Down
10 changes: 5 additions & 5 deletions highs/highspy/_core/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ class HighsLogType:

class HighsLp:
a_matrix_: HighsSparseMatrix
col_cost_: list[float]
col_cost_: numpy.ndarray[typing.Any, numpy.dtype[numpy.float64]]
col_lower_: list[float]
col_names_: list[str]
col_upper_: list[float]
Expand Down Expand Up @@ -525,11 +525,11 @@ class HighsScale:
pass

class HighsSolution:
col_dual: list[float]
col_value: list[float]
col_dual: numpy.ndarray[typing.Any, numpy.dtype[numpy.float64]]
col_value: numpy.ndarray[typing.Any, numpy.dtype[numpy.float64]]
dual_valid: bool
row_dual: list[float]
row_value: list[float]
row_dual: numpy.ndarray[typing.Any, numpy.dtype[numpy.float64]]
row_value: numpy.ndarray[typing.Any, numpy.dtype[numpy.float64]]
value_valid: bool

def __init__(self) -> None: ...
Expand Down
2 changes: 1 addition & 1 deletion highs/highspy/highs.py
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,7 @@ def allConstrValues(self):
Returns:
A list of values for all constraints in the solution.
"""
return super().getSolution().row_value
return self.getSolution().row_value

def constrDual(
self,
Expand Down