uc3m-aerospace / MOLTO-IT

Multi-Objective Low-Thrust Optimizer for Interplanetary Transfers
MIT License
33 stars 12 forks source link

(Error) Undefined function 'propagate_spirals_mex' for input arguments of type 'double' #9

Closed ashishbhatti closed 5 years ago

ashishbhatti commented 5 years ago

I ran the example in the readme.md with a few tweaks, the following error occured

% FLYBY MISSION TO JUPITER WITH UP TO 3 FLYBYS input.problem_name = 'example'; % Problem name input.problem_type = 'flyby'; % Type of mission: condition at arrival planet (flyby/rendezvous) input.planet_dep = '3'; % Departure planet using space nomenclature (e.g. 3==Earth) input.planet_arr = '5'; % Arrival planet using space nomenclature (e.g. 5==Jupiter) input.vinf0_max = 2; % Hyperbolic excess velocity at departure planet (km/s) input.planet_fb = [{'4'},{'3'},{'2'}]; % List of available planets to flyby in spice nomenclature input.rfb_min = 200; % minimum flyby altitude (km) input.n_fb = [0,3]; % minimum/maximum number of possible flybys input.rev = [0,0]; % minimum/maximum number of possible revolutions input.ToF = [50 50 50 50; % minimum/maximum transfer time per leg (days) 500 500 500 1000]; input.Initial_Date = [{'2029 Jan 01 00:00:00'},{'2030 Dec 31 00:00:00'}]; % minimum/maximum Launch date (Gregorian Date) input.init_file = []; % Init population File name (if not provided, random initial population) input.output_file = ['example','.txt']; % Solution population File name input.plot = 0; % plotting option (recomended = 0, option =1 is under development) input.useParallel = 'yes'; % yes/no for parallel execution of the genetic algorithm input.maxGen = 200; % maximum number of generations input.popsize = 200; % Population Size input.spice_dir = '/home/bhatti/gsocprep/molto-it/MOLTO-IT/spice' % RUN MOLTO-IT ALGORITHM molto_it(input)

input =

problem_name: 'example'
problem_type: 'flyby'
  planet_dep: '3'
  planet_arr: '5'
   vinf0_max: 2
   planet_fb: {'4'  '3'  '2'}
     rfb_min: 200
        n_fb: [0 3]
         rev: [0 0]
         ToF: [2x4 double]
Initial_Date: {'2029 Jan 01 00:00:00'  '2030 Dec 31 00:00:00'}
   init_file: []
 output_file: 'example.txt'
        plot: 0
 useParallel: 'yes'
      maxGen: 200
     popsize: 200
   spice_dir: '/home/bhatti/gsocprep/molto-it/MOLTO-IT/spice'

Evaluating the objective function... Generation: 1 / 200 , Individual: 200 / 200 Error using departure_cons (line 71) Undefined function 'propagate_spirals_mex' for input arguments of type 'double'.

Error in departure_spiral (line 113) [c,ceq] = departure_cons(x,aux);

Error in fitness_nsga2 (line 149) [DV(i),out,flag] = departure_spiral(planet_seq(1),planet_seq(i+1),et(1),ToFg(t+1),type(i),data);

Error in evaluate>evalIndividual (line 50) [y, cons] = objfun( indi.var, varargin{:} );

Error in evaluate (line 17) parfor i = 1:N

Error in nsga2 (line 81) [pop, state] = evaluate(opt, pop, state, varargin{:});

Error in molto_it (line 205) output = nsga2(options,input);

dmoranteg commented 5 years ago

Thank you for reporting this error. This is because the function propagate_spirals_mex is a mexfile that was create for macosx systems. I guess you are using a different operating system.

I fixed this error by calling the normal matlab function. This causes to have reduced performances.

David

ashishbhatti commented 5 years ago

Thanks @dmoranteg The error is resolved, I am able to run the example successfully. Ashish