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

Frequently asked questions about GAMS

Moderator: aileen

Forum rules
Please ask questions in the other sub-forums
Locked
aileen
User
User
Posts: 136
Joined: 4 years ago

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

Post by aileen »

Say I have that constraint:

Code: Select all

e(i,j).. ... =l= ...;
How do I write only the binding constraints to an external file?
aileen
User
User
Posts: 136
Joined: 4 years ago

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

Post by aileen »

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:

Code: Select all

file fx /binding.txt/; put fx; 
loop((i,j)$(e.slack(i,j)<1e-6), 
     put i.tl, j.tl, e.slack(i,j) /
     );
Locked