/********************************************************************/
/**                                                                **/
/**   config.h                                                     **/
/**                                                                **/
/**   A universal generator for multivariate T-concave             **/
/**   distributions                                                **/
/**                                                                **/
/**   configuration file for TDRMV generator                       **/
/**                                                                **/
/**   author: Josef Leydold                                        **/
/**   last modified: Mon Mar  9 13:38:00 MET 1998                  **/
/**                                                                **/
/********************************************************************/              

/*------------------------------------------------------------------*/


/** Constants                                                      **/

/* dimension, number of variables                                   */
#define N           4


/** Compiling Options                                              **/

/* domain of density                                                */
/*    0 ... domain is IR^N                                          */
/*    1 ... arbitrary bounded rectancle                             */
/* rectangle  [x_1^l,x_1^u] x ... x [x_N^l,x_N^u]                   */
/* must be provided                                                 */
#define RECTANGLE   1


/* mode of distribution                                             */
/*    0 ... mode is origin                                          */
/*    1 ... mode is arbitrary point                                 */
/*          (origin is default)                                     */
/* set to 1 if RECTANGLE == 1 !!                                    */
#define MODE        1


/* generator for marginal (gamma) distributions                     */
/*    1 ... use generator gds  (faster) (see gds.c)                 */
/*    2 ... use generator tdrg          (see tdrg.c)                */
/* set to 2 if RECTANGLE == 1 !!                                    */
#define GAMMA       2
/* number of touching points for tdrg gamma generator:              */
/*    number of touching points for constructing hat function       */
#define TDRG_NTP   30       
/*    additional construction points                                */
/*    for the left tail of gamma density                            */
#define TDRG_NTP_L  2

/* choose a uniform random number generator                         */
/*    type of generator (0-3, for details see cranduni.h)           */
#define UNIFORM 1                     
/* value for the start seed (for details see cranduni.c)            */
#define START_SEED 400


/* function to be minimized for touching point                      */
/*    0 ... f = alpha - N * log(beta) + log(ai)                                 (fast)            */
/*    1 ... f = alpha - N * log(beta) + log(ai) + log(igammaf(N,beta*height))   (exact, but slow) */
#define FIND_TP_FUNCTION     1


/** fine tuning of generator                                       **/
/* a number is considered to be zero if abs is below this bound     */
#define TOLERANCE   1.e-8


/*------------------------------------------------------------------*/

/** Debuging flag **/
#define DEBUG 1

/* Debugging levels are                                             */
/*                                                                  */
/*       0 ... debuging off                                         */
/*       * ... print statistics                                     */
/*       2 ... print vertices                                       */
/*       4 ... print cones                                          */
/*       8 ... print edges for each cone                            */
/*      16 ... print parameters for cone                            */
/*      32 ... trace generation of point                            */
/*      64 ... print guide table statistics                         */
/*     128 ... print parameters for gamma generator (tdrg)          */
/*    1024 ... compute volume of cones                              */
/*    2048 ... print g                                              */
/*                                                                  */
/*    DEBUG > 1000                                                  */
/*         ... Volume, g and f(p) are stored in structure           */

/*  name of log file                                                */
#define LOG_file_name "tdrmv.log"

/*------------------------------------------------------------------*/


/** Default values                                                 **/
/* do not change int to double                                      */

/* controll triangulation of cones                                  */
#define MAX_N_CONES         10000    /* maximum number of cones (at least 2^(N+T_STEPS_MIN) */
#define T_STEPS_MIN         5        /* minimum number of triangulation steps */
#define OPTIMAL_TP_STEP     100      /* triangulation step when optimal touching points is calculated */

/* control rejection of touching points                             */
#define REJECT_TP_ABS       -1       /* reject if Hi is greaten than this value */
#define REJECT_TP_REL       -1       /* reject if Hi > median + reject_tp_rel * (percentile - median) */
#define REJECT_TP_PERCENTILE 0.9     /* percentile for rejection (must be > 0.5 ) */
          /* no checking of Hi if set to negative number (e.g. -1)  */

/* Controll allocation of memory for linked lists                   */
#define VERTEX_ALLOC_BLOCK  10       /* number of vertices to be allocated at once */
#define CONE_ALLOC_BLOCK    10       /* number of cones to be allocated at once */

/* find proper touching point using Brent's algorithm               */
#define FIND_TP_START       1.       /* starting point for finding optimal touching point */

#define FIND_TP_STEPS_R     10        /* max number of steps for finding proper touching point, --> Infinity */
#define FIND_TP_STEPS_L     10       /* max number of steps for finding proper touching point, --> 0 */
#define FIND_TP_STEP_SIZE   2.       /* size of each step for finding proper touching point */

#define FIND_TP_STEPS_LB    10       /* max number of steps for finding lower bound of bracket */
#define FIND_TP_STEPS_UB    10       /* max number of steps for finding upper bound of bracket */

#define FIND_TP_TOL         0.001    /* acceptable tolerance for Brent's algorithm for finding minimum */
#define FIND_TP_STEPS_BRENT 100      /* max number of interation steps for Brent's algorithm */

/* find mode with direct search algorithm by Hooke and Jeeves       */
/*    see hooke.c for explanation */
#define HOOKE_RHO_BEGIN	    0.6	     /* stepsize geometric shrink */
#define HOOKE_RHO_SECOND    0.99     /* stepsize geometric shrink (second run; only if > 0) */
#define HOOKE_EPSILON	    1.E-6    /* ending value of stepsize  */
#define HOOKE_IMAX	    1000     /* max # of iterations	     */
#define MODE_TO_BOUNDARY    1.E-2    /* move mode to boundary if | mode - boundary | / length < MODE_TO_BOUNDARY */

/* controll search table                                             */
#define GUIDE_TABLE_SIZE 5           /* relative size of guide table compared to number of cones */

/*------------------------------------------------------------------*/



