Optimization variable which takes input in the form of matrix or vectors
6 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
J. Alex Lee
2018-8-8
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 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Get Started with Optimization Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!