fmincon and choosing different initial values

6 Ansichten (letzte 30 Tage)
Az.Sa
Az.Sa am 1 Mär. 2023
Kommentiert: Star Strider am 1 Mär. 2023
I have nonlinear optimization problem.I write the MATLAB code using fmincon given below. Now, I want to run the code for different initial point using a loop for to check the solutions. How can I do that and find the best initial values? Also, how can I improve my code and make sure that I am not having a local maximization ?
R=readtable('r.csv');
R=table2array(R);
w1= [ ; ; ; ; ; ];
w2= [ ; ; ; ; ; ];
w3= [ ; ; ; ; ; ];
w4= [ ; ; ; ; ; ];
w5= [ ; ; ; ; ; ];
w6= [ ; ; ; ; ; ];
W = [w1.'; w2.'; w3.'; w4.';w5.';w6.'];
gamma = 2;
Aeq = [1 1 1 1 1 1];
beq = 1;
lb = zeros(6,1);
ub = ones(6,1);
x0=
u = @(x) 1/(1-gamma)*x.^(1-gamma);
obj = @(x)-sum(u(x*W.'*R));
x = fmincon(obj,x0,[],[],Aeq,beq,lb,ub)
I run the code by using x0=0.1667*ones(1,6); and I recived
Local minimum found that satisfies the constraints.
Optimization completed because the objective function is non-decreasing in
feasible directions, to within the value of the optimality tolerance,
and constraints are satisfied to within the value of the constraint tolerance.
<stopping criteria details>
How would I improve my solution ? what should I change ?

Antworten (1)

Star Strider
Star Strider am 1 Mär. 2023
The Global Optimization Toolbox has a number of functions that can search the parameter space for different initial parameter estimates and determine the best set. My favourite is ga, and there are others such as GlobalSearch, and MultiStart. Search the documentation for still more options.
  2 Kommentare
Az.Sa
Az.Sa am 1 Mär. 2023
can you please explain more ? how can I add it to my code ?
Star Strider
Star Strider am 1 Mär. 2023
Please see the documentation I linked to in order to understand how to use the appropriate function with your code.
Also, unless you need to know the column headers (variable names) in your file, use readmatrix instead of readtable and then table2array.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Linear Programming and Mixed-Integer Linear Programming finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by