better lifetime for variables in pohibiting set
This commit is contained in:
@ -206,9 +206,9 @@ impl Set {
|
||||
}
|
||||
|
||||
/// Computes minimized prohibiting set from reactants and inhibitors.
|
||||
/// Computes the powerset of the smallest reactants ∪ inhibitors set and
|
||||
/// checks for each element of that set if they are also in all other
|
||||
/// unions.
|
||||
/// Computes the powerset of the union of all reactants ∪ inhibitors sets
|
||||
/// and checks for each element of that set if they are also in all other
|
||||
/// unions. Then minimizes the result.
|
||||
pub fn prohibiting_set(
|
||||
reactants: &[Set],
|
||||
inhibitors: &[Set],
|
||||
@ -229,6 +229,8 @@ impl Set {
|
||||
inhibitors: {:?}",
|
||||
r, i))
|
||||
}
|
||||
|
||||
let mut t = {
|
||||
let union = reactants.iter()
|
||||
.zip(inhibitors.iter())
|
||||
.map(|(sr, si)| {
|
||||
@ -242,9 +244,12 @@ impl Set {
|
||||
for set in union.iter() {
|
||||
t.retain(|el| !el.intersection(set).is_empty());
|
||||
}
|
||||
t
|
||||
};
|
||||
|
||||
// minimization
|
||||
// remove sets that contain other sets
|
||||
{
|
||||
let mut tmp_t = t.clone().into_iter();
|
||||
let mut e = tmp_t.next().unwrap_or_default();
|
||||
loop {
|
||||
@ -268,6 +273,7 @@ impl Set {
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// replace pair of sets that have a common negative-positive element
|
||||
// with set without
|
||||
|
||||
Reference in New Issue
Block a user