what changes should i make in final optimised value with opt time vector
Afficher commentaires plus anciens
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 commentaires
Image Analyst
le 26 Sep 2021
Can you just run through a brute force trial of all possible combinations?
NN
le 26 Sep 2021
Réponses (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 commentaires
NN
le 26 Sep 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
le 27 Sep 2021
Matt J
le 27 Sep 2021
I am not sitting beside you at your computer. I cannot see what you entered...
Catégories
En savoir plus sur Get Started with Optimization Toolbox dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!