what changes should i make in final optimised value with opt time vector
Mostrar comentarios más antiguos
Any modifications to be done in the final optimized value that specify a combination of step size (Ts) and number of iterations (N)?
I am getting a higher optimized value in a problem based optimization problem ,should i make any changes in the final Fval since
opt Time=5*60=300 chosen in my problem?
2 comentarios
Image Analyst
el 26 de Sept. de 2021
Can you just run through a brute force trial of all possible combinations?
NN
el 26 de Sept. de 2021
Respuestas (1)
Use prob2struct
s=prob2struct(prob);
s.f0
The value of s.f0 will be the discrepancy between a problem-based linear optimization and a solver-based linear optimization.
4 comentarios
NN
el 26 de Sept. de 2021
Yes, it is possible. The fval returned in both the problem-based and solver-based solvers can always be trusted to agree up to an additive constant. However, the problem-based framework allows you to specify a linear program objective function of the form f.'*x + f0, whereas the solver-based linear program solvers do not. If you feed a problem description structure to a solver-based solver, it will always ignore the f0 that you specify and assume f0=0. That is why there is a difference of 2.7 in the fvals in the example below.
x=optimvar('x',2,'LowerBound',0);
objective=dot(x,-[5,4])+2.7;
constraints.con1=sum(x)<=3;
constraints.con2=dot(x,[2,7])<=pi;
prob=optimproblem('Objective',objective,'Constraints',constraints);
%%%%% Problem based
[sol,fval1]=solve(prob);
x1=sol.x,fval1
%%%%%% Solver-based equivalent
s=prob2struct(prob);
[x2,fval2]=linprog(s)
difference=fval1-fval2
NN
el 27 de Sept. de 2021
Matt J
el 27 de Sept. de 2021
I am not sitting beside you at your computer. I cannot see what you entered...
Categorías
Más información sobre Get Started with Optimization Toolbox 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!