Optimoptions error: "Empty keys are not allowed in this container" (no number given)
22 次查看(过去 30 天)
显示 更早的评论
What is the source of my error? I am running a program that calls optimoptions with the following command:
options = optimoptions(@fmincon,'Algorithm','sqp');
This results in the following errors:
Error using optimoptions (line 124)
Empty keys are not allowed in this container.
Error in Cure_main (line 36)
options = optimoptions(@fmincon,'Algorithm','sqp');
Cure_main.m is my main function. Prior to line 36, no other functions are yet called. Other members of my team can run the code, using copies of my files. They are using 2018a, I am using a newly installed copy of 2020a. I have confirmed that I can open optimoptions in my copy of matlab.
I have also checked that I have the appropriate toolbox:
>> license('inuse')
matlab
optimization_toolbox
I have not changed the path for anything in my matlab, other than adding the directory of my script files and the .txt that they use. I have tried changing @fmincon to 'fmincon', and had the same result.
The complete code is:
clc; clear all; close all;
format long;
global Atest T m;
d=load('1.txt');
m=1580;
Atest=d(:,2)*1.0;
T=d(:,1);
x=[
0.0106777326336
];
% I have removed a large number of commented-out value options here
options = optimoptions(@fmincon,'Algorithm','sqp');
There is more after this, but it is not necessary to reproduce the error.
18 个评论
Walter Roberson
2020-5-1
Please run the following commands and show us the output
matlabroot
info = meta.package.fromName('optim.options')
{info.FunctionList.Name}
These commands will not change anything on your system, but they will give us information that we need to go further in debugging the problem.
Francescogiuseppe Morabito
2020-5-1
this is the output I get:
info = meta.package.fromName('optim.options')
{info.FunctionList.Name}
ans =
'C:\Program Files\MATLAB\R2020a'
info =
package with properties:
Name: 'optim.options'
Description: ''
DetailedDescription: ''
ClassList: [4×1 meta.class]
FunctionList: [10×1 meta.method]
PackageList: [1×1 meta.package]
ContainingPackage: [1×1 meta.package]
ans =
1×10 cell array
Columns 1 through 3
{'createSolverOpt…'} {'createLinkToSol…'} {'generateMultiAl…'}
Columns 4 through 6
{'replaceFinDiffR…'} {'getDefaultFinDi…'} {'getDisplayOptio…'}
Columns 7 through 9
{'getOptionDefaul…'} {'createNonConsta…'} {'generateMultiAl…'}
Column 10
{'generateSingleA…'}
回答(1 个)
Nick Zhi
2020-5-8
I met the same problem with 2020a, I re-run the installer and added Global Optimization Toolbox into my installation procedure. It seems to have resolved the problem.
4 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Loops and Conditional Statements 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!