# \#piecewise

**URL:** https://discourse.julialang.org/tag/piecewise/1503.md

[Latest](https://discourse.julialang.org/latest.md) · [Categories](https://discourse.julialang.org/categories.md) · [Tags](https://discourse.julialang.org/tags.md)

---

## [Using CPLEX Piecewise Linear function](https://discourse.julialang.org/t/using-cplex-piecewise-linear-function/28403)

<div class="topic-metadata">

**Author:** [@Codzilla](https://discourse.julialang.org/u/Codzilla)\
**Replies:** 8\
**Last updated:** [September 1, 2025, 10:48am UTC](https://discourse.julialang.org/t/using-cplex-piecewise-linear-function/28403 "2025-09-01T10:48:51Z")

</div>

I’m trying to solve a MILP with an piecewise linear function in the cost function. At the moment, i’m using a binairy variable per linear piece wich is not the state of the art (see for example http://www.mit.edu/~jvielm…

---

## [Piecewise linear for a supply function](https://discourse.julialang.org/t/piecewise-linear-for-a-supply-function/130121)

<div class="topic-metadata">

**Author:** [@nemoincognito](https://discourse.julialang.org/u/nemoincognito)\
**Replies:** 1\
**Last updated:** [June 23, 2025, 8:08am UTC](https://discourse.julialang.org/t/piecewise-linear-for-a-supply-function/130121 "2025-06-23T08:08:52Z")

</div>

I am modelling costs for mines that have a fixed cost and a variable cost to slice the mine into realistic average costs for various levels of output. mine\_name = prod\_capa\_cost\_df\[100,:mine\_name\] capacity = prod\_capa\_c…

---

## [Piecewise linear regression with automatic knot selection](https://discourse.julialang.org/t/piecewise-linear-regression-with-automatic-knot-selection/93984)

<div class="topic-metadata">

**Author:** [@meghapatnaik](https://discourse.julialang.org/u/meghapatnaik)\
**Replies:** 9\
**Last updated:** [January 2, 2024, 8:42pm UTC](https://discourse.julialang.org/t/piecewise-linear-regression-with-automatic-knot-selection/93984 "2024-01-02T20:42:04Z")

</div>

Hi everyone, I am new to Julia, mostly work with R. I am looking for the equivalent of the “segmented” package in R, to fit a piecewise linear (constant in my special case) regression where the knot location is automate…

---

## [Modelling non-continuous piecewise linear functions](https://discourse.julialang.org/t/modelling-non-continuous-piecewise-linear-functions/106743)

<div class="topic-metadata">

**Author:** [@Galois](https://discourse.julialang.org/u/Galois)\
**Replies:** 4\
**Last updated:** [November 26, 2023, 8:07pm UTC](https://discourse.julialang.org/t/modelling-non-continuous-piecewise-linear-functions/106743 "2023-11-26T20:07:34Z")

</div>

I have an optimization problem where the objective (and some of the constraints) contain piecewise linear functions. The problem is relatively large and my attempts at solving it with pyomo and SCIP have not been very su…

---

## [Piecewise-constant fitting](https://discourse.julialang.org/t/piecewise-constant-fitting/94091)

<div class="topic-metadata">

**Author:** [@rafael.guerra](https://discourse.julialang.org/u/rafael.guerra)\
**Replies:** 21\
**Last updated:** [February 9, 2023, 12:40am UTC](https://discourse.julialang.org/t/piecewise-constant-fitting/94091 "2023-02-09T00:40:42Z")

</div>

Is there an example or a Julia package for piecewise-constant fitting of 1D series? See a Matlab example of expected results here. Thanks.

---

## [Performant piecewise function evaluation](https://discourse.julialang.org/t/performant-piecewise-function-evaluation/45762)

<div class="topic-metadata">

**Author:** [@archermarx](https://discourse.julialang.org/u/archermarx)\
**Replies:** 4\
**Last updated:** [August 30, 2020, 7:31pm UTC](https://discourse.julialang.org/t/performant-piecewise-function-evaluation/45762 "2020-08-30T19:31:20Z")

</div>

I’m working on developing a solver that requires piecewise-defined polynomial functions to be evaluated very frequently. The easiest way to define such a function would be something like function piecewise\_hardcoded(x) …
