Search found 137 matches

by aileen
3 years ago
Forum: GAMS-FAQ
Topic: I know a better solution
Replies: 1
Views: 1940

I know a better solution

Is it possible that I found a better solution for my model than the optimal solution provided by the solver?
by aileen
3 years ago
Forum: GAMS-FAQ
Topic: How do I write only the binding constraints to an external file?
Replies: 1
Views: 1887

Re: How do I write only the binding constraints to an external file?

To find out if a constraint is binding you just need to look at equation_name.slack . After solving you could selectively write only those instances of constraint e , which are binding: file fx /binding.txt/; put fx; loop((i,j)$(e.slack(i,j)<1e-6), put i.tl, j.tl, e.slack(i,j) / );
by aileen
3 years ago
Forum: GAMS-FAQ
Topic: How do I write only the binding constraints to an external file?
Replies: 1
Views: 1887

How do I write only the binding constraints to an external file?

Say I have that constraint:

Code: Select all

e(i,j).. ... =l= ...;
How do I write only the binding constraints to an external file?
by aileen
3 years ago
Forum: GAMS-FAQ
Topic: How do I model predecessor/successor relations?
Replies: 1
Views: 2088

Re: How do I model predecessor/successor relations?

The GAMS lingo for this is lag and lead operators : x(d,h-1) e.g. shows the previous hour. The - is not a numerical minus but a lag. Trouble is that the predecessor for x(d,'h1') is x(d-1,'h24') . You also have to decide what the predecessor of 'd1','h1' is. If you do a steady state model you could ...
by aileen
3 years ago
Forum: GAMS-FAQ
Topic: How do I model predecessor/successor relations?
Replies: 1
Views: 2088

How do I model predecessor/successor relations?

I have variables with two indices, e.g. x(d,h) , where d and h are sets of days and hours. My problem is to make a predecessor/successor relation between those x variables. E.g. I have to model the difference between two neighboring x variables like: delta(d,h) =e= x(d,h) - x(pred(d,h)); delta(d,h) ...
by aileen
3 years ago
Forum: GAMS-FAQ
Topic: How do I model that constraint: The sum of consecutive four elements in a vector should be less than 10?
Replies: 1
Views: 1990

Re: How do I model that constraint: The sum of consecutive four elements in a vector should be less than 10?

You can use the lag and lead operator as in the following example: Set i /1*10/; Alias (i,j); Set iconseq(i,j); Scalar cnt; loop(i, for(cnt=0 to 3, iconseq(i,i+cnt) = yes)); display iconseq; Variable x(i); Equation e(i); e(i).. sum(iconseq(i,j), x(i)) =l= 10; If you want your constraint to interpret...
by aileen
3 years ago
Forum: GAMS-FAQ
Topic: How do I model that constraint: The sum of consecutive four elements in a vector should be less than 10?
Replies: 1
Views: 1990

How do I model that constraint: The sum of consecutive four elements in a vector should be less than 10?

Say a vector x has ten values (decision variables). Objective: Maximize the sum of x. How do I model this constraint: The sum of consecutive four elements in the vector should be less than 10.