CSex2.gms : Test expert level C# API to read and write GDX, set options and execute GAMS

Description

Contributor: Lutz Westermann, October 2012


Small Model of Type : .Net


Category : GAMS API library


Main file : CSex2.gms

$TITLE 'Test expert level C# API to read and write GDX, set options and execute GAMS' (CSEX2,SEQ=14)

$ontext
Contributor: Lutz Westermann, October 2012
$offtext


$set srcRoot %gams.sysdir%apifiles%system.dirsep%CSharp%system.dirsep%

$escape &
$if %system.filesys% == UNIX
$if %sysenv.MPATH% == %&sysenv.MPATH%& $abort.noerror Need Mono to run this on Unix

$                             set COMP csc.exe
$if %system.filesys% == UNIX $set COMP $MPATH/dmcs
$                             set EXEC
$if %system.filesys% == UNIX $set EXEC $MPATH/mono

$if %system.buildcode% == VS8
$if not set flags $set flags /platform:x86
$if %system.buildcode% == WEI
$if not set flags $set flags /platform:x64
$if %system.buildcode% == LEG
$if not set flags $set flags
$if %system.buildcode% == DEG
$if not set flags $set flags /define:__APPLE__

$call rm -rf demanddata.gdx

$call %COMP% %flags% -out:xp_example2.exe "%srcRoot%xp_example2%system.dirsep%xp_example2.cs" "%srcRoot%api%system.dirsep%gamsxcs.cs" "%srcRoot%api%system.dirsep%gdxcs.cs" "%srcRoot%api%system.dirsep%optcs.cs" "%srcRoot%api%system.dirsep%gamsglobals.cs"
$if errorlevel 1 $abort 'Problem compiling xp_example2.cs'
$call %EXEC% xp_example2.exe "%gams.sysdir%." model2.gms
$if errorlevel 1 $abort 'Problem executing xp_example2 writing GDX file'
$call gdxdiff demanddata.gdx demandwant.gdx
$if errorlevel 1 $abort 'Demanddata not as expected'