mapSolution broken in R2019b?
古いコメントを表示
In R2019a, the following code works as intended,
%% Define the variables
x=optimvar('x',{'x1','x2'},'LowerBound',[-100,-200]);
y=optimvar('y',1,3,'LowerBound',[0 0 0],'UpperBound',[+300,+400,+500]);
%% Define some constraints
C.inequ=2*sum(y)+sum(x)<=1000;
C.equ=5*sum(x)==100;
prob=optimproblem('Constraints',C,'Objective',sum(x)+sum(y));
idx=mapSolution(prob,1:5)
resulting in the output,
idx =
struct with fields:
x: [1 2]
y: [1 2 3]
Something must have been changed in R2019b/R2020a, however, because I instead get an error:
Not enough input arguments.
Error in optim.internal.problemdef.ProblemImpl/mapSolution
Error in test (line 12)
idx=mapSolution(prob,1:5)
Were there any intentional changes in the behavior of the mapSolution function, and if so how do I get the code above to work in current Matlab?
3 件のコメント
Walter Roberson
2020 年 8 月 15 日
編集済み: Matt J
2020 年 8 月 16 日
shows a number of mandatory inputs
Matt J
2020 年 8 月 16 日
Walter Roberson
2020 年 8 月 16 日
Darn, it is a .p file so we can't read it.
採用された回答
その他の回答 (1 件)
1 件のコメント
Walter Roberson
2020 年 8 月 25 日
Internal code does not do detailed argument checking for performance reasons.
カテゴリ
ヘルプ センター および File Exchange で Get Started with Optimization Toolbox についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!