OOPS Backend

This is done by SML_OOPS_driver() in sml-oops.cpp.

A node in the OOPS Matrix tree is represented by an OOPSBlock object. The OOPS matrices A and Q are created in generateSML(ExpandedModel*).

A node in the OOPS Matrix tree for A is basically represented by two ExpandedModel objects (with their corresponding NlFile objects):

  1. the first specifies the row node, i.e. the NlFile from which the constraints should be taken,
  2. the other specifies the col node, i.e. which variables should be taken.

These are the two parameters in the OOPSBlock constructor.

The specification of the variables is a bit tricky. The ExpandedModel node specifying the column doesn't directly carry a list of relevant expanded variable (names). All it contains is a list of variable definitions (from the AmplModel object that spawned it) and an NlFile object (that however contains more variable definitions than needed). What is done is to get a list of applicable variables for each ExpandedModel object by getting the list of variables defined in its NlFile and comparing this against the variable declarations in the originating AmplModel object. After obtaining this list of applicable variables this is compared with the variables declared in the row ExpandedModel.

This part of the implementation needs a lot of comparing strings against strings in nested loops and is quite inefficient.

This is all done in the constructor OOPSBlock::OOPSBlock(ExpandedModel*, ExpandedModel*).

Once this is done, the setup of the OOPS Matrices is straightforward. Each node in the OOPS matrix tree is generated with a pointer to the corresponding OOPSBlock object being passed as the identifier (which is subsequently used in the CallBack function)

All calls to amplsolver (the AMPL nl-file reader library) are done in the class NlFile. This is mainly because the main amplsolver include file "asl.h" defines many global variables, some of which clash with C++ keywords (e.g. list). This way the use of these keywords only needs to be avoided in NlFile.cpp