domainchecking.cpp File Reference

This example enforces referential integrity also known in the GAMS lingo as domain checking. More...

#include "gams.h"
#include <map>
#include <vector>
#include <iostream>
#include <algorithm>

Go to the source code of this file.

Detailed Description

This example enforces referential integrity also known in the GAMS lingo as domain checking.

The GAMS C++ API does a delayed domain checking of symbols. So you can add records to a domain controlled parameter (e.g. p(i)) even though the GAMSSet i does not contain the label (yet). The user can trigger an explicit check of the referential integrity by calling the GAMSDatabase.CheckDomains (or GAMSSymbol.CheckDomains) method. The Object- oriented API provides methods to access the records that violate the referential integrity (see GAMSDatabaseDomainViolation for details). Domain checking is implicitly done when the GAMSDatabase is exported to a GDX file via the GAMSDatabase.export method or for databases provided in the GAMSJob.run method. The implicit domain check can be suppressed (and left to GAMS when importing data) via the GAMSDatabase.SuppressAutoDomainChecking property. This example demonstrates how to trigger domain checking and how to access the records that violate the referential integrity.

Definition in file domainchecking.cpp.