Error using standalone function with ga toolbox

I have the following error message when running a standalone function with the genetic algortihm ga from the Global Optimization Toolbox:
Error using warning
Unable to load a message catalog 'globaloptim:gaminlpvalidateoptions'. Please check the file location and format.
Error in gaminlpvalidateoptions
Error in ga (line 295)
Error in test_GAopt (line 26)
MATLAB:builtins:MessageCatalogLoadFailed
I want to apply the genetic algorithm on a shared linux machine that doesn't have the Global Optimization Toolbox. For this I have created a virtual machine on my Windows computer from which I compile a standalone function that makes use of the genetic algorithm. The virtual machine has the same version of linux (scientific linux 6.9, 64-bit), and mcr (9.0). The standalone function runs succesful on the virtual machine.
The above error comes from a test function that roughly does what I desire:
function test_GAopt( N )
if isdeployed
N = str2double( N );
end
%%
idx_real = 1:N/2;
idx_int = (N/2+1):N;
fun = @(x) x(idx_real)*x( idx_int )' + 2;
A_real = cat( 1, -eye( N, 2*N ) );
A_int = -[zeros( 1, N ) ones( 1, N )];
A_ga = cat( 1, A_real, A_int );
b_ga = -[zeros( N, 1 ); 1];
lb_ga = zeros( 1, 2*N );
ub_ga = [Inf*ones( 1, N ) ones( 1, N )];
opt_ga = gaoptimset( @ga );
opt_ga = gaoptimset( opt_ga, 'Display', 'iter' );
[xsol,cost,exitflag_ga,output_ga] = ga( ... genetic algorithm
fun, ... optimized function
2*N, ... number of variables
A_ga, b_ga,... inequality constrains
[],[], ...
lb_ga, ub_ga, [], ... lower/upper bound
idx_int, ... index of integer variables
opt_ga );
end
I compile the code using:
mcc('-m','test_GAopt.m', '-vm', '-R', '-logfile,log_GA_opt.txt', '-R','-nojvm','-R','-singleCompThread','-R','-nosplash', '-a', 'ga.m', '-a', '/usr/local/MATLAB/R2015b/toolbox/globaloptim', '-a', '/usr/local/MATLAB/R2015b/resources/globaloptim')
I included the -a options to try to solve the problem but also tried it without these options. I move the standalone file to the shared linux machine and make it executable.
Exucuting on the shared linux machine
./test_GAopt 100
gives the initial error. I suspect I have a problem with the paths, but I haven't been able to figure it out. Does anyone have the solution?
UPDATE
I found a workaround by making a copy of the Global Optimization toolbox directory, commenting out line 295 from ga.m, and compiling:
mcc('-m','test_GAopt.m', '-vm', '-R', '-logfile,log_GA_opt.txt', '-R','-nojvm','-R','-singleCompThread','-R','-nosplash', '-a', 'ga.m', '-a', './resources/globaloptim','-a', './toolbox/globaloptim/globaloptim/private')

Answers (0)

Products

Release

R2015b

Asked:

on 7 Aug 2019

Edited:

on 8 Aug 2019

Community Treasure Hunt

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

Start Hunting!