# Parametric programming

Parametric programming is a type of mathematical optimization, where the optimization problem is solved as a function of one or multiple parameters. Developed in parallel to sensitivity analysis, its earliest mention can be found in a thesis from 1952. Since then, there have been considerable developments for the cases of multiple parameters, presence of integer variables as well as nonlinearities.

## Notation

In general, the following optimization problem is considered
    ${\begin{aligned}J^{*}(\theta )=&\min _{x\in \mathbb {R} ^{n}}f(x,\theta )\\&{\text{subject to }}g(x,\theta )\leq 0.\\&\theta \in \Theta \subset \mathbb {R} ^{m}\end{aligned}}$
where $x$ is the optimization variable, $\theta$ are the parameters, $f(x,\theta )$ is the objective function and $g(x,\theta )$ denote the constraints. $J^{*}$ denotes a function whose output is the optimal value of the objective function $f$. The set $\Theta$ is generally referred to as parameter space.
The optimal value (i.e. result of solving the optimization problem) is obtained by evaluating the function with an argument $\theta$.

## Classification

Depending on the nature of $f(x,\theta )$ and $g(x,\theta )$ and whether the optimization problem features integer variables, parametric programming problems are classified into different sub-classes:
* If more than one parameter is present, i.e. $m>1$, then it is often referred to as multiparametric programming problem
* If integer variables are present, then the problem is referred to as (multi)parametric mixed-integer programming problem
* If constraints are affine, then additional classifications depending to nature of the objective function in (multi)parametric (mixed-integer) linear, quadratic and nonlinear programming problems is performed. Note that this generally assumes the constraints to be affine.

## Applications
### In control theory generally and in process industries

The connection between parametric programming and model predictive control for process manufacturing, established in 2000, has contributed to an increased interest in the topic. Parametric programming supplies the idea that optimization problems can be parametrized as functions that can be evaluated (similar to a lookup table). This in turns allows the optimization algorithms in optimal controllers to be implemented as pre-computed (off-line) mathematical functions, which may in some cases be simpler and faster to evaluate than solving a full optimization problem on-line. This also opens up the possibility of creating optimal controllers on chips (MPC on chip). However, the off-line parametrization of optimal solutions runs into the curse of dimensionality as the number of possible solutions grows with the dimensionality and number of constraints in the problem.

### In CNC programming

Parametric programming in the context of CNC (computer numerical control) is defining part-cutting cycles in terms of variables with reassignable values rather than via hardcoded/hardwired instances. An archetypically simple example is writing a G-code program to machine a family of washers: there is often no need to write 15 programs for 15 members of the family with various hole diameters, outer diameters, thicknesses, and materials, when it is practical instead to write 1 program that calls various variables and reads their current values from a table of assignments. The program then instructs the machine slides and spindles to move to various positions at various velocities, accordingly, addressing not only the sizes of the part (i.e., OD, ID, thickness) but also even the speeds and feeds needed for any given material (e.g., low-carbon steel, high-carbon steel; stainless steel of whichever grade; bronze, brass, or aluminum of whichever grade; polymer of whichever type). Custom Macros are often used in such programming.