Problem based framework for my optimization problem is not working

6 views (last 30 days)
Satyajit Ghosh
Satyajit Ghosh on 25 Oct 2021
Edited: Satyajit Ghosh on 25 Oct 2021
At first, I was performing an optimization with respect to all elements of 'A' matrix using below command.
[Aopt,fopt]=fminunc(@(A)myObjective(A,N33,p1,v,limit,n),A0,options);
But now I want an extra parameter (x) to be used for optimization also. Hence, I switched to problem based framework implemented using below code segment.
A=optimvar('A',N,3);
x=optimvar('x',1);
fun=fcn2optimexpr(@(A,x)myObjective(A,x,N33,p1,v,limit,n),A,x);
sol0.A=... %initial A0
sol0.x=... %initial x0
sol=solve(optimproblem('Objective',fun),sol0,options);
But, it is not working. I am getting error like this.
Error using optim.internal.problemdef.ProblemImpl/solveImpl
Expected a string scalar or character vector for the parameter name
Error in optim.problemdef.OptimizationProblem/solve
Error in Optimization_FINAL.m (line 145)
sol=solve(optimproblem('Objective',fun),sol0,options);

Answers (0)

Products


Release

R2021a

Community Treasure Hunt

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

Start Hunting!