lsalib01.gms : Test extrinsic functions in lsadclib

Description

In this test we use the extrinsic Lindo Sampling library. We check both the
basically functionality and the licensing of this library.

Contributor: L. Westermann


Small Model of Type : GAMS


Category : GAMS Test library


Main file : lsalib01.gms

$Title Test extrinsic functions in lsadclib (LSALIB01,SEQ=609)

$ontext
In this test we use the extrinsic Lindo Sampling library. We check both the
basically functionality and the licensing of this library.

Contributor: L. Westermann
$offtext

$if %system.buildcode% == AIX $abort.noerror 'No Lindo on AIX';
$if %system.buildcode% == SIG $abort.noerror 'No Lindo on SIG';
$if %system.buildcode% == SOX $abort.noerror 'No Lindo on SOX';

$funclibin lsalib lsadclib

function normalSample   / lsalib.SampleLSnormal     /
         binomiSample   / lsalib.sampleLSBinomial   /
         triangSample   / lsalib.sampleLSTriangular /
         getSampleVal   / lsalib.getSampleValues    /;

scalar hNormal Handle for normal sampling
       hBinomi Handle for binomial sampling
       hTriang Handle for triangular sampling;

hNormal = normalSample(5, 2,    11);
$ifthen %DEMOSIZE% == 1
if(execError=0,  abort 'Only samples with a size up to 10 should work w/o license');
execError = 0;
$endif

hNormal = normalSample(5, 2,    10);
hBinomi = binomiSample(50,0.5,  10);
hTriang = triangSample(2, 5,  8,10);

$ifthen %DEMOSIZE% == 1
if(execError=0,  abort 'Only normal and binomial distribution should work w/o license');
execError = 0;
$endif

set i /i01*i10/;

parameter sv(i) Sampled values;
loop(i, sv(i) = getSampleVal(hNormal) );
display 'Sample of normal distribution:', sv;

loop(i, sv(i) = getSampleVal(hBinomi) );
display 'Sample of binomial distribution:', sv;

$ifthen not %DEMOSIZE% == 1
loop(i, sv(i) = getSampleVal(hTriang) );
display 'Sample of triangular distribution:', sv;
$endif