A recent question on OR Stack Exchange has to do with getting an regression fit to some data. (I'm changing notation from the original post very slightly to avoid mixing sub- and super-scripts.) The author starts with observations of the dependent variable and seeks to find (, ) so as to minimize the error The author was looking for a way to linearize the objective function.
The solution I proposed there begins with a change of variables: The variables are nonnegative and must obey the constraint With this change of variables, the objective becomes Add nonnegative variables () and the constraints and the objective simplifies to minimizing , leaving us with an easy linear program to solve.
That leaves us with the problem of getting from the LP solution back to the original variables . It turns out the transformation from to is invariant with respect to the addition of constant offsets. More precisely, for any constants (), if we set and perform the transformation on , we get This allows us to convert from back to as follows. For each , set and note that Given the invariance to constant offsets, we can set and use the log equation to find for .
Well, almost. I dealt one card off the bottom of the deck. There is nothing stopping the LP solution from containing zeros, which will automatically be the smallest elements since . That means the log equation involves dividing by zero, which has been known to cause black holes to erupt in awkward places. We can fix that with a slight fudge: in the LP model, change to for some small positive and hope that the result is not far from optimal.
I tested this with an R notebook. In it, I generated values for uniformly over , fit using the approach described above, and also fit it using a genetic algorithm for comparison purposes. In my experiment (with dimensions , ), the GA was able to match the LP solution if I gave it enough time. Interestingly, the GA solution was dense (all ) while the LP solution was quite sparse (34 of 1,000 values of were nonzero). As shown in the notebook (which you can download here), the LP solution could be made dense by adding positive amounts as described above, while maintaining the same objective value. I tried to make the GA solution sparse by subtracting from the -th row of . It preserved nonnegativity of and maintained the same objective value, but reduce density only from 1 to 0.99.