Error Messages/40935

< Error Messages
Revision as of 22:21, 17 February 2010 by Lchrisman (talk | contribs) (Created page with '= Error Text Examples = :The ''Shelf_space'' constraint in the structured NLP defined in ''My_opt_def'' evaluates to a result containing the following unexpected index(es): ''P…')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Error Text Examples

The Shelf_space constraint in the structured NLP defined in My_opt_def evaluates to a result containing the following unexpected index(es): Product.

Cause

While an optimization was being solved, a constraint was evaluated and found to have extra, unexpected indexes. There are basically three causes:

  1. An error in your model's logic -- you may have forgotten to Sum over the index or apply some other array-reducing function.
  2. You intended there to be an array of constraints - a separate constraint along each of these extra indexes within the same optimization problem.
  3. Your intention was to array-abstract over these indexes, resulting in multiple optimization problem instances, each solved separately.

Remedies

The correct remedy depends on which of the above cases fits your situation. For example, let's consider the following constraint that causes this error:

Ceil(Num_units / Stacking_height) * Unit_width <= Shelf_length

Case 1: Need array-reducing function

Suppose that all products need to share the same available shelf space. Shelf_length then does not vary by Product, while Num_units, Unit_width and Stacking_height does. Then it appears that we forgot to Sum by product to compute the total amount of shelf length consumed by all products. When evaluated, the optimizer encountered the unexpected dimension, Product. We can fix the problem by changing our definition to:

Sum(Ceil(Num_units / Stacking_height) * Unit_width, Product) <= Shelf_length

Case 2: Array of constraints

Suppose that a certain amount of shelf space has been allocated to each product type. Hence, Shelf_length' varies with Product (i.e., is indexed by Product), and what we really intend is to have an array of constraints all inside the same single optimization problem. In this case, we'll have one Shelf_space constraint for each product.

To do this, we need to tell the optimizer that the index Product is to be included as an optimization dimension for this constraint. There are several ways to do this, each may be convenient in different cases, depending on how you have formulated your constraint.

One general approach is to include the over keyword in your inequality expression. Here we've appended it to the end:

Ceil(Num_units / Stacking_height) * Unit_width <= Linear_shelf_space over Project

The syntax also allows you to prepend it to the front, or place it next to the inequality as demonstrated by these:

over Project Ceil(Num_units / Stacking_height) * Unit_width <= Linear_shelf_space 
Ceil(Num_units / Stacking_height) * Unit_width <= over Project Linear_shelf_space

The flexibility in syntax so that you can chose the one that is most readable in your particular case. This syntax can be used even if you specify your constraint directly in the parameter of DefineOptimization.

Alternatively, you can leave the constraint as is and list the index in the OptDimensions attribute. You can access the OptDimensions attribute in the attribute pane, or in the object window. However, to view it in the object window, you need to enable the visibility of the OptDimensions attribute from the Attributes... dialog on the Object menu. The attribute can only be used when your constraint is defined inside a constraint object, or inside a User-Defined Function. You cannot use this method when you specify the inequality expresson directly in the «constraints» parameter of DefineOptimization.

Case 3: Array-abstracting

Comments


You are not allowed to post comments.