Optimization via an Integral
显示 更早的评论
Hey there, I would like to maximize a function W=5*si0-int(r0,0,si0*n0), where si0 and n0 are the decision variables and r0=(n0*si0)^2. Constraints are just nonnegativity of si0 and n0. Script copied from the editor:
function W=kiratest;
syms si0
syms n0
r0=(n0*si0).^2
W=-(5.*si0-int(r0,0,si0*n0));
I already tried fmincon and linprog, but I always get several errors, such as:
>> fmincon(@kiratest,[0 0],[-1 0;0 -1],[0;0])
Warning: Trust-region-reflective algorithm does not solve this type of problem,
using active-set algorithm. You could also try the interior-point or sqp
algorithms: set the Algorithm option to 'interior-point' or 'sqp' and rerun. For
more help, see Choosing the Algorithm in the documentation.
> In fmincon at 472
??? Error using ==> kiratest
Too many input arguments.
Error in ==> fmincon at 590
initVals.f = feval(funfcn{3},X,varargin{:});
Caused by:
Failure in initial user-supplied objective function evaluation. FMINCON cannot
continue.
AND:
>> linprog(@kiratest,[-1 0;0 -1],[0;0])
??? Error using ==> linprog at 132
LINPROG only accepts inputs of data type double.
Please help me find the mistake or else another solution for optimization. Sincerely, Kira
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Solver Outputs and Iterative Display 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
