unload13.gms : Unload with relaxed and full domain

Description

This test checks that

1) GAMS unloads with regular/full domain informations with an unload with
   no arguments and relaxed domain information in all other cases.
2) Check that domain matching works with regular and relaxed domains
   and results in the same as a domain defining declaration of p
Contributor: Michael Bussieck, January 2021


Small Model of Type : GAMS


Category : GAMS Test library


Main file : unload13.gms

$title 'unload with relaxed and full domain' (UNLOAD13,SEQ=846)

$ontext
This test checks that

1) GAMS unloads with regular/full domain informations with an unload with
   no arguments and relaxed domain information in all other cases.
2) Check that domain matching works with regular and relaxed domains
   and results in the same as a domain defining declaration of p
Contributor: Michael Bussieck, January 2021
$offtext

Set i /i1,i2/; Parameter p(i) / i1 1, i2 2/; Alias (j,i); 
$gdxOut ulrelaxed
$unload j
$unload i
$unload p
$gdxOut
$onEcho > expected
SyNr  Type  DomInf Symbol
   1   Set    None i(*)
   2 Alias    None j(*)
   3   Par Relaxed p(i)
$offEcho
$call.checkErrorLevel gdxdump ulrelaxed.gdx domaininfo > actual
$call.checkErrorLevel diff actual expected > %system.nullFile%

$gdxOut ulfull
$unload
$gdxOut

$onEcho > expected
SyNr  Type  DomInf Symbol
   1   Set    None i(*)
   3 Alias    None j(*)
   2   Par Regular p(i)
$offEcho
$call.checkErrorLevel gdxdump ulfull.gdx domaininfo > actual 
$call.checkErrorLevel diff actual expected > %system.nullFile%

$onMultiR
$clear i
$gdxIn ulrelaxed
$load i<p
Set irelaxed / #i /;

$clear i
$gdxIn ulfull
$load i<p
Set ifull / #i /;

Set ddd; Parameter pddd(ddd<);
$gdxIn ulrelaxed
$load pddd=p

abort$(card(irelaxed)<>2) 'wrong irelaxed', irelaxed;
abort$(card(ifull)   <>2) 'wrong ifull',    ifull;
abort$(card(ddd)     <>2) 'wrong ddd',      ddd;

scalar cnt /0/;
loop((irelaxed,ifull,ddd)$(sameAs(irelaxed,ifull) and sameAs(ifull,ddd)), cnt = cnt+1);
abort$(cnt<>2) 'wrong cnt', cnt, irelaxed, ifull, ddd;