How to execute multiple optimized values for x according to n, using fmincon
Mostrar comentarios más antiguos
Hello, kindly help me in finding n optimal values for x (x is a vector not single valued).
e.g. i have the main code
function Rsum Simple(x)
global n
R=20*1000;
Rn =x*R;
Rsum=sum(Rn);
end
by using fmincon i am optimizing x
clear all
clc
global n
n_vec=2:2:6;
throughput=[];
for n=n_vec
initial_guess=0.00002;
x0=initial_guess;
lb=0;
ub=0.7;
A = [];
b = [];
Aeq=[];
Beq=[];
[x,fval]= fmincon(@(x) Simple(x),x0,A,b,[],[],lb,ub);
max=-(fval);
throughput=[throughput max];
end
after executing first attempt i want to get 2 optimized values of x,in 2nd i need 4 optimized values and in 3rd time x=6, but i dont know how to execute it. can any body help me out to find multiple values of x(with respect to n).??
thank you in advance
Respuesta aceptada
Más respuestas (2)
Maheen Fazal
el 17 de Mayo de 2019
Editada: Maheen Fazal
el 17 de Mayo de 2019
0 votos
Maheen Fazal
el 17 de Mayo de 2019
0 votos
2 comentarios
Titus Edelhofer
el 17 de Mayo de 2019
Yes,
ub = repmat(ub, n, 1);
Maheen Fazal
el 17 de Mayo de 2019
Categorías
Más información sobre Linear Programming and Mixed-Integer Linear Programming en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!