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 件のコメント

Ameer Hamza
Ameer Hamza 2020 年 3 月 28 日
Can you show the code to find the optimal solution for a given span value (say 1m)?
Sadu
Sadu 2020 年 3 月 28 日
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!
John D'Errico
John D'Errico 2020 年 3 月 28 日
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.
Ameer Hamza
Ameer Hamza 2020 年 3 月 28 日
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
Ameer Hamza
Ameer Hamza 2020 年 3 月 28 日
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.
Sadu
Sadu 2020 年 3 月 28 日
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!
Ameer Hamza
Ameer Hamza 2020 年 3 月 28 日
Glad to be of help.

サインインしてコメントする。

 採用された回答

Sadu
Sadu 2020 年 3 月 28 日

0 投票

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeGet Started with Optimization Toolbox についてさらに検索

製品

リリース

R2017b

質問済み:

2020 年 3 月 28 日

回答済み:

2020 年 3 月 28 日

Community Treasure Hunt

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

Start Hunting!

Translated by