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

% 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);

Scale=[..
    3.730463644177694e+00
     1.814633343447077e-01
     3.568211128393715e-01
     3.781662382532218e-01
     5.135998757303526e+00
     1.007392533829349e-01
     9.700861647950072e-01
     2.949298206055629e-02
     2.345087561128400e-02
     2.554207807614946e+00
     9.931425608254918e-01
     7.985319590802808e+01
     7.375191073476499e-05
     1.520792974959051e-04
     1.481415222681815e+03
     3.142803831479651e+03
     1.419938856306720e-06
     8.501089002209466e-06
     1.391233398951500e-05
     1.198184489497086e-05
     1.407364599407741e-05];


lb1=[-10;1e-8;1e-8;.2;.01;.0001; .6;-.5;.02;.0075; .96;    1;1e-8;
    1e-8;    1;    1;-.99;-.99;-.99;-.99;-.99]./Scale;
ub1=[ 10;  .8;  .5;.8; 10;   10;1.1; .3;.03;   10;.999;10000;  .1;
      .1;10000;10000; .99; .99; .99; .99; .99]./Scale;
lb=min(lb1,ub1); ub=max(lb1,ub1);
Theta=ones(21,1);
[x,f,g,code,status]=uncmin(Theta,'mletem');

save mleinfot 

