Smooth vs. Non-smooth Functions

Smooth functions have a unique defined first derivative (slope or gradient) at every point. Graphically, a smooth function of a single variable can be plotted as a single continuous line with no abrupt bends or breaks. All the examples you've seen so far in this section have been smooth.

Non-smooth functions include non-differentiable and discontinuous functions. functions with first derivatives with undefined regions are called non-differentiable. Graphs of non-differentiable functions may have abrupt bends. The absolute value of a variable, @ABS(X), is an example of a non-differentiable expression, as illustrated in the following graph:

BMP00198

Graph of ABS(X)

Here, there is an abrupt bend in the graph at zero. This can dramatically increase solution times as well as affect the accuracy of the solution. Additional non-smooth functions are @MAX, @MIN, @SMAX, @SMIN, and any of the probability functions that use linear interpolation to return results for non-integral arguments.

Perhaps even more confounding than functions with sharp bends are discontinuous functions that have actual breaks in their graphs. Discontinuous functions in LINGO include @SIGN and @FLOOR.

In simplified terms, LINGO searches along the path of a function to find a maximum or minimum point representing an optimal solution. As LINGO is searching along a function, it uses the function's derivatives to help guide the search. When derivatives vanish, as they do at sharp corners, LINGO is "blinded" and is unable to "see" around the sharp corner. Thus, dealing with functions containing breaks and sharp bends is considerably more difficult than dealing with smooth, continuous functions. Where possible, non-smooth functions should be replaced with linear constraints or some combination of linear constraints and integer variables. As an example, refer to the assembly line balancing example (ASLBAL.LNG) to see a model that avoids the use of the @MAX function in order to maintain linearity.