# Best way to model a piecewise linearization for \`f(x) = x^0.8\` on \`\[0, 1e5\]\` with PiecewiseLinearOpt.jl?

**URL:** https://discourse.julialang.org/t/best-way-to-model-a-piecewise-linearization-for-f-x-x-0-8-on-0-1e5-with-piecewiselinearopt-jl/131963
**Category:** Optimization (Mathematical)
**Tags:** question
**Created:** [August 30, 2025, 11:18am UTC](https://discourse.julialang.org/t/best-way-to-model-a-piecewise-linearization-for-f-x-x-0-8-on-0-1e5-with-piecewiselinearopt-jl/131963 "2025-08-30T11:18:43Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![karei](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/karei/32/214809_2.png) [@karei](https://discourse.julialang.org/u/karei)
#### Post date: [August 30, 2025, 11:18am UTC](https://discourse.julialang.org/t/best-way-to-model-a-piecewise-linearization-for-f-x-x-0-8-on-0-1e5-with-piecewiselinearopt-jl/131963/1 "2025-08-30T11:18:43Z")

</div>

**Hi all,**

I have an optimization model where I need to replace a concave cost term  
f(x) = x^{0.8} for x \in [0, 10^5] with a piecewise linear (PWL) form in JuMP. The model is a minimization, and I’m considering using PiecewiseLinearOpt.jl.

My questions are:

1. Among the package’s formulations (`:SOS2`, `:Logarithmic`…), which would you recommend on large instances? My current guess is `:DisaggLogarithmic` or `:Logarithmic` for strong relaxations with O(\log K) binaries; does that match your experience?

2. For a concave f in minimization, should I feed PiecewiseLinearOpt an **upper envelope** (tangent-based over-estimator) as the (d, f\_d) breakpoints? Any pitfalls near x=0 where the slope blows up? Should I start from a small \varepsilon\>0?

3. I also have an binary decision y \in \{0,1\} with logic “if y=0, then x=0 ; if y=1, then x \in [x\_{\min}, x\_{\max}] and the value of f follows the PWL”. should I model the off/on disjunction myself with standard JuMP constraints?

4. In the literature, I’ve seen a Hull reformulation: split the domain into area intervals [{\rm LO}\_t, {\rm UP}\_t], introduce **segment binaries** z\_t and **disaggregated variables** x\_t, c\_t, enforce

Any pointers, examples, or best-practice snippets would be much appreciated. Thanks!

---

<div class="post-metadata">

### Author: ![ohmsweetohm1](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ohmsweetohm1/32/49126_2.png) [@ohmsweetohm1](https://discourse.julialang.org/u/ohmsweetohm1)
#### Post date: [August 30, 2025, 11:49am UTC](https://discourse.julialang.org/t/best-way-to-model-a-piecewise-linearization-for-f-x-x-0-8-on-0-1e5-with-piecewiselinearopt-jl/131963/2 "2025-08-30T11:49:09Z")

</div>

> **[Approximating nonlinear functions · JuMP](https://jump.dev/JuMP.jl/stable/tutorials/linear/piecewise_linear/#Piecewise-linear-approximation)**
>
> Documentation for JuMP.

```julia-auto
function piecewise_linear_sin(x̄)
    f(x) = sin(x)
    # Tip: try changing the number of points in x̂
    x̂ = range(; start = 0, stop = 2π, length = 7)
    ŷ = f.(x̂)
    n = length(x̂)
    model = Model(HiGHS.Optimizer)
    set_silent(model)
    @variable(model, 0 <= x <= 2π)
    @variable(model, y)
    @variable(model, 0 <= λ[1:n] <= 1)
    @constraints(model, begin
        x == sum(λ[i] * x̂[i] for i in 1:n)
        y == sum(λ[i] * ŷ[i] for i in 1:n)
        sum(λ) == 1
        λ in SOS2() # <-- this is new
    end)
    @constraint(model, x == x̄) # <-- a trivial constraint just for testing.
    optimize!(model)
    assert_is_solved_and_feasible(model)
    return value(y)
end

```

---

<div class="post-metadata">

### Author: ![jd-foster](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jd-foster/32/35824_2.png) [@jd-foster](https://discourse.julialang.org/u/jd-foster)
#### Post date: [November 28, 2025, 9:16am UTC](https://discourse.julialang.org/t/best-way-to-model-a-piecewise-linearization-for-f-x-x-0-8-on-0-1e5-with-piecewiselinearopt-jl/131963/3 "2025-11-28T09:16:45Z")

</div>

Did you find out answers to any of your questions?

---

<div class="post-metadata">

### Author: ![karei](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/karei/32/214809_2.png) [@karei](https://discourse.julialang.org/u/karei)
#### Post date: [November 28, 2025, 10:39am UTC](https://discourse.julialang.org/t/best-way-to-model-a-piecewise-linearization-for-f-x-x-0-8-on-0-1e5-with-piecewiselinearopt-jl/131963/4 "2025-11-28T10:39:13Z")

</div>

Yes. I’ve tried all of the methods mentioned above, and my conclusion is that they all work; the only real difference is solve time.

It’s hard to say which method is actually “better” (Convex-hull, PiecewiseLinearOpt, …), because none of them consistently wins across different problems. Even on the same problem, changing the parameters can flip which one performs best. The only thing I’ve reliably observed so far is that if the breakpoints in the piecewise linearization are strictly increasing, the `:Incremental` formulation can be a bit faster than the other `PiecewiseLinearOpt` options.

I’d also like to thank @ohmsweetohm1 for the earlier reply.
