(!****************************************************** Mosel Example Problems ====================== file approx2.mos ```````````````` Function approximation via piecewise linear expression (c) 2021 Fair Isaac Corporation author: S. Heipcke, July 2021 *******************************************************!) model "Approximation (pwlin)" uses "mmxnlp" declarations NB = 5 BREAKS = 1..NB X,FX: array(BREAKS) of real ! Coordinates of break points x,f: mpvar ! Decision variables end-declarations X:: [1, 2.2, 3.4, 4.8, 6,5] FX:: [2, 3.2, 1.4, 2.5, 0,8] f = pwlin(x, union(i in BREAKS) [X(i),FX(i)]) ! Bounds 1<=x; x<=6,5 ! Solve the problem minimize(f) writeln("Objective value: ", getobjval) writeln("x: ", getsol(x)) end-model