main.m 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. %% ------------------------------ Note ------------------------------------
  2. % 这是原程序的并行计算版本
  3. % 不要出现任何的全局变量,以免出现内存访问错误,因为并行池之间的内存不是共享的
  4. %% ------------------------------ END--------------------------------------
  5. close all;clear all;clc
  6. [Mission_Param, Environment_Param, Normalized_Param] = paraSet(); % 全局变量
  7. % global Normalized_Param
  8. tscale = Normalized_Param.tscale;
  9. guesstf = 5; % 时间的初始猜想
  10. x0 = [0;0;0;1;1;1;guesstf]; % initial guesses
  11. %% ------------The pseudo-arclength continuation method-------------
  12. tic
  13. [X,~,param] = arclength('constain_Gauss',x0,-1,Mission_Param, Environment_Param);
  14. % [X, ~, param] = arclength_continuation2('constain_Gauss', x0, 1, Mission_Param, Environment_Param);
  15. f = constain_Gauss(X,param,Mission_Param, Environment_Param); %
  16. toc
  17. figPlot;
  18. %% ---------------Test---------------
  19. % N_iter = 100;
  20. % RandMax = 0.2;
  21. % Success_InverseGauss = 0.0;
  22. % Success_Gauss = 0.0;
  23. % Success_Flag = zeros(N_iter, 2);
  24. % for iter = 1:N_iter
  25. %
  26. % x0 = [1;1;1;0;0;0;guesstf]; % initial guesses
  27. % x0_Rand = 1 + RandMax*rand*2-RandMax;
  28. % x0 = x0 .* x0_Rand;
  29. %
  30. % fun_name_InverseGauss = 'constain_InverseGauss';
  31. % fun_name_Gauss = 'constain_Gauss';
  32. % Options_fsolve = optimset('TolX',1e-12','TolFun',1e-12,'MaxIter',300,...
  33. % 'MaxFunEvals',10000,'FunValCheck ','on' ,'LargeScale','off',...
  34. % 'Algorithm','trust-region-dogleg','Display','iter',...
  35. % 'PrecondBandWidth',1,'UseParallel',true);
  36. % [~,f_InverseGauss] = fsolve(fun_name_InverseGauss,x0,Options_fsolve,0.0,Mission_Param, Environment_Param);
  37. % [~,f_Gauss] = fsolve(fun_name_Gauss,x0,Options_fsolve,0.0,Mission_Param, Environment_Param);
  38. % if sum(abs(f_InverseGauss))<1e-6
  39. % Success_InverseGauss = Success_InverseGauss+1;
  40. % Success_Flag(iter,1) = 1;
  41. % end
  42. % if sum(abs(f_Gauss))<1e-6
  43. % Success_Gauss = Success_Gauss+1;
  44. % Success_Flag(iter, 2) = 1;
  45. % end
  46. %
  47. % disp(['测试进度:', num2str(100*iter/N_iter), '% ============== InverseGauss成功率:', num2str(100 * Success_InverseGauss/iter), '% ============== Gauss成功率:', num2str(100 * Success_Gauss/iter)])
  48. %
  49. % end
  50. %%
  51. % save(['RandMax', num2str(RandMax),'.mat'])