Linear optimization without explicitly specifying the linear components?

Hi,

Im wondering if there is an optimization routine where I can give it a linear function, but in a general form f(x), and just tell matlab "trust me, its linear"

The only linear solvers ive found, you have to explicitly give them a matrix A and so on. but i was hoping there was a way to do this automatically with and argument like 'linear' or something

thanks!

Posted Aug 2, 2020, 1:04 PM UTC

67
a123m456•

I'm not sure what you're asking, you want to optimize an already linear function into a linear function? If I understand correctly, you can use "polyfit", you have to specify the order of the polynomial though, so just n=1, data_x, data_y, and that's it.

2
OpenResult3OP•

Hi, I want to find parameters to a function that is linear in those parameters, without specifying how. Polyfit is not ideal because I don't want to specify what the function looks like.

For example lets say I had a function y = f(x,p), where x is some input and p the parameter i want to find.

then lets say i could use 'lsqnonlin'. The goal function would then be

F(p) = f(x,p) - y

where F(p) is not dependent on x and y since i replace those variables with data.

Now what i want is to tell matlab that f(x,p) is linear in p, in the call to lsqnonlin like:

p = lsqnonlin( F, p0, 'linear')

or something like that.

Hope this was more clear, i was on my phone earlier hence the brevity

2
Uggi7•

You could as well use a nonlinear (local) solver (like fmincon) and trust the optimum to be a global optimum as it is a linear function.

2
OpenResult3OP•

Yeah this is what i'm currently doing but with lsqnonlin. i hoped that there was some way to get better performance if i told it the objective was linear, but haven't found a way to do that.

it seems to me like it would be a reasonable thing to exits though...

2
Uggi7•

I think, if you’re talking about computational performance, this is as good as it gets. Or you could simply rewrite it to a linear optimisation problem which shouldn’t be too hard.

1
SaubergerWalter•

Look at the SLM Toolbox in the Exchange, could be the right tool for you. Here you go

1
redditusername58+1•

You really might as well supply the matrices. Any gradient-based optimization algorithm is going to take finite differences of your objective and constraint functions to estimate the objective gradient and the constraint jacobian. For a linear problem these derivatives are constants which is why linear programming algorithms take them as arguments rather than the functions. If you need to you can use finite differences to create these arrays and since they're linear the step size doesn't even matter. Additionally, linear programming is different enough from nonlinear programming that for a difficult problem you really would prefer to use the more specialized algorithms.

1