problem based approach- script running but does not gives a solution
Ältere Kommentare anzeigen
hello everyone i am working on a problem where i choosed problem based approach to solve it. I am very new to MATLAB so i do not know what i am doing wrong but here is my question:
the script is running but it does not gives me any solution it just says 'Solving problem using ga' (i want to solve with ga). I dont think it iterates. I have set stopping criterias that is not the problem. I have been looking to find answers to my problem but could not find any. Anyhow, if you have any ideas why i am facing this situation and suggestions to solve it i would be appreaciated.
Thank you in advance!
10 Kommentare
KSSV
am 10 Apr. 2022
Show us the script.
Azime Beyza Ari
am 10 Apr. 2022
Azime Beyza Ari
am 10 Apr. 2022
Bearbeitet: Azime Beyza Ari
am 10 Apr. 2022
Azime Beyza Ari
am 10 Apr. 2022
Torsten
am 10 Apr. 2022
According to the equations you enclosed earlier, your problem should be solvable using "intlinprog".
My guess is that something went wrong in the problem formulation in the problem-based approach or that you have hidden some details of your model for us (e.g. nonlinearities) that force MATLAB to use "ga".
Azime Beyza Ari
am 10 Apr. 2022
Torsten
am 10 Apr. 2022
Then you should look at the changes you made to the old file and think about why MATLAB now thinks it's necessary to use "ga" for your problem.
Azime Beyza Ari
am 10 Apr. 2022
Matt J
am 10 Apr. 2022
Be mindfull of the (-1) in your function,
z= (-1)*sum(x.*rij.*ai,'all');
Because you have set ObjectiveSense="maximize", the (-1) makes it so that you are effectively minimizing z= sum(x.*rij.*ai,'all').
Antworten (1)
There is only one objective, and two constraints so far and they all are linear. When i write my objective function it forces me to use ga. Did not understand why.
It forces you to use ga() because you have specified your objective function using fcn2optimexpr(). When you specify it as below, the solver can tell right away that it is an integer linear program, and solves it very quickly with initlinprog,
load Problem
x=problem.Variables.x;
y=problem.Variables.y;
problem.Objective=sum((x.*rij)*ai);
sol=solve(problem);
sol.x=round(sol.x);
sol.y=round(sol.y);
Kategorien
Mehr zu Genetic Algorithm finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
