35. USEPNM
In many instances, you will need to get the index of a primitive set member within its set. Prior to release 4 of LINGO, you could do this by using the primitive set member's name directly in the model's equations. This can create problems when you are importing set members from an external source. In this case, you will not necessarily know the names of the set members beforehand. When one of the imported primitive set members happens to have the same name as a variable in your model, unintended results can occur. More specifically, LINGO would not treat the variable as optimizable. In fact, LINGO would treat it as if it were a constant equal to the value of the index of the primitive set member! In short, different primitive set names could potentially lead to different results. Therefore, starting with release 4.0 of LINGO, models such as the following are no longer permitted:
MODEL:
SETS:
DAYS /MO TU WE TH FR SA SU/;
ENDSETS
INDEX_OF_FRIDAY = FR;
END
If you want the index of FR in the DAYS set, you should use the @INDEX function:
INDEX_OF_FRIDAY = @INDEX( DAYS, FR);
If you are unable to update your models and you would like to allow for the direct use of primitive set names, you can enable the USEPNM option by setting it to 1. The default is for LINGO to disable USEPNM.