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/mcs
$                             set EXEC
$if %system.filesys% == UNIX $set EXEC $MPATH/mono

$if %system.platform% == WEX
$if not set flags $set flags /platform:x64
$if %system.platform% == LEX
$if not set flags $set flags
$if %system.platform% == DEX
$if not set flags $set flags /define:__APPLE__
$if %system.platform% == DAX
$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%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'