Stochastic rule

Similarly to conditional rules, the CGA shape grammar permits stochastic rules, in other words, creating variation using randomness.

PredecessorShape --> 
                     percentage% : Successor1 
                     percentage% : Successor2
                     ...
                     else : SuccessorN

The sum of all percentages must not be greater than 100.

Example 1

Lot -->
	30%  : Lot("residential")
	20%  : Lot("retail")
	else : Lot("industrial")

In this example, there is a 30 percent chance that the first successor is chosen and a new Lot shape with parameter "residential" is generated, a 20 percent chance for the second successor, and a 50 percent chance for the last successor to be chosen.

All random numbers, and also the choice of the percentages above, depend on the current shape's seed (the seedian shape attribute).

Example 2

Again, condition blocks can be nested:

Lot -->
	30%  : 
	              50%  : Lot("residential")
	              else : NIL 
	20%  : Lot("retail")
	else : Lot("industrial")

Note:

A condition block must always be finished with an else: statement and percentages and successors must not be mixed up.


In this topic
  1. Example 1
  2. Example 2