domain01.gms : Test implicit domain and domain violations

Description

With GAMS 49 we changed the behavior for implicit domain lists of sets used
as domain sets themselves.
Also, this test ensures to get expected domain violations which was not working
in all cases pre-GAMS 49.

Contributor: Lutz Westermann, January 2025


Small Model of Type : GAMS


Category : GAMS Test library


Main file : domain01.gms

$title Test implicit domain and domain violations (DOMAIN01, SEQ=977)

$onText
With GAMS 49 we changed the behavior for implicit domain lists of sets used
as domain sets themselves.
Also, this test ensures to get expected domain violations which was not working
in all cases pre-GAMS 49.

Contributor: Lutz Westermann, January 2025
$offText


Set i;
Parameter b(i);

* This is the implicit domain, so no error because of domain redefinition expected
Set i(*);
* If the domain was the unverse we allow to redefine to self domain 
Set i(i) /anything/;

set j(*) / some_j /;
* If the domain was the unverse we allow to redefine to self domain , even if there was data already
set j(j);

set k(*) / some_k /;
$onMulti
* If the domain was the unverse we allow to redefine to self domain , even if there was data already;
* Also, we allow to extend the data with $onMulti
set k(k) / some_other_k /;
$offMulti

set l(*) / some_l /;
$onMultiR
* If the domain was the unverse we allow to redefine to self domain , even if there was data already;
* Also, we allow to replace the data with $onMulti
set l(l) / some_other_l /;
$offMulti


$onEcho > expectFail.gms
set i(i)  / i1 /
    ii(i) / i1 / 
    j     / j1 /;
parameter p(j);    
p(j)$i('j1')  = 1;
$offEcho
$call gams expectFail.gms lo=%GAMS.lo%
$ifE errorlevel=0 $abort Expected domain violation

$onEcho > expectFail.gms
set i(i)  / i1 /
    ii(i) / i1 / 
    j     / j1 /;
parameter p(j);    
p(j)$ii('j1') = 1;
$offEcho
$call gams expectFail.gms lo=%GAMS.lo%
$ifE errorlevel=0 $abort Expected domain violation

$onEcho > expectFail.gms
set i(i)  / i1 /
    ii(i) / i1 / 
    j     / j1 /;
parameter p(j);    
p(j)$i(j)     = 1;
$offEcho
$call gams expectFail.gms lo=%GAMS.lo%
$ifE errorlevel=0 $abort Expected domain violation

$onEcho > expectFail.gms
set i(i)  / i1 /
    ii(i) / i1 / 
    j     / j1 /;
parameter p(j);    
p(j)$ii(j)    = 1;
$offEcho
$call gams expectFail.gms lo=%GAMS.lo%
$ifE errorlevel=0 $abort Expected domain violation