## Error 171: Domain violation for set

Problems with syntax of GAMS
Gulsum
User
Posts: 3
Joined: 4 months ago

### Error 171: Domain violation for set

Dear all,

As a student on dissertation stage, I am working on a model for cost minimization in train shunting.
As a brief clarification of model; there are arriving train units, departing train units and shunting lines on which are used for coupling and decoupling of train units. Mathematical model was first described by Schrijver.
Attachments
MinShuntingCost_MathematicalModel.pdf
MinShuntingCost.gms

bussieck
Moderator
Posts: 340
Joined: 2 years ago

### Re: Error 171: Domain violation for set

If you want to use GAMS at a dissertation level, you need to invest more in learning the tool. Your errors are of very fundamental nature:

1. You need to make some sets subsets of i adn j:

Code: Select all

   itoj(i) 'arriving train units to be assigned to departing train units'/i7,i17,i27/
jtoi(j) 'departing train units to be matched with arriving train units'/j2,j12,j22/

2. The construct ord(j)-'1' makes no sense in GAMS. But you pdf does not help much either. The J_i and the I_j seem critical in your description. It's a nice set notation. In GAMS you often do this as maps Ji(j,i). Perhaps this is what you tried with the itoj and jtoi.

If you give a proper reference to Lex paper or provide the pdf of the relevant part of the paper there is a chance that someone here can help. I only found https://homepages.cwi.nl/~lex/files/Pla ... Tracks.pdf but can find little overlap with your pdf.

-Michael

Gulsum
User
Posts: 3
Joined: 4 months ago

### Re: Error 171: Domain violation for set

Dear Micheal,

As you mentioned, I have a lot to learn in GAMS. I am quite beginner.
And for second one, your understanding about subsets is correct. With ord(j)-'1' expression, I am trying to check the previous train unit in subsets in order to avoid any crossing. I provide a little bit clarification about crossing in train shunting as in attached file.

BRs
Gulsum
Attachments
Clarification About Crossing in Train Shunting.pdf

bussieck
Moderator
Posts: 340
Joined: 2 years ago

### Re: Error 171: Domain violation for set

There are big differences in the algebra in your write-up and the GAMS model, e.g. equation 6. I think I understand what the math does, but your equation does not implement the math and you try to make some arguments why the GAMS algebra also prevents crossing (true or not) but it does not implement the math! Your write-up is also missing the definition of some symbols (e.g. \tau_i, I guess this is the time the trains leaves or arrives) and is sloppy with symbol names (e.g. WL as train length in the text, but the algebra has l_i). I suggest that you do a proper mathematical write-up of the problem have a tables with the data in word and then try to implement exactly this math in GAMS. If you run into trouble with that I am sure you will find some help here.

-Michael

Gulsum
User
Posts: 3
Joined: 4 months ago

### Re: Error 171: Domain violation for set

Dear Micheal,

Thanks for your help, I will recheck the mathematical model then focus on GAMS model.

BRs
Gulsum