Johnson's System of Distribution (lsoe08)

/**********************************************************************/
/*                                                                    */
/*               S A S   S A M P L E   L I B R A R Y                  */
/*                                                                    */
/*    NAME: lsoe08                                                    */
/*   TITLE: Johnson's System of Distribution (lsoe08)                 */
/* PRODUCT: OR                                                        */
/*  SYSTEM: ALL                                                       */
/*    KEYS: OR                                                        */
/*   PROCS: OPTLSO, FCMP                                              */
/*    DATA:                                                           */
/*                                                                    */
/* SUPPORT:                             UPDATE:                       */
/*     REF:                                                           */
/*    MISC: Example 8 from the OPTLSO chapter of the                  */
/*          Local Search Optimization book.                           */
/*                                                                    */
/**********************************************************************/

 data sudata;
    n=20000;
    theta=-1;
    sigma=1;
    delta=3;
    gamma=5;
    call streaminit(123);
    do i = 1 to n;
       z = rand("NORMAL");
       a = exp( (z - gamma)/delta );
       d = sigma * ( (a**2 - 1)/(2*a) ) + theta;
       output;
    end;
    keep d;
 run;

proc fcmp outlib=sasuser.myfuncs.mypkg;
   function jsu(x4,x2,f1);
      return (20000*(log(x4) - log(x2)) + f1);
   endsub;

   function jsu1(x1,x2,x3,x4,d);
      yk = (d - x1)/x2;
      zk = yk + sqrt(1 + yk**2);
      return (-0.5*(x3 + x4*log(zk))**2 -0.5*log(1 + yk**2));
   endsub;
run;
options cmplib = sasuser.myfuncs;

 data objdata;
    input _id_ $ _function_ $ _sense_ $ _dataset_ $;
    datalines;
 f1 jsu1 .   sudata
 f  jsu  max .
 ;

 data vardata;
    input _id_ $ _lb_ _ub_;
    datalines;
 x1  .     .
 x2  1e-12 .
 x3  .     .
 x4  1e-12 .
 ;

 proc optlso
    primalout = solution
    objective = objdata
    variables = vardata
    logfreq   = 100
    maxgen    = 1000;
    performance nodes=4 nthreads=8;
 run;