Interpolate Matlab inbuilt function with Julia

4 vues (au cours des 30 derniers jours)
xu supeng
xu supeng le 21 Fév 2022
Commenté : xu supeng le 21 Fév 2022
Hi, I have a problem when I try to interpolate Matlab inbuilt function bayesopt with Julia function, in my program, I try to use julia to evaluate my objective function, since it's fast, but I also want to use matlab bayesopt to optimize it, since julia's package is not that complete, it's almost work, but has a problem with variable type, here is an simple example, and the error as follows,
using MATLAB
function f(x, y)
return -x - y
end
function mdlfun(tbl)
x = tbl.v1
y = tbl.v2
return f(x, y)
end
mat"""
xrange = optimizableVariable('v1',[-2,2],'Type','real');
yrange = optimizableVariable('v2',[-5,5],'Type','real');
var=[xrange yrange];
bayesObject =bayesopt(@(tbl)$mdlfun(tbl),var,...
'MaxObjectiveEvaluations',50)
"""
Unable to use a value of type table as an index.
Error in @(tbl)matlab_jl_2(tbl)
Error in BayesianOptimization/callObjNormally (line 2576)
Objective = this.ObjectiveFcn(conditionalizeX(this, X));
Error in BayesianOptimization/callObjFcn (line 481)
= callObjNormally(this, X);
Error in BayesianOptimization/runSerial (line 1996)
ObjectiveFcnObjectiveEvaluationTime, ObjectiveNargout] = callObjFcn(this, this.XNext);
Error in BayesianOptimization/run (line 1948)
this = runSerial(this);
Error in BayesianOptimization (line 457)
this = run(this);
Error in bayesopt (line 323)
Results = BayesianOptimization(Options);
  2 commentaires
xu supeng
xu supeng le 21 Fév 2022
Maybe I am wrong, since evry code within
mat"""..."""
will be run in Matlab that's not what I hope, but any suggestions are welcome
xu supeng
xu supeng le 21 Fév 2022
To be clear, I write this within julia and call bayesopt from julia, that's why I define functions in different ways

Connectez-vous pour commenter.

Réponses (0)

Produits


Version

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by