Multiple inputs, multiple outputs; solving when you have simple linear models

1.1k Views Asked by At

I am working on a mathematical problem related to a steady state controls problem, and I think this might be the place to ask this. I've figured out some of the simple cases, and am wondering where might the best place to look for a more generic solution, since the real problem involves more inputs (over 50; this is a problem for multiple light sources and sensors, but could be applied to multi-zone heating ovens, for example).

The problem is simplified, since the outputs are linearly dependent on the inputs.

For a single input, and three outputs; say, a single light illuminating 3 sensors:

enter image description here

I've been able to write out the following; the coefficients are based on geometry, and are fixed.

y1=a*x1+b

y2=c*x1+d

y3=e*x1+f

The goal is to have the values y1, y2, and y3 set to some specific outputs (ya, yb, and yc; in our case the same values, but I solved the generic case).

If we create a objective function F=(ya-y1)^2+(yb-y2)^2+(yc-y3)^2, and derive w/r/t x1 and set to zero, I can find a best fit for things:

x1=((a * ya + c * yb + e * yc)-(a * b + c * d + e * f))/(a^2+c^2+e^2)

(For example, for a = 1, b = -3, c = 2, d = -10, e = 5, f = -25, with ya = 10, yb = 11, yc = 12, the objective function (F = 59) is smallest at x1 = 8).

I've checked this result against a spreadsheet solver algorithm, so I think my algebra is correct.

For a 3 input, 3 output problem; say, 3 lights illuminating 3 sensors:

enter image description here

... the equations are:

y1= a0 + a1 * x1 + a2 * x2 + a3 * x3

y2= b0 + b1 * x1 + b2 * x2 + b3 * x3

y3= c0 + c1 * x1 + c2 * x2 + c3 * x3

I actually solved this problem first, but used a spreadsheet solver, where the objective function is still F=(ya-y1)^2+(yb-y2)^2+(yc-y3)^2. Asking the solver to vary y1, y2, and y3, and minimizing F works.

The more general case(s)

Where do I look for solving problems where I've got n inputs, and m outputs, when the relations are linear? Is a spreadsheet solver still going to cut it? It kind of bothers me that it is a bit of black magic which I'm not clear how it solves it.

When inputs are less than outputs (like the first problem), solving algebraically for larger values of n seems unwieldy. I've looked at the two input, 4 output problem, and have tentatively solved it, but you start to turn your paper sideways when deriving for more inputs. This problem has a lot more inputs and outputs (we'll be looking at as many sensors), so unless I'm mistaken, algebra is out.

I'm thinking this is somewhat related to curve fitting of the multiple linear input problem, where you have y = a0 + a1 * x1 + a2 * x2 + a3 * x3 + ..., and are trying to find the coefficients a0, a1, a2 etc, given a bunch of data.

In this case, we know the coefficients, but want to set the outputs, but am not quite sure where to go next. I've used Nelder-Mead (https://en.wikipedia.org/wiki/Nelder%E2%80%93Mead_method) in the past for solving nonlinear 2D problems; would this be a solution, perhaps? Are there any open-source solvers/libraries in Python that might help here?

1

There are 1 best solutions below

0
On

Hint.

As far as I understood, it seems that your problem can be represented as

$$ E(x) = ||A x+b-y_0|| $$

or

$$ E^2(x) = x^t A^t A x +2(b-y_0)A x + ||b-y_0||^2 $$

with minimum at

$$ A^tA x_0+A^t(b-y_0) = 0 $$

with

$$ x_0 = -(A^t A)^{-1}A^t(b-y_0) $$

Here

$b = (a_0,b_0,\cdots, n_0)$ and $y_0 = (y_a, y_b,\cdots, y_n)$

The linear modeling can give strange solutions. For example, in case of $x$ associated to light sources the solution can give darkening properties to some sources... ($ x < 0$)