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.
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 Exchange에서 Get 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