Page **1** of **1**

### Error 171: Domain violation for set

Posted: **Mon Apr 22, 2019 8:28 pm**

by **Gulsum**

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.

Could you please help me to figure out this error? Thanks in advance.

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

Posted: **Tue Apr 23, 2019 7:52 am**

by **bussieck**

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

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

Posted: **Tue Apr 23, 2019 11:09 pm**

by **Gulsum**

Dear Micheal,

Thanks for your prompt response.

As you mentioned, I have a lot to learn in GAMS. I am quite beginner.

For your first comment, it worked properly, thanks for your help.

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

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

Posted: **Fri Apr 26, 2019 3:57 pm**

by **bussieck**

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

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

Posted: **Sat Apr 27, 2019 2:03 pm**

by **Gulsum**

Dear Micheal,

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

BRs

Gulsum