The first constraint in the structured NLP defined in 'The_Nlp' evaluates to a result whose dimensions contain the following unexpected index(es): Required_Resource_Constraint What you have here is an array of constraints. If your intention is for all of those constraints to be active in the same structured NLP, then you should move this constraint to its own variable and specify these indexes in the OptDimensions attribute. If your intention is to have an array of separate optimization problems along these indexes, then you will need to utilize the «Over» and «SetContext» parameters of DefineOptimization. See the Analytica Optimizer Guide for details.
When you have not explicitly specified the dimensions for a constraint, then in general it may be ambiguous as to whether Analytica could assimilate any extra indexes into the optimization problem or should array abstract over any extra indexes. Assimilation means that the constraint is really an array-of-constraints for the optimization problem, in which the solution found must satisfy many "scalar" constraints that vary over the extra indexes. If the index is array abstracted, then you end up with multiple optimization problems, where one particular constraint varies over each optimization problem to be solved.
When you see this error, it means that you have not explicitly indicated how extra indexes encountered in the constraint should be handled. Normally, when you don't indicate this, DefineOptimization will attempt to infer your most likely intention, and when it is able to do so, this message does not appear.
One scenario that can arise that would prevent Analytica from making a reasonable guess would be if the dimensionality of the constraint can vary with the candidate solution point. DefineOptimization will usually evaluate the constraint when defining the optimization problem in order to determine its dimensionality. When doing so, it needs to evaluate the constraint with one particular guess. If your model contains dimensionalities that are only introduced for some candidate points, then DefineOptimization could easily miss a dimension when it is determining how to handle extra dimensions, and then encounter the extra dimension(s) later during the solution process. Conditional dimensionality as described here is illustrated by the following constraint example:
Volume >= (if H > 5 then [1000, 2000] else 1000)
In this example, DefineOptimization might try H = 1, and thus miss the implicit dimension, but during the search when H = 6 is tried, suddenly an extra dimension is encountered and this error message appears.
To avoid this problem, you should explicitly specify which indexes are to be assimilated into your optimization problem for the constraint in question. You do this by bringing up the object window for the constraint and pressing the Indexes button in the Opt Dimensions attribute. If your constraint is scalar, then leave the right-hand side window blank, but when asked press the Scalar option.
To declare the dimensionality of a constraint, you must locate your constraint in a constraint node. So, if you've simply declared your constraint using an expression, be sure to move it into its own constraint node first.