# Linearize sum of piecewise linear constraints

**URL:** <https://discourse.julialang.org/t/linearize-sum-of-piecewise-linear-constraints/11176>\
**Category:** Optimization (Mathematical)\
**Created:** [May 27, 2018, 2:54am UTC](https://discourse.julialang.org/t/linearize-sum-of-piecewise-linear-constraints/11176 "2018-05-27T02:54:46Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jacob-roth](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jacob-roth/32/1862_2.png) [@jacob-roth](https://discourse.julialang.org/u/jacob-roth)\
**Post date:** [May 27, 2018, 2:54am UTC](https://discourse.julialang.org/t/linearize-sum-of-piecewise-linear-constraints/11176/1 "2018-05-27T02:54:46Z")

</div>

Cross posted [here](https://math.stackexchange.com/questions/2797042/linearize-a-sum-of-linear-and-piecewise-linear-functions), but asking a variant on this forum.

I want to write a sum of piecewise linear constraints as an LP and am hoping to compare my approach with how `Convex.jl` or `JuMP` does it.

In particular, I believe that I can express the following constraint:

c\_1\max(y + |x| - d\_1, 0) + c\_2\max(y + |x| - d\_2, 0) + e - fy \leq 0 \tag{$\*$}

where x,y are scalar decision variables, and c\_i, d\_i, e, f \geq 0 as the set of linear constraints

c\_1(y+|x| - d\_1) + c\_2(y + |x| - d\_2) + e - fy \leq 0 \\ c\_1(y+|x| - d\_1) + e - fy \leq 0 \\ c\_2(y + |x| - d\_2) + e - fy \leq 0 \\ e - fy \leq 0

I tried looking at the actual constraints that `Convex.jl` is using when it parses (\*) by printing `problem.constraints`, but but it doesn’t seem to show how it breaks down (\*) into simpler constraints. Where in the source would I look, or is there a way to print off the simplified constraints (for either `JuMP` or `Convex.jl`) and see how the solvers are parsing them?

Thanks!
