what changes should i make in final optimised value with opt time vector

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

Can you just run through a brute force trial of all possible combinations?
Thank you fo rthe reply , Can you please detail what exactly meant and how it can be done

Iniciar sesión para comentar.

Respuestas (1)

Matt J
Matt J el 26 de Sept. de 2021
Editada: Matt J el 26 de Sept. de 2021
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

Please explain .
So in problem based optimization, it is not possible to get fval?
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);
Solving problem using linprog. Optimal solution found.
x1=sol.x,fval1
x1 = 2×1
1.5708 0
fval1 = -5.1540
%%%%%% Solver-based equivalent
s=prob2struct(prob);
[x2,fval2]=linprog(s)
Optimal solution found.
x2 = 2×1
1.5708 0
fval2 = -7.8540
difference=fval1-fval2
difference = 2.7000
When i tried to use probstruct , it gives the following error
Unable to convert 'struct' to 'sym'.
Please advice
I am not sitting beside you at your computer. I cannot see what you entered...

Iniciar sesión para comentar.

Categorías

Preguntada:

NN
el 26 de Sept. de 2021

Comentada:

el 27 de Sept. de 2021

Community Treasure Hunt

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

Start Hunting!

Translated by