I have a real world problem where the math is beyond me. I'm trying to set up an automated resistor bank much like a decade box. I have $18$ channel that I can switch in up to four channels in parallel at a time. Each channel is a fixed resistor value. The system will take a target resistance and calculate which channels to turn on (up to four of the $18$) to get the closest resistance to the target. That part is easy. The part I need help with is picking the fixed resistor values for the $18$ channels. I want to minimize the error between the target resistance and of the resistance value of the four channels switch in. Here's what I have:
$R_t$ = target resistance
$R_1$ = $1$ of $18$ fixed values
$R_2$ = $1$ of $17$ fixed values (one fix value used for $R_1$)
$R_3$ = $1$ of $16$ fixed values (two fix values used for $R_1$ & $R_2$)
$R_4$ = $1$ of $15$ fixed values (three fixed values used for $R_1$, $R_2$ & $R_3$)
Lets just take the case where we always switch in four channels so the error would be:
$$\left|\frac{1}{R_t} - (\frac{1}{R_1}+\frac{1}{R_2}+\frac{1}{R_3}+\frac{1}{R_4})\right|$$
Lets put some bounds on it. The target resistance can be from $25$ to $300$ and any of the $18$ fixed resistor channels can be from $25$ to $10,000$
I was thinking the integral from $25$ to $300$ equals zero but I don't want the sum of the errors to be zero. I want the largest error (for $25\to300$) to be the smallest it can be. Plus I don't know how to deal with the problem that $R_1\to R_4$ can change to anyone of the $18$ fixed values at any time. I don't know how to work the fixed values into the equation and solve for them.