Optimization variable which takes input in the form of matrix or vectors
6 views (last 30 days)
Show older comments
I need to multiply a 100×48 matrix with a 48×1 vector and the sum of the elements of the resultant vector is the objective function. Is it possible that i can model the optimization variables as the columns of the 100×48 matrix?. If so how to write the bounds and objective function. I am using ga solver.
2 Comments
Accepted Answer
J. Alex Lee
on 8 Aug 2018
That doesn't seem like a mathematically well-posed optimization problem...but in general Matlab's fminX routines are multidimensional. Maybe you can just reshape to achieve your goal?
x0 = rand(100,48) % initial guess of unknowns to solve for
y = rand(48,1) % your parameters governing the optimization
x = fminX(@(x)objFn(x,y),x0(:)) %
function r = objFn(x,y)
x = reshape(x,100,48); % or compute the correct dimensions based on numel(x) and length(y)
r = sum(x*y); % or do you want sum(abs(x*y))?
end
you would similarly reshape your bounds into vectors.
Or, a quick search reveals that Matlab's fminX functions actually do accept matrix arguments: https://www.mathworks.com/help/optim/ug/matrix-arguments.html.
0 Comments
More Answers (0)
See Also
Categories
Find more on Get Started with Optimization Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!