Search found 24 matches

by Gideon Kruseman
6 years ago
Forum: Syntax
Topic: how to model abs(variable) linearly
Replies: 12
Views: 18902

Re: how to model abs(variable) linearly

Hi Phallylka,
That's why you use the Steve and I described, so your system remains linear.
Best, Gideon
by Gideon Kruseman
6 years ago
Forum: Syntax
Topic: how to model abs(variable) linearly
Replies: 12
Views: 18902

Re: how to model abs(variable) linearly

Yanzhiping, Thet way I initially formulated the response to your question is that you have some sort of variable Q that can be either positive or negative. I assumed you wanted to have the absolute value of Q. If this is not the case I misunderstood your question. If thgis is the case, the code I pr...
by Gideon Kruseman
6 years ago
Forum: Syntax
Topic: how to model abs(variable) linearly
Replies: 12
Views: 18902

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
by Gideon Kruseman
6 years ago
Forum: Syntax
Topic: how to model abs(variable) linearly
Replies: 12
Views: 18902

Re: how to model abs(variable) linearly

You are making things way to complicated, Suppose Q takes on value 10 then due to the equation Q =e= Qpos -Qneg; Qpos takes on value 10 and Qneg takes on value 0; Suppose Q takes on value -10 then Qpos takes on value 0 and Qneg talkes on value 10; in either case the objective variable Z because of Z...
by Gideon Kruseman
6 years ago
Forum: Syntax
Topic: how to model abs(variable) linearly
Replies: 12
Views: 18902

Re: how to model abs(variable) linearly

If you want to define Qneg as negative variable, you have to rearrange the signs in all the equations so it makes sense. Defining both as positive variables is the common way to do this.
by Gideon Kruseman
6 years ago
Forum: Syntax
Topic: how to model abs(variable) linearly
Replies: 12
Views: 18902

Re: how to model abs(variable) linearly

Absolute_definition_of_Q.. Q =e= Qpos-Qneg;
by Gideon Kruseman
6 years ago
Forum: Syntax
Topic: how to model abs(variable) linearly
Replies: 12
Views: 18902

Re: how to model abs(variable) linearly

both variables should be defined as positive.

positive variables Qpos, Qneg;

free variables Q, Z "objective variable";

equation Absolute_definition_of_Q;

Absolute_definition_of_Q.. Q = Qpos-Qneg;

equation Objective;

Objective.. Z =g= 2*(Qpos+Qneg);
by Gideon Kruseman
6 years ago
Forum: Syntax
Topic: how to model abs(variable) linearly
Replies: 12
Views: 18902

Re: how to model abs(variable) linearly

Of course Steve, I forgot to mention that in my reply to the question. My bad.
by Gideon Kruseman
6 years ago
Forum: Syntax
Topic: how to model abs(variable) linearly
Replies: 12
Views: 18902

Re: how to model abs(variable) linearly

positive variables Qpos, Qneg;

Q =e= Qpos - Qneg;

* objextive now becomes 2*(Qpos+Qneg)
by Gideon Kruseman
6 years ago
Forum: Syntax
Topic: Multiplication and Addition with alias numbers and the error 148 & 133
Replies: 4
Views: 4568

Re: Multiplication and Addition with alias numbers and the error 148 & 133

Error 148 means that the the item has been declared with a different number of sets than you are using at that point. You have to be consistent.