Closed mariushegele closed 3 years ago
appears to be a related instance:
# Cartesian product of above
ducSolutions = list(itertools.product(*ducDomains))
# merge solutions: constrained ones and all possible distribution
# values
for sol in solutions:
for ducsol in ducSolutions:
# ...
Hmm, I don't remember just now what was the reason behind. Could be a Python 2-related stuff (which does not matter at the moment) or some internal conversion requirement. Anyway, if you need to create a big domain, it is not recommented to do it using add_rand
. Please use pre/post_randomize
instead if you see performance issues. Have a look here.
I see the point, thank you for the link!
The
add_rand
method of thecrv.Randomized
class expects an iterabledomain
. All given examples transform iterablerange
s tolist
s, e.g.:Why is this transformation necessary? It is not scalable to large ranges, because Python will construct the whole list in memory. The use of
domain
within constraint resolving appears to be only iteration. This works onrange
s even more efficiently: