clear
format long e
format compact
global zxvar
load /home/erm/data/hsdata4

% for global search:
%   1. cp hsmle.m hsmle2.m
%   2. vi hsmle2.m 
%      change L to -L, dL to -dL
%   3  put below:
%      lb= ..
%      ub= ..
%      seed= ..
%      [x,f,g,code]=sga('hsmle2',lb,ub,seed);

% for constrained hillclimbing:
%   1. cp hsmle.m hsmle2.m
%   2. vi hsmle.m
%      output: [L,gL,dL]
%      change nargout>1 to nargout>2
%      add gL statements
%   3. vi hsmle2.m
%      take out nargout L, replace with [dL,dgL]
%      remove nargout > 1 statements
%      add dgL statements
%   4. put below:
%      lb= ..
%      ub= ..
%      Theta= ..
%      x=fconstr('hsmle',Theta,[],lb,ub,'hsmle2');

% for unconstrained hillclimbing:
%   1. put below:
%      Theta=.. 
%      [x,f,g,code,status]=uncmin(Theta,'hsmle');

% or ..
%   1. cp hsmle.m hsmle2.m
%   2. vi hsmle2.m
%      take out nargout L
%      remove nargout > 1 statements
%   3. put below:
%      Theta= ..
%      x=funconst('hsmle',Theta,[],'hsmle2') 

% or ..
%   1. put below:
%      Theta=..
%      tol= ..
%      printon= .. 
%      x=nelder('hsmle',Theta,tol,printon);

%     9.972471127022116e-01

Scale=[..
     5.0
     0.45
     0.13
     2.0
    1.475002908821986e+01     
    6.895881052987415e-01
    2.459122286891504e-01
     0.023
     4.0
     0.99
     1000.0
     1e-5
     1e-5
     1000.0
     1000.0];

Theta=ones(length(Scale),1);

[x,f,g,code,status]=uncmin(Theta,'mlehs4');

disp('  Output saved in mleinfo.mat')
disp('  For standard errors, type "runse". ')

save mleinfo
