Code: Select all

```
sum(t$(ord(t)>=2), periodutility(t))
```

Fred

- 2 weeks ago
- Forum: Modeling
- Topic: Sum function from t=2
- Replies:
**2** - Views:
**77**

Assuming that t is an orderd set (https://www.gams.com/latest/docs/UG_OrderedSets.html), you could use the ord operator:

I hope this helps!

Fred

Code: Select all

```
sum(t$(ord(t)>=2), periodutility(t))
```

Fred

- 2 weeks ago
- Forum: Solvers
- Topic: the solver found integer solution
- Replies:
**11** - Views:
**312**

No, unfortunately I can't. That's not how things work. I assume that your model is a description of an actual problem. As mentioned before, it is not unusual that it can take a long time to solve a MIP (especially when outdated software is used). You cannot just add some arbitrary constraints to get...

- 2 weeks ago
- Forum: Syntax
- Topic: Speeding up constraint creation during compilation
- Replies:
**2** - Views:
**117**

James, The crux is that you are making a lot of comparisons (in the range of card(h) x card(h)) in the equation body. Also, you are doing that for every z where the condition is completely independent from z. It is faster to precompute a mapping set outside the equation body. Basically you want for ...

- 2 weeks ago
- Forum: Modeling
- Topic: Change Equation over time
- Replies:
**4** - Views:
**138**

You can just move the dollar condition into the equation body.

I hope this helps!

Fred

Code: Select all

```
eq(t).. I(t) =E= S(t) * (Y(t)$(ord(t)<=5) + AY(t)$(ord(t)>=6)) ;
```

Fred

- 2 weeks ago
- Forum: Solvers
- Topic: the solver found integer solution
- Replies:
**11** - Views:
**312**

Hi,

As Michael already suspected, the log states

Fred

As Michael already suspected, the log states

Code: Select all

```
CPLEX Error 1001: Out of memory.
```

- 2 weeks ago
- Forum: Solvers
- Topic: the solver found integer solution
- Replies:
**11** - Views:
**312**

Hi, You are using a 13(!) year old version of GAMS and Cplex. I highly recommend to update to a more recent version (https://www.gams.com/download/). With the latest GAMS 27.2.0, Cplex reaches a smaller gap after seconds than what you get after hours. Still, the model seems to be challenging and you...

- 3 weeks ago
- Forum: Modeling
- Topic: Change Equation over time
- Replies:
**4** - Views:
**138**

Hi, You can have two different equations, one for t<=5 and one for t>=6. Assuming that t is an ordered set (https://www.gams.com/latest/docs/UG_OrderedSets.html), this can be done as follows: equation eq1(t), eq2(t); [...] eq1(t)$(ord(t)<=5).. I(t) =E= S(t) * Y(t); eq2(t)$(ord(t)>=6).. I(t) =E= S(t)...

- 3 weeks ago
- Forum: Solvers
- Topic: the solver found integer solution
- Replies:
**11** - Views:
**312**

Hi, You wrote that you get MODEL STATUS 8 integer solution . Applying IIS makes no sense because it computes an irreducible infeasible set but your model is feasible. SOLVER STATUS 3 resource interrupt means that a time limit was reached before any other termination criterion was satisfied. This is ...

- 3 weeks ago
- Forum: Solvers
- Topic: the solver found integer solution
- Replies:
**11** - Views:
**312**

Hi, Sometimes it can take a long time to solve a difficult MIP. If you need the optimal solution you can set the relative optimality criterion optcr to zero and at the same time you should in crease the time limit reslim to give CPLEX more time to solve to optimality: https://www.gams.com/latest/doc...

- 3 weeks ago
- Forum: Modeling
- Topic: Problem with loop in MINLP model.
- Replies:
**1** - Views:
**160**

Hi, Since you don't share with us how you set the starting point when you are not using a loop, there is no chance to tell you where the difference comes from. What you do in the loop looks strange. You set many variable levels and then you clear most of the variables before you do anything with the...