Parametric optimisation toolbox help

I am a completely new user of MATLAB so some of the things I may say may sound dumb to the more experienced users out there.
I am looking into the optimal design of structural beams. Therefore, I was thinking of using the optimisation function "fminncon" to find the optimal design variables (e.g the depth and width of the beam) to give a minimal weight solution for a given span with multiple design constraints.
My question is, is there a way to find the optimal solution for different spans without manually changing the span each time.
So i am asking if it is possible to change span in intervals such as 1m to 15m at 0.1m intervals with and optimal solution for each 0.1m interval span. Is this feasible?
In the end i want to plot a span to optimal depth using the outputs. I do apologise if what I have said isn't clear as I am still in the early stages of modelling the problem so wanted to see what optimisation techniques i can use before i dive into the coding of it.

7 个评论

Can you show the code to find the optimal solution for a given span value (say 1m)?
I have yet to start coding it. Just wanted to see if what i want is possible to do before I start anything. I looked at some of the suggested threads below and I think I can get around this problem by using a for loop outside the fmincon function to get optimal values for each of my spans.
I'll start coding and if I the above does not work I will come back with the code and would appreciate any help i can get.
Thank you for your time!
Is it possible with fmincon? No.
Fmincon cannot use discrete variables, exactly what you are asking to do. Other solvers, GA specifically, can solve such a problem. But NOT fmincon.
Yes, using for loop, you can find the optimal solution for different values of parameter once you have developed the code for a single value. Consider a very simple example
A = 1:20; % parameter that will change in each iteration
f_sol = zeros(1, 20); % initialize the vectors for the optimal value
for i=1:numel(A)
a = A(i);
f = @(x) (x-a).^2; % the objective function
f_sol(i) = fmincon(f, 0);
end
John, I think that the OP is trying to solve the problem with continuous variables. OP wanted to know whether it is possible to solve the optimization problem for different values of parameters automatically.
Ameer, Yes that is exactly what I was looking to do. Thank you very much, this reassured me that I am heading the right direction!
John, as Ameer explained the problem will have continuous variables within the fmincon to find the optimal design variables. I wanted to see if i could execute fmincon multiple times with different spans without going into the code and manually changing it each time (within fmincon the span is a fixed value).
Thank you both for your help, it was very useful and I hope you have a lovely day!

请先登录,再进行评论。

 采纳的回答

Sadu
Sadu 2020-3-28
For anyone who comes upon this post, the thread has been answered by Ameer Hamza. Link to comment is shown below:

更多回答(0 个)

类别

帮助中心File Exchange 中查找有关 Get Started with Optimization Toolbox 的更多信息

产品

版本

R2017b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by