[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
## [Help-glpk] Re: What is the preference between a CHECK and a CONSTRAINT?

**From**: |
Andrew Makhorin |

**Subject**: |
[Help-glpk] Re: What is the preference between a CHECK and a CONSTRAINT? |

**Date**: |
Thu, 11 Dec 2003 11:56:29 +0300 |

>*I have been developing some MathProg models using GLPK 4.1 and I am*
>* confused to the difference between a check and a constraint. Although*
>* a check is defined as a logical test only rather than a numerical*
>* bound obviously there would be some overlap in some cases and a*
>* validation could take either form.*
>
>*Is it better to use either one or is the difference immaterial?*
Check statements are intended to check that all data specified by the
user of the model (i.e. mainly in the data section) are correct. For
example, if some parameter means the number of nodes in a network, it
must be positive integer, that is just the condition to be checked in
the check statement (although in this case such condition may be also
checked directly in the parameter statement). Note that check statements
are performed when the translator is generating the model, so they
cannot include variables. On the other hand, constraints are conditions
which are expressed in terms of variables and resolved by the solver
after the model has been completely generated. If all data specified in
the model are correct a priori, check statements are not needed and can
be omitted, while constraints are essential components of the model and
therefore cannot be omitted.
You may look at some examples included in the subdirectory 'examples',
especially at examples from Bob Fourer's paper (dist.mod, egypt.mod,
prod.mod, train.mod) to better understand the difference between check
statements and constraint declarations.