Search found 215 matches

by dirkse
6 years ago
Forum: Syntax
Topic: how to model abs(variable) linearly
Replies: 12
Views: 19177

Re: how to model abs(variable) linearly

Hi Steve, May I suggest changing equation f into: f .. sqr(x-cx) + sqr(-y-cy) =L= 1; This way you y will be negative and it shows better that the abs tricks work best, Gideon Gideon, Thanks for the suggestion. Indeed, it helps to show the reform tricks are working when the abs() function is "e...
by dirkse
6 years ago
Forum: Syntax
Topic: how to model abs(variable) linearly
Replies: 12
Views: 19177

Re: how to model abs(variable) linearly

Yanzhiping, I am attaching a little example that has 3 versions of the same model. A variant of this will be in the updated docs so I thought I'd give it a trial run here. The first uses abs() and therefore solves as a DNLP. This is not the recommended way. It is what you want to avoid. The second r...
by dirkse
6 years ago
Forum: Syntax
Topic: how to model abs(variable) linearly
Replies: 12
Views: 19177

Re: how to model abs(variable) linearly

I was just editing something in the next generation of GAMS documentation about this very example, so I'll comment here that you need to be minimizing abs(Q). If you're maximizing then you'll have to go to a MIP or perhaps a nonlinear formulation, but the nonlinear problem will be nonconvex so you m...
by dirkse
7 years ago
Forum: Modeling
Topic: condition to define a constraint
Replies: 4
Views: 7899

Re: condition to define a constraint

The quick way to do this is with a dollar condition in the constraint: set i /1*10/ alias(i, j); equations myconstraint(i,j); myconstraint(i,j)$[not sameas(i,j)] .. function(i,j) =e= 0; The logic is all part of the myconstraint definition. Since it's simple, that works well. For more complicated con...
by dirkse
7 years ago
Forum: Solvers
Topic: CPLEX stuck "Removing shift" on MILP
Replies: 3
Views: 5183

Re: CPLEX stuck "Removing shift" on MILP

Claudio, If this is something you can conveniently pack up and send to GAMS Support, that would be my recommendation. This sounds like something CPLEX would want to address, but the behavior may depend on the GAMS/CPLEX link so I wouldn't recommend passing this to them directly. I was a little confu...