$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 $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, 10); hBinomi = binomiSample(50,0.5, 10); $ifThen not %DEMOSIZE% == 1 hNormal = normalSample(5, 2, 11); hTriang = triangSample(2, 5, 8,10); $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 * Now check that certain things do not work w/o a full Lindo license $onEcho > needLicense1.gms $funcLibIn lsalib lsadclib function normalSample / lsalib.SampleLSnormal /; scalar hNormal Handle for normal sampling; hNormal = normalSample(5, 2, 11); $offEcho $call gams needLicense1.gms lo=%GAMS.lo% $ifThen %DEMOSIZE% == 1 $ if not errorLevel 1 $abort Only samples with a size up to 10 should work w/o license. Ensure you ran without a LINDO license. $else $ if errorLevel 1 $abort Samples with a size bigger than 10 should work w/ license. Ensure you ran with a LINDO license. $endIf $onEcho > needLicense2.gms $funcLibIn lsalib lsadclib function triangSample / lsalib.sampleLSTriangular /; scalar hTriang Handle for triangular sampling; hTriang = triangSample(2, 5, 8,10); $offEcho $call gams needLicense2.gms lo=%GAMS.lo% $ifThen %DEMOSIZE% == 1 $ if not errorLevel 1 $abort Only normal and binomial distribution should work w/o license. Ensure you ran without a LINDO license. $else $ if errorLevel 1 $abort Triangular distribution should work w/ license. Ensure you ran with a LINDO license. $endIf