apimod.inc : API Model Library

  File : apimod.inc  used by :   apiutil.gms [html]   testapi.gms [htmlPAlias.gms [html]

* -*- fundamental -*-
$hidden When adding models we need to update this file at a few
$hidden spots. Look for $hidden lines. To check > gams apimod.inc
$hidden In order to update the glb file, etc. just run > gams apiutil.gms
alias (u,*)
SETS s Model Sequence Numbers / 1*61 /
$hidden                           bump sequences numbers above

$stitle Model Names and Titles
set m model names in alphabetic order /
$hidden  enter the new model here, keep in order
A
apihtm              'Generates HTM apilib library files'
apiutil             'Generates the API Model Library files'
B
C
Cex1                'Test expert level C API to read and write GDX'
Cex2                'Test expert level C API to read and write GDX, set options and execute GAMS'
CSAlias             'Test handling of Aliases in object oriented C# API'
CSCalcInverse       'Test expert level C# API to read and write indexed GDX'
CSex1               'Test expert level C# API to read and write GDX'
CSex2               'Test expert level C# API to read and write GDX, set options and execute GAMS'
CStrseq             'Test object oriented C# API running a sequence of examples based on a transport model'
CSBenders           'Test object oriented C# API using a (multi-threaded) Benders Decomposition Algorithm'
CSClad              'Test changing solver options while running using the interrupt method'
CSCutstock          'Test object oriented C# API using a cutting stock example'
CSDomainChecking    'Test object oriented C# API for domain checks'
CSInterrupt         'Test GamsJob interrupt mechanism in object oriented .Net API'
CSNUnit             'Compiles and runs NUnit tests for object oriented C# API'
CSSpecialValues     'Test handling of Special Values in object oriented C# API'
CSTsp               'Test object oriented C# API using a Traveling Salesman Problem'
CSWarehouse         'Test object oriented C# API using a warehouse location problem'
CPPex1              'Test expert level C API to read and write GDX in C++'
CPPex2              'Test expert level C API to read and write GDX, set options, and execute GAMS in C++'
CPPex3              'Test object oriented C++ API examples'
CPPtrseq            'Test object oriented C++ API running a sequence of examples based on a transport model'
D
DCex1               'Test expert level Delphi (function) API to read and write GDX'
DOex1               'Test expert level Delphi (object) API to read and write GDX'
DPex1               'Test expert level Delphi (pure) API to read and write GDX'
DOex2               'Test expert level Delphi (object) API to read and write GDX, set options and execute GAMS'
E
F
Fex1                'Test expert level Fortran API to read and write GDX'
Fex2                'Test expert level Fortran API to read and write GDX, set options and execute GAMS'
G
H
I
J
JAlias              'Test handling of Aliases in object oriented Java API'
JBenders            'Test object oriented Java API using a (multi-threaded) Benders Decomposition Algorithm'
JClad               'Test changing solver options while running using the interrupt method'
JCutstock           'Test object oriented Java API using a cutting stock example'
JDomainCheck        'Test object oriented Java API for domain checks'
Jex1                'Test expert level Java API to read and write GDX'
Jex2                'Test expert level Java API to read and write GDX, set options and execute GAMS'
JInterrupt          'Test object oriented Java API for interrupting running GAMS jobs'
JSpecialValues      'Test handling of Special Values in object oriented Java API'
Jtrseq              'Test object oriented Java API running a sequence of examples based on a transport model'
JTsp                'Test object oriented Java API using a Traveling Salesman Problem'
JWarehouse          'Test object oriented Java API using a warehouse location problem'
K
L
M
N
O
P
PAlias              'Test handling of Aliases in object oriented Python API'
PDomainChecking     'Test object oriented Python API for domain checks'
Pex1                'Test expert level Python API to read and write GDX'
Pex2                'Test expert level Python API to read and write GDX, set options and execute GAMS'
Pgamstransfer       'Test gamstransfer API'
Pgams2numpy         'Test gams2numpy API'
Pgams_engine        'Test gams_engine API'
Pneos               'Test submitting GAMS models to NEOS server'
Ptrseq              'Test object oriented Python API running a sequence of examples based on a transport model'
PBenders            'Test object oriented Python API using a (multi-threaded) Benders Decomposition Algorithm'
PClad               'Test changing solver options while running using the interrupt method'
PCutstock           'Test object oriented Python API using a cutting stock example'
PInterrupt          'Test GamsJob interrupt mechanism in object oriented Python API'
PWarehouse          'Test object oriented Python API using a warehouse location problem'
PTsp                'Test object oriented Python API using a Traveling Salesman Problem'
PSpecialValues      'Test handling of Special Values in object oriented Python API'
PBuildXPLevelAPI    'Test building the expert-level APIs'
Q
R
S
T
testapi              'API Quality Assurance Test'
U
V
VBex1               'Test expert level VB.Net API to read and write GDX'
VBex2               'Test expert level VB.Net API to read and write GDX, set options and execute GAMS'
VBtrseq             'Test object oriented VB.Net API running a sequence of examples based on a transport model'
W
X
Y
Z
/;

set letters(m) / a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z /;

set inc 'list of include files, .inc extension assumed' /
  'apimod'      API Model Library
/;

$onempty
set minc(m) 'list of model files $included' /
/;

set oinc(*) 'list of other files needed and/or $included' /
'demandwant.gdx'
'..\apifiles\GAMS\model2.gms'
'..\apifiles\GAMS\trnsport.gdx'
/;
$offempty

set oincNOfs(*) 'list of other files needed and/or $included but included (because special treated) when writing file list for make' /
'..\apifiles\GAMS\model2.gms'
'..\apifiles\GAMS\trnsport.gdx'
/;
$offempty

set ainc(*) 'all include files';
ainc(u) = inc(u) or sum{minc,sameas(minc,u)};
* or sum{oinc,sameas(oinc,u)};

$stitle Model Assignments
set sm(s,m) model sequence number assignment /
  1.apiutil,    11.Pex1,    21.CStrseq,     31.PCutstock,           41.PWarehouse,       51.CSClad
  2.testapi,    12.VBex1,   22.CPPtrseq,    32.CSDomainChecking,    42.CSAlias,          52.PClad
  3.Cex1,       13.Cex2,    23.Jtrseq,      33.JDomainCheck,        43.JAlias,           53.JClad
  4.CSex1,      14.CSex2,   24.Ptrseq,      34.PDomainChecking,     44.PAlias,           54.PInterrupt
  5.CPPex1,     15.CPPex2,  25.VBtrseq,     35.JInterrupt,          45.apihtm,           55.CSInterrupt
  6.DCex1,      16.DOex2,   26.CSBenders,   36.CSTsp,               46.CSCalcInverse,    56.CPPex3
  7.DOex1,      17.Fex2,    27.JBenders,    37.JTsp,                47.CSSpecialValues,  57.PBuildXPLevelAPI
  8.DPex1,      18.Jex2,    28.PBenders,    38.PTsp,                48.PSpecialValues,   58.Pgamstransfer
  9.Fex1,       19.Pex2,    29.CSCutstock,  39.CSWarehouse,         49.JSpecialValues,   59.Pgams2numpy
 10.Jex1,       20.VBex2,   30.JCutstock,   40.JWarehouse,          50.CSNUnit,          60.Pgams_engine
 61.Pneos
$hidden seq . name mapping goes here
/;

set incmap(*,s) 'list of $included files required for model s' /
$hidden enter new include files and/or new $includes
$hidden apilib will copy $included files according to this mapping
    'apimod'                        .( 1*  2, 44)
    'demandwant.gdx'                .( 3* 20)
    '..\apifiles\GAMS\model2.gms'   .(13* 20)
    '..\apifiles\GAMS\trnsport.gdx' .( 3* 12)
/;

$hidden tell model type
set t       single model types / GAMS   'GAMS'
                                 C      'C and CPP'
                                 D      'Delphi'
                                 F      'Fortran'
                                 J      'Java'
                                 N      '.Net'
                                 P      'Python'      /
    ts(t,s) classification by type /
    GAMS.( 1*  2, 45)
    C   .( 3,  5, 13, 15, 22, 56)
    D   .( 6*  8, 16)
    F   .( 9, 17)
    J   .(10, 18, 23, 27, 30, 33, 35, 37, 40, 43, 49, 53)
    N   .( 4, 12, 14, 20* 21, 25* 26, 29, 32, 36, 39, 42, 46* 47, 50*51, 55)
    P   .(11, 19, 24, 28, 31, 34, 38, 41, 44, 48, 52, 54, 57*61)
/;

$hidden tell model category
set c   single model categeory / Demo
                                 Test
                                 Tool      /
    cs(c,s) classification by category /
    Demo.( 3* 31, 35* 41, 46, 51*56)
    Test.(32* 34, 42* 44, 47* 50, 57*61)
    Tool.( 1,  2, 45)
/;

$onempty
set big(s) need full solver license to run  /
/;

set drop(t,s) Additional drop set / /;
$offempty

set tss(t,s) only one type per model used in IDE files;

* quick and dirty dropping of multiple classifications
tss(t,s) = ts(t,s) - drop(t,s);


alias(s,ss); set srev(s,s) reverse set ; srev(s,s+(card(s)+1-2*ord(s))) = yes;

sets
    err1(s)    'model unclassified or classified twice in CS(C,S)'
    err2(s)    'model unclassified in TS(T,S)'
    err3(s)    'model unclassified in SM(S,M)'
    err5(s)    'all types dropped in DROP(T,S)'
    err6(s)    'multiple types in TSS(T,S)'
    err7(t,s)  'drops missing in DROP(T,S) for model with multiple types'
    err8(m)    'model and include names cannot have the same name';

err1(s) = sum(cs(c,s), 1) <> 1;
err2(s) = not sum(ts(t,s), yes);
err3(s) = not sum(sm(s,m), yes);
err5(s) = sum(t$(ts(t,s)-drop(t,s)), 1) = 0;
err6(s) = sum(tss(t,s), 1) > 1;
err7(t,s)$err6(s) = tss(t,s);
err8(m) = sum(inc, sameas(m,inc));

abort$card(err1) err1;
abort$card(err2) err2;
abort$card(err3) err3;
abort$card(err5) err5;
abort$card(err6) err6,err7;
abort$card(err7) err7;
abort$card(err8) err8;