Migrating from version 0.4

Version 0.5 is a rewrite with a new interface. The main changes are:

  • Methods are values of their own types instead of symbols, e.g. method = Logarithmic() instead of method = :Logarithmic.
  • piecewiselinear is replaced by PiecewiseLinear objects, which hold the function, the method and the direction, and are called with the inputs to add the function to their model, e.g. f(x). The function is given before the breakpoints, so that a do block can be used. add_formulation also returns the PWLFormulation with the variables and constraints that were added.
  • The triangulation of bivariate functions is given as a value with the triangulation keyword instead of the pattern keyword, and the default is now K1Triangulation instead of best fit. The default method of bivariate functions depends on the triangulation, see Formulation methods, instead of always being the six-stencil formulation; pass method = SixStencil() to keep it.
  • Functions may have several outputs, more than two inputs and, for some methods, discontinuities.
  • The direction keyword takes Epigraph() or Hypograph() for a function that is only bounded from one side, instead of modeling its graph.

Methods

Version 0.4Version 0.5
:Logarithmic, :LogLogarithmic()
:LogarithmicIB, :LogIBLogarithmicIndependentBranching()
:ZigZag, :ZZBZigZagBinary()
:ZigZagInteger, :ZZIZigZagInteger()
:GeneralizedCelaya, :SymmetricCelayaremoved, use e.g. ZigZagInteger() for a general integer formulation
:SOS2NativeSOS2()
:CCConvexCombination()
:MCMultipleChoice()
:DisaggLogarithmic, :DLogDisaggregatedLogarithmic()
:IncrementalIncremental()
:OptimalIB with subsolver = sOptimalIndependentBranching(s)
bivariate with an SOS2 method m, e.g. :LogarithmicSixStencil(m), NineStencil(m), K1(m), UnionJack(m) or OptimalTriangleSelection(s, m)

Functions and triangulations

Version 0.4Version 0.5
UnivariatePWLFunction(x, z)UnivariatePWLFunction(x, z), unchanged
BivariatePWLFunction(x, y, f; pattern = :BestFit)BivariatePWLFunction(x, y, f; triangulation = BestFitTriangulation())
pattern = :K1triangulation = K1Triangulation()
pattern = :UnionJacktriangulation = UnionJackTriangulation()
pattern = :Uppertriangulation = UpperTriangulation()
pattern = :Lowertriangulation = LowerTriangulation()
pattern = :Randomtriangulation = RandomTriangulation(seed)
fields pwl.x, pwl.z, pwl.Tsegments(pwl), and evaluation with pwl(x...)

Adding functions

Version 0.4Version 0.5
z = piecewiselinear(m, x, d, f; method = :CC) with a function fz = PiecewiseLinear(f, d; method = ConvexCombination())(x)
z = piecewiselinear(m, x, d, fd) with values fdz = PiecewiseLinear(d, fd)(x)
z = piecewiselinear(m, x, y, dx, dy, f; method = :Log)z = PiecewiseLinear(f, dx, dy; method = SixStencil())(x, y)
z = piecewiselinear(m, x, pwl)z = PiecewiseLinear(pwl)(x), or (z,), formulation = add_formulation(m, PiecewiseLinear(pwl), x)
z = piecewiselinear(m, x, y, pwl)z = PiecewiseLinear(pwl)(x, y)