Closed IainNZ closed 7 years ago
What about
@setObjective(m, Min, {3x-1 in [0,1],
2x in [1,2]})
I like @joehuchette's proposal. Here're some ideas (for the other form):
@setObjective(m, Min, connect{(x[i],z[i]), i in 1:n})
inclusive-or
@setObjective(m, Min, connect{(x,z), (x,z) in breakpoints1})
inclusive-or
@setObjective(m, Min, connect{(x,f(x)), x in breakpoints2})
inclusive-or
@setObjective(m, Min, connect{f(x), x in breakpoints2})
where
breakpoints1 = [(x[1],z[1]),
(x[2],z[2]),
...,
(x[n],z[n])]
and
breakpoints2 = [x[1],x[2],...,x[n]]
Some Remarks
f(x[i]) == z[i]
x[i] < x[i+1]
for all i=1:n-1
What about a more general concept of a variable that is a piecewise linear function of another variable (or variables)? This is useful not just in objective functions.
If this is done in a way that only works for scalar, single-variable-only functions then it would be of limited usefulness, for me anyway.
For piecewise linear, I'd need to be able to define high-dimensional polyhedral partitions, and PWA functions over those partitions. That's the full-generality version of this.
Separate issue, but I also really want ifelse for nonlinear, so I can stop manually doing smoothed sigmoidal approximations of piecewise nonlinear functions.
@tkelman you can do multivariable affine functions over boxes using this kind of format, its pretty useful at least in our field.
The kind of thing you are talking about (piecewise affine over general polyhedra) is getting into the more advanced areas of modeling that JuMP hasn't strayed into yet, e.g. disjunctive programming.
@tkelman, could you open an issue on ReverseDiffSparse for support for ifelse?
@mlubin sure, after I finish writing docs for julia support on Travis (spoilers).
There's no reason we can't do a nice syntax for univariate/multivariate box PWL functions using macros, as well as a more general mechanism for more complex PWL structure. The macros could just be a pleasant way of constructing a PiecewiseLinear
type.
The kind of thing you are talking about (piecewise affine over general polyhedra) is getting into the more advanced areas of modeling that JuMP hasn't strayed into yet, e.g. disjunctive programming.
Yeah it could make sense for the most complicated and hard-to-get-right variants to be done in a higher-level extension. Maybe we try to win over some folks at ETH Zurich and convince them to start making a port of MPT. Sorry for being so hard to please, JuMP is already awesome and continuing to get better impressively quickly.
Closing this as speculative and out of scope for JuMP 1.0.
I'll take this one :)
@joehuchette as a separate package, right?
Yep
On Sat, Dec 10, 2016 at 8:43 PM, Miles Lubin notifications@github.com wrote:
@joehuchette https://github.com/joehuchette as a separate package, right?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/JuliaOpt/JuMP.jl/issues/317#issuecomment-266254933, or mute the thread https://github.com/notifications/unsubscribe-auth/ABTzUkNM9WP0gcIqozDPo3bOZa131St3ks5rG1VLgaJpZM4C_O26 .
So technically still out of scope :)
So Gurobi has solver support for piecewise linear, and we have the world expert on piecewise linearity, so, lets think about how to model it. What do we need to have to express a piecewise linear function?
would be represented as
An alternative reduced form is have the breakpoints, the gradient, and an offset, e.g.
I suppose.
Heres some syntax ideas
To be continued, got to catch plane