# \[AMPL 25057\] error with the mod command: I is already defined

**URL:** <https://discuss.ampl.com/t/ampl-25057-error-with-the-mod-command-i-is-already-defined/1952>\
**Category:** Google Group Mirror\
**Created:** [October 15, 2024, 4:57pm UTC](https://discuss.ampl.com/t/ampl-25057-error-with-the-mod-command-i-is-already-defined/1952 "2024-10-15T16:57:29Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![AMPL\_Google\_Group](https://avatars.discourse-cdn.com/v4/letter/a/9dc877/32.png) [@AMPL\_Google\_Group](https://discuss.ampl.com/u/AMPL_Google_Group)\
**Post date:** [October 15, 2024, 4:57pm UTC](https://discuss.ampl.com/t/ampl-25057-error-with-the-mod-command-i-is-already-defined/1952/1 "2024-10-15T16:57:29Z")

</div>

Hello together,  
so basically I got the variable var I and also s.t. I which has to be like that based on the task we got from our prof.

But if I put in the command for my mod, I get following error:

I is already defined

context: s.t. \>\>\> I[\<\<\< t-1]+q[t]-d[t]=I[t];

For further understanding, I will send you my whole mod:

set T:= 1…4; #Anzahl der Perioden

param d; #Nachfrage in Periode

param I0; #Anfangslagerbestand

param s; #Rüstkostensatz

param h; #Lagerhaltungskostensatz

param M; #Eine hinreichend große Zahl

var q {t in T}\>=0;

var x {t in T} binary;

var I {t in T}\>=0;

minimize Kosten: sum{t in T} (s_x[t]+h_I[t]);

s.t. I[t-1]+q[t]-d[t]=I[t];

s.t. q[t]\<=M\*x[t];

s.t. q[t]\>=0;

s.t. I[t]\>=0;

s.t. x[t] binary;

Also another question: How come that some commands are in purple and some not ?

Thanks in Advance.

Anwar

---

<div class="post-metadata">

**Author:** ![AMPL\_Google\_Group1](https://avatars.discourse-cdn.com/v4/letter/a/a87d85/32.png) [@AMPL\_Google\_Group1](https://discuss.ampl.com/u/AMPL_Google_Group1)\
**Post date:** [October 16, 2024, 12:27am UTC](https://discuss.ampl.com/t/ampl-25057-error-with-the-mod-command-i-is-already-defined/1952/2 "2024-10-16T00:27:18Z")

</div>

Answered at [https://discuss.ampl.com](https://discuss.ampl.com)

---

<div class="post-metadata">

**Author:** ![Allaissem\_Beremadji](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.ampl.com/allaissem_beremadji/32/284_2.png) [@Allaissem\_Beremadji](https://discuss.ampl.com/u/Allaissem_Beremadji)\
**Post date:** [October 17, 2024, 5:58am UTC](https://discuss.ampl.com/t/ampl-25057-error-with-the-mod-command-i-is-already-defined/1952/3 "2024-10-17T05:58:48Z")

</div>

Hello to you all,

I cannot access your reply.

Thank you.
