Basic constraints

July 27, 2024 || Item:7.3.Basic constraints

- The inside is used to distribute the value of random variables within a range or a set of value. Use '!'  if the value needs to be outside of range. 

 - The dist (distribution) is used within constraints to specify the probability distribution of random variables. It's only use for 'rand' variable. 

<value> := <weight>: weight is assigned to the value. If the value is a range, the weight is assigned to each value in the range. 

<value> :/ <weight>: weight is also assigned to the value, However, if the value is a range, the weight/n is assigned to each value in the range, with 'n' is the number of values in the range.  

- The symbol '->' is used in conditional constraint. The constraint on the right-hand side is apllied only if the condition on the left-hand side is true. In more compilcated situation, an if-else block can be used. 

- The foreach loop can also be used in constraints. It's useful for handing array data. 

- The unique is used to unique values to set of variables or unique elements to an array.

 

Example 

Output 







Comments:

Leave a comment: