user2664856
user2664856

Reputation: 630

Force a minimum number of instances

When running a model in alloy, you can define a maximum number of objects.

 // like this:
 run example for 10 MyElements

If you want exactly 10, you can write:

 run example for exactly 10 MyElements

But is there a way to force a minimum amount instead of a maximum ? Or something like an interval ? This would make testing much easier.

Upvotes: 0

Views: 158

Answers (1)

Alcino Cunha
Alcino Cunha

Reputation: 186

You could use cardinality constraints to force that. Something like

run {example and #MyElements>5} for 10 MyElements, 5 int

You need to be careful to set the integer bit-width to allow enough positive integers up to your scope.

Upvotes: 2

Related Questions