Underlying MapSet.
Algorithm interface - copy a value target another name, without resolving it (unless it's already resolved).
Algorithm interface - get a value by name
Get all possible values for this variable at this point. Should be used mainly for debugging.
Inject a variable and values to iterate over. The variable must not have been resolved yet.
Apply a function over every possible value of the given variable, without resolving it (unless it's already resolved). The function is assumed to be injective (does not produce duplicate outputs for distinct inputs).
Perform a transformation with multiple inputs and outputs. Inputs and outputs must not overlap. Can be used to perform binary operations, copy-transforms, and more.
Returns true if there are more states to iterate over, otherwise returns false
Algorithm interface - set a value by name
Resets iteration to the beginning. Equivalent to but faster than constructing a new MapSetVisitor instance (visitor = MapSetVisitor(visitor.set)).
Perform a transformation with one input and one output. Does not reorder the MapSet.
Apply a function over every possible value of the given variable, without resolving it (unless it's already resolved).
Peek at the subset the algorithm is currently working with.
Internal state.
Underlying MapSet.
An algorithm which divides two numbers. When the divisor is zero, we don't even query the dividend, therefore processing all dividends in one iteration.
alias M = MapSet!(string, int); M m = M.unitSet .cartesianProduct("divisor" , [0, 1, 2]) .cartesianProduct("dividend", [0, 1, 2]); assert(m.count == 9); auto v = MapSetVisitor!(string, int)(m); M results; int iterations; while (v.next()) { iterations++; auto divisor = v.get("divisor"); if (divisor == 0) continue; auto dividend = v.get("dividend"); v.put("quotient", dividend / divisor); results = results.merge(v.currentSubset); } assert(iterations == 7); // 1 for division by zero + 3 for division by one + 3 for division by two assert(results.get("divisor", 2).get("dividend", 2).all("quotient") == [1]); assert(results.get("divisor", 0).count == 0);
Allows executing a deterministic algorithm over all states in a given MapSet. If a variable is not queried by the algorithm, states for all variations of that variable are processed in one iteration.