-
Notifications
You must be signed in to change notification settings - Fork 59
Description
This constraint currently has a horrible interface like this:
DiscretePermutationInvarianceConstraint(
parameters=["Solvent_1", "Solvent_2", "Solvent_3"],
# `dependencies` is optional; it is only required if some of the permutation
# invariant entries in `parameters` have dependencies on other parameters
dependencies=DiscreteDependenciesConstraint(
parameters=["Fraction_1", "Fraction_2", "Fraction_3"],
conditions=[
ThresholdCondition(threshold=0.0, operator=">"),
ThresholdCondition(threshold=0.0, operator=">"),
ThresholdCondition(threshold=0.0, operator=">"),
],
affected_parameters=[["Solvent_1"], ["Solvent_2"], ["Solvent_3"]],
),
)There are two things about it that do not necessarily make sense anymore:
Linked Dependency
If there are dependency-interactions with parameters of this constraint, the corresponding constraints must be included in this constraint definition as part of dependencies. This was done as it was believed necessary that dependency and permutation filtering must be done in one step and cant be done independently. This assumption has to be re-checked. If it turns out that its not necessary the dependency argument can drop entirely. This constraint interface would be easier to understand if that s possible.
Co-Permutation (Permutation in Groups)
Stemming from a background heavily motivated by mixtures, this constraint also takes parameters that should be co-permuted from dependencies. Example for situations of co-permutation:
Suppose when I permute ("s1", "s2"), I also need to change the fractions ("f1", "f2") accordingly. Tis happens eg for mixtures. I.e.
("s1", "s2", "f1", "f2")is equivalent to("s2", "s1", "f2", "f1")("s1", "s2", "f1", "f2")is NOT equivalent to("s2", "s1", "f1", "f2").
If dependencies is obsolete, there would be no way to find co-permuted columns. To fix this the interface of parameters needs to be amended to allow for these groups, ie it could be called copermuted_groups . Permuted groups could look like this:
parameters = ["p_1", "p_2", ...]
copermuted_groups = [["a_1", "a_2", ...], ["b_1", "b_2", ...]]
# indicating that the groups "a_k" and "b_k" should be permuted in the same way
# as the group "p_k". This is not the same as permuting the groups independently.
# For augmentation with the exsiitng utility, we simply need to pass (("p1", "a1", "b1"), ("p2", "a2", "b2"), ...).
# or just (("p1",), ("p2",), ...) if there are no copermuted groups.Since this would pose challenges for the shared parameters attribute between all constraints: Alternatively, an additional argument needs to be included.