LP optimization error for the objective function

2 ビュー (過去 30 日間)
Nikolas Spiliopoulos
Nikolas Spiliopoulos 2018 年 2 月 22 日
Hi all,
I am trying to run an LP optimization. My objective function is
f= @(x) 3*x(1:N)-2*x(N+1:2*N)-5*x(2*N+1:3*N)-3*x(3*N+1:4*N);
where N=5 and I get the error like that:
"LINPROG requires the following inputs to be of data type double: 'f'"
do you have any idea how to solve it?
I've seen other people mentioning this error but I don't get how could work in my case
thanks in advance
Nikolas

採用された回答

Matt J
Matt J 2018 年 2 月 22 日
ee=ones(1,N);
f=[3*ee,-2*ee,-5*ee,-3*ee ];

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGet Started with Optimization Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by