surrogateopt: Dot indexing is not supported for variables of this type.

4 次查看(过去 30 天)
I am trying to use the function surrogateopt in a script that I submit to a computer cluster. I don't want to plot the solver progress. To illustrate the problem that I have, I will use the toy code "Minimization_test.m":
minobj=@(xj)(xj+2).^2;
lbe= [-20];
ube= [20];
opts = optimoptions(@surrogateopt,'PlotFcn',[],'MaxFunctionEvaluations',600);
xj = surrogateopt(minobj,lbe,ube,[],opts)
This script works correctly on my computer (matlab 2020a) and on the cluster (matlab 2020a) if create an interactive matlab session.
However, I get an error if I request that the job scheduling program SLURM execute the script. My SLURM script reads:
#!/bin/bash
#SBATCH -t 1:00:00
#SBATCH --mem=1g
#SBATCH -J matlab
#SBATCH -o slurm.out
module load Matlab/R2020a
matlab -nojvm -nodisplay -singleCompThread -r Minimization_test
If I submit this job, I get the following error in the output file:
Dot indexing is not supported for variables of this type.
Error in globaloptim.bmo.solver
Error in globaloptim.bmo.createSolver
Error in globaloptim.bmo.BlackboxModelOptimizer (line 92)
self =
globaloptim.bmo.createSolver(self,expensive,lb,ub,intcon,options);
Error in surrogateopt>createController (line 329)
controller =
globaloptim.bmo.BlackboxModelOptimizer(expensive,lb,ub,intcon,options);
Error in surrogateopt (line 292)
controller = createController(objconstr,lb,ub,intcon,options);
Error in Minimization_test (line 5)
xj = surrogateopt(minobj,lbe,ube,[],opts)
  9 个评论
Farhad Omidvar
Farhad Omidvar 2020-9-22
Thanks, Walter, for the suggestions.
Before seeing them, I submitted the job for running on MATLAB/2020a (insteaad of the 2018b version) and the problem magically got fixed.

请先登录,再进行评论。

采纳的回答

Walter Roberson
Walter Roberson 2020-9-22
Removing the -nojvm solves the problem (for reasons currently unknown.)
  1 个评论
Daniel Rischawy
Daniel Rischawy 2020-10-27
Unfortunately I have the same problem. But I get the error if I run surrogates with parallel computing normally in Matlab2019a. The error appears random after around 200-300 iterations. Sample tasks for surrogates, however, did not cause any problems. Therefore I think it should have something to do with my objective function or parallel computing, but I do not understand the cause and why the error occurs so randomly. Could the reason be the Java version I use or the Matlab version? Thanks a lot in advance.
Regards

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Cluster Configuration 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by