Comments (4)
@common_expression(model, y, f(x))
@variable(model, y)
@constraint(model, y :== f(x))
from jump.jl.
What is stopping @expression(model, y, f(x))
from adopting the common-subexpression behavior you're describing? Would this require breaking changes to MOI?
from jump.jl.
What is stopping @expression(model, y, f(x)) from adopting the common-subexpression behavior you're describing?
Yes, it's a breaking change. We discussed this on the monthly developer call. @mlubin is in favor of looking into a :subexpression
node. I need to just try out some options.
from jump.jl.
Some related discussion from jump-dev/MathOptInterface.jl#2488:
Some possible options:
- Create a single unified expression graph (as opposed to the current expression tree). Change quite a lot of how ReverseAD processes functions etc.
- Don't do anything. Add a new decision variable with
y = f(x)
for expressions. This makes things very explicit. - Add something new type/index to JuMP/MOI. But we're breaking the abstraction quite a bit.
- Add a univariate
:subexpression
operator to MOI. So:@expression(model, expr, subexpression(sin(x) + 1))
. Solvers would see this during parsing, and could choose to ignore, or store it in a common expression.
I don't have a strong opinion yet. But our current approach requires us to smack the modeler on the hand and tell them they're holding it wrong and that they should do (2): #3729 (comment)
from jump.jl.
Related Issues (20)
- How to improve the speed to build a complex model? HOT 2
- Coefficients of complex variables created with a GenericModel are always Float64
- LinearAlgebra.hermitian is incorrect
- *(::Real, ::Hermitian) is not hermitian HOT 5
- Cannot `convert` an object of type Float64 to an object of type JuMP.NonlinearExpr HOT 3
- Documentation Request: List whether a solver supports Indicator Constraints HOT 4
- Bullet point alignment in bibliography HOT 9
- Multiplication of matrix expression and variables leads to stack overflow and matmul error HOT 4
- Multiple Ranges for variables HOT 3
- Y' when Y is of type ::Matrix{NonlinearExpr} HOT 1
- Poor performance in complementarity models HOT 23
- Add a method for Complex(a,b) HOT 8
- MethodError with empty summations HOT 1
- Should error when trying to mix `NonlinearExpression` and `GenericNonlinearExpr` HOT 1
- Support normalized_coefficient for vector-valued constraints
- Precompilation in CI fails on v1.22 HOT 7
- Fuzzy search on unrecognized keyword arguments to give suggestions HOT 2
- Track failures on nightly HOT 3
- Possibly missing diagnostics for vector of vector of variables HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jump.jl.