Skip to Main Content
Efficient methods for evaluation of piecewise functions defined over convex polyhedral partitions are proposed. As an important application, the explicit model predictive control problem is considered which requires a piecewise affine (PWA) control law to be evaluated online. The widely used binary search tree (BST) method is modified to be able to deal with a wider class of problems for which the BST method becomes prohibitive in terms of preprocessing time or memory requirements. The proposed method combines an orthogonal truncated binary search tree (OTBST) and lattice representation for PWA functions in a unified structure enjoying the advantages of both approaches. Both OTBST and Lattice-based OTBST (LOTBST) methods enable the designer to tradeoff between preprocessing time, storage requirement, and online computation time. The OTBST approach can be applied to more general partitions, e.g., discontinues and overlapping, while the LOTBST is directed towards more efficient evaluation of PWA functions, associated to the explicit MPC solutions. The key feature of the proposed methods is that the exact solution can be computed with predefined worst case online computation time guarantees. The computations are readily implementable using fixed-point arithmetic on a low cost microcontroller since there is no recursive accumulation of round-off errors, and the online algorithm is simple with a small footprint suitable for formal verification of correctness of implementation. Using several examples it is shown that the proposed LOTBST leads to a considerably less preprocessing time and memory requirement comparing to the pure BST and less online computation time comparing to the pure lattice representation.