Element usage in browsing vs. solving

Describes model elements that are used differently when browsing than when solving.

Because the “browse” action displays the structure of the problem expressed by the model, it does not take into account whether the model elements are used or not at execution time and shows them all. In contrast, a “solve” action is interested by default only in the model elements that are part of the solutions (unless you check Force element usage, see Description of the OPL language options). This is why model elements that are not used by the solving algorithm are not visible in the Problem Browser whereas they are if you just click Browser before execution. For example, if you browse the model shown in the following code extract, the dexpr array is visible in the Problem Browser. If you execute this model, y does not belong to the solution because it does not comply with the allDifferent constraint. Therefore, the Decision expressions line of the Problem Browser remains empty.

dexpr arrays: browsing versus solving

using CP;

range R = 1..10;

dvar int x[R] in R;

dexpr int y[i in R] = x[i] +i;

subject to {
   allDifferent(x);
}


execute {
   writeln(x);
   writeln(y);
}

Compare Figure 1 and Figure 2.

Figure 1. Problem Browser: no dexpr after browse
dexpr in Problem Browser view after browse
Figure 2. Problem Browser: dexpr after solve
dexpr in Problem Browser view after solve