# A tight formulation of a specific kind of convex PWL curve

**URL:** <https://discourse.julialang.org/t/a-tight-formulation-of-a-specific-kind-of-convex-pwl-curve/134822>\
**Category:** Optimization (Mathematical)\
**Tags:** question, jump, powermodels\
**Created:** [January 1, 2026, 8:35am UTC](https://discourse.julialang.org/t/a-tight-formulation-of-a-specific-kind-of-convex-pwl-curve/134822 "2026-01-01T08:35:36Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![WalterMadelim](https://avatars.discourse-cdn.com/v4/letter/w/3e96dc/32.png) [@WalterMadelim](https://discourse.julialang.org/u/WalterMadelim)\
**Post date:** [January 1, 2026, 8:35am UTC](https://discourse.julialang.org/t/a-tight-formulation-of-a-specific-kind-of-convex-pwl-curve/134822/1 "2026-01-01T08:35:36Z")

</div>

I’ve read some piecewise linear (PWL)-related stuff from JuMP’s doc.

It appears that I haven’t seen the particular formulation below, which I think is worth mentioning. It’s from the generation cost curve of generators in power networks. Typically they are convex quadratic, but for large-scale problems we may opt to use a PWL function instead (so we end up with LPs).

 ![image](https://global.discourse-cdn.com/julialang/original/3X/3/3/33aff075e387a0fe681272072231b924d94067fe.jpeg)

Let’s assume there are just 2 pieces for simplicity, as the above image indicates.

It appears that the following formulation is the _tightest_.

```julia-auto
p = ( # model the lower segment and the higher segment generations
    l = JuMP.@variable(model, lower_bound = 0, upper_bound = Δ1),
    h = JuMP.@variable(model, lower_bound = 0, upper_bound = Δ2)
)
JuMP.@constraint(model, Gmin + sum(p) == Load) # power balance of the power network
JuMP.@objective(model, Min, c1 * p.l + c2 * p.h) # Minimize generation costs (constants can be dropped)

```

In the above code I merely considered a single generator. But It extends naturally to multiple generators, each of them having a 2-piecewise linear cost function.

I wonder if this formulation is better than all existing methods (e.g. the convex combination, or the cutting plane formulation). If so, I think it’s worth mentioning this method in JuMP’s doc?

---

<div class="post-metadata">

**Author:** ![ccoffrin](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ccoffrin/32/400_2.png) [@ccoffrin](https://discourse.julialang.org/u/ccoffrin)\
**Post date:** [January 4, 2026, 5:15pm UTC](https://discourse.julialang.org/t/a-tight-formulation-of-a-specific-kind-of-convex-pwl-curve/134822/2 "2026-01-04T17:15:47Z")

</div>

I won’t comment on the JuMP docs, that is @odow area.

Given you are interesting in modeling power system problems you may find these refrences interesting.

An experimental study of the 4 variants of PWL funs on AC-OPF.

> **[The Impacts of Convex Piecewise Linear Cost Formulations on AC Optimal Power...](https://arxiv.org/abs/2005.14087)**
>
> Despite strong connections through shared application areas, research efforts on power market optimization (e.g., unit commitment) and power network optimization (e.g., optimal power flow) remain largely independent. A notable illustration of this is...

Reference implementation in PowerModels,

> **[PowerModelsAnnex.jl/src/piecewise-linear at master ·...](https://github.com/lanl-ansi/PowerModelsAnnex.jl/tree/master/src/piecewise-linear)**
>
> A PowerModels.jl Extension Package for Exploratory Work - lanl-ansi/PowerModelsAnnex.jl

In this work the 4 variants considered are all equivalent in terms of _tightness_.

---

<div class="post-metadata">

**Author:** ![odow](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/odow/32/28685_2.png) [@odow](https://discourse.julialang.org/u/odow)\
**Post date:** [January 4, 2026, 8:44pm UTC](https://discourse.julialang.org/t/a-tight-formulation-of-a-specific-kind-of-convex-pwl-curve/134822/3 "2026-01-04T20:44:06Z")

</div>

Feel free to make a pull request to add this to the JuMP docs.

We have [Approximating nonlinear functions · JuMP](https://jump.dev/JuMP.jl/dev/tutorials/linear/piecewise_linear/) and [Tips and tricks · JuMP](https://jump.dev/JuMP.jl/dev/tutorials/linear/tips_and_tricks/#Piecewise-linear-approximations), but I guess we could have a whole tutorial on piecewise linear formulations.

---

<div class="post-metadata">

**Author:** ![WalterMadelim](https://avatars.discourse-cdn.com/v4/letter/w/3e96dc/32.png) [@WalterMadelim](https://discourse.julialang.org/u/WalterMadelim)\
**Post date:** [January 5, 2026, 3:56am UTC](https://discourse.julialang.org/t/a-tight-formulation-of-a-specific-kind-of-convex-pwl-curve/134822/4 "2026-01-05T03:56:25Z")

</div>

Thanks, I’ve read your paper, the Δ-formulation is indeed valid. According to your results therein, the convex combination (λ-)formulation is also competitive.

Personally I think the Δ-model is the most concise in terms of problem formulation, and is also intelligible. I’ll stick to this option.

* * *

I’ll do some large-scale tests later on.
