Optimoptions error: "Empty keys are not allowed in this container" (no number given)

34 ビュー (過去 30 日間)
Geoffrey Rivers
Geoffrey Rivers 2020 年 3 月 25 日
コメント済み: Arash Allahyari 2022 年 2 月 11 日
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
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
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
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 件のコメント
bd l
bd l 2020 年 9 月 17 日
It works, thank you.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeIntroduction to Installation and Licensing についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by