Initializing help system before first use

Naming sets

It is customary in mathematical models to write index sets as 1,...,N or the like. Instead of translating this directly into Mosel code like the following:

 declarations
  x: array(1..N) of mpvar
 end-declarations

 sum(i in 1..N) x(i) >= 10

it is recommended to name index sets:

 declarations
  RI = 1..N
  x: array(RI) of mpvar
 end-declarations

 sum(i in RI) x(i) >= 10

The same remark holds if several loops or operators use the same intermediate set(s). Instead of

 forall(i in RI | isodd(i)) x(i) is_integer
 forall(i in RI | isodd(i)) x(i) <= 5
 sum(i in RI | isodd(i)) x(i) >= 10

which calculates the same intermediate set of odd numbers three times, it is more efficient to define this set explicitly and calculate it only once:

 ODD:= union(i in RI | isodd(i)) {i}

 forall(i in ODD) x(i) is_integer
 forall(i in ODD) x(i) <= 5
 sum(i in ODD) x(i) >= 10

Alternatively, loops of the same type and with the same index set(s) may be regrouped to reduce the number of times that the sets are calculated:

 forall(i in RI | isodd(i)) do
  x(i) is_integer
  x(i) <= 5
 end-do
 sum(i in RI | isodd(i)) x(i) >= 10

© 2001-2019 Fair Isaac Corporation. All rights reserved. This documentation is the property of Fair Isaac Corporation (“FICO”). Receipt or possession of this documentation does not convey rights to disclose, reproduce, make derivative works, use, or allow others to use it except solely for internal evaluation purposes to determine whether to purchase a license to the software described in this documentation, or as otherwise set forth in a written software license agreement between you and FICO (or a FICO affiliate). Use of this documentation and the software described in it must conform strictly to the foregoing permitted uses, and no other use is permitted.