You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In my modeling, I'm carrying around several linear expressions where sometimes I'm only interested in the value of the expressions and not the individual variables. It would be nice if that could be supported.
h = highspy.Highs()
x = h.addVariable(ub=3, obj=1)
y = h.addVariable(ub=4, obj=1)
h.maximize()
assert abs(h.val(x)-3) < 1e-6
assert abs(h.val(y)-4) < 1e-6
assert abs(h.val(x+y)-7) < 1e-6 #AttributeError: 'highs_linear_expression' object has no attribute 'index'
The text was updated successfully, but these errors were encountered:
This is a simple feature (if we limit to linear expressions). I've already added support in #1891. Will commit when I've finished with all the new tests and suitable highspy coverage.
Note: it also supports constant addition and all in/equality variants. Strict inequalities (<,>) aren't supported.
Major highspy update:
* changed `highs_linear_expression` to be immutable by default
* improved callback support
* improved test coverage (99%)
* performance and usability enhancements
* Support `__iadd__`, `__imul__`, etc.
* Updated chain comparison support in immutable setting
* `h.val()` can take `highs_linear_expression`
* `expr == [lb,ub]` -> `lb <= expr <= ub` syntax
* `qsum`
* added pretty print `__repr__` and `__str__`
* added KeyboardInterrupt support
* added user interrupt
* fixed slicing issues with numpy and highs
* added `resetGlobalScheduler`
* released GIL for `Presolve`
* fixed issues with deadlock on Windows
* fixed MIP solution callback issue
* support `getExpr` that creates a `highs_linear_expression` from existing row
Should address multiple issues: ERGO-Code#1865, ERGO-Code#1882, ERGO-Code#1888, ERGO-Code#1892, ERGO-Code#1903, ERGO-Code#1904, and perhaps ERGO-Code#1905
In my modeling, I'm carrying around several linear expressions where sometimes I'm only interested in the value of the expressions and not the individual variables. It would be nice if that could be supported.
The text was updated successfully, but these errors were encountered: