필터 지우기
필터 지우기

Getting error " 'ga' requires Global Optimization Toolbox'' while running the global optimization command for a stalagmite function.

조회 수: 20 (최근 30일)
clear all
close all
clc
%inputs
x = linspace(0,0.6,150);
y = linspace(0,0.6,150);
[xx, yy] = meshgrid(x,y);
for i = 1:length(xx)
for j = 1:length(yy)
vector(1) = xx(i,j);
vector(2) = yy(i,j);
f(i,j)= stalagmite(vector);
end
end
num_case = 50;
tic
%study_1 - Satistical behaviour
for i = 1:num_case
[inputs, fopt(i)] = ga(@stalagmite, 2);
xopt(i) = inputs(1);
yopt(i) = inputs(2);
end
study1_time = toc
figure(1)
subplot(2,1,1)
hold on
surfc(x,y,f)
shading interp
plot3(xopt,yopt,fopt,'marker','o','markersize',5,'markerfacecolor','r')
title('unbound inputs')
subplot(2,1,2)
plot(fopt)
xlabel('iteations')
ylabel('No of functions')
when i run this code i am getting the error as 'ga' requires Global Optimization Toolbox.

답변 (1개)

Walter Roberson
Walter Roberson 2021년 11월 23일
The message is correct. The function ga() is part of the Global Optimization Toolbox. You need to have the Global Optimization Toolbox installed and licensed in order to use Mathwork's ga() function.
ga() is not part of basic MATLAB.
[If I recall correctly, the Global Optimization Toolbox requires that you have the Optimization Toolbox installed and licensed.)

카테고리

Help CenterFile Exchange에서 Introduction 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