Skip to content

Commit

Permalink
Split valuation to model conversion into a new function
Browse files Browse the repository at this point in the history
Signed-off-by: Alex Fischman <[email protected]>
  • Loading branch information
Alex-Fischman committed Jul 21, 2023
1 parent ddc4f2a commit f0513ee
Showing 1 changed file with 26 additions and 26 deletions.
52 changes: 26 additions & 26 deletions bounded/src/bdd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,39 +168,39 @@ impl Context<'_> {
}

// Convert valuations to models
let valuations: Vec<_> = valuations.into_iter().map(Option::unwrap).collect();
valuations
.into_iter()
.map(|valuation| self.convert_valuation(valuation.unwrap()))
.collect()
}

fn convert_valuation(&self, valuation: BddValuation) -> Model {
let universe = self
.signature
.sorts
.iter()
.map(|s| self.universe[s])
.collect();
valuations
.into_iter()
.map(|valuation| {
Model::new(
self.signature,
&universe,
self.signature
.relations
Model::new(
self.signature,
&universe,
self.signature
.relations
.iter()
.map(|r| {
let shape = r
.args
.iter()
.map(|r| {
let shape = r
.args
.iter()
.map(|s| cardinality(self.universe, s))
.chain([2])
.collect();
Interpretation::new(&shape, |elements| {
valuation
.value(self.vars[self.indices[r.name.as_str()][elements].0])
as usize
})
})
.collect(),
)
})
.collect()
.map(|s| cardinality(self.universe, s))
.chain([2])
.collect();
Interpretation::new(&shape, |elements| {
valuation.value(self.vars[self.indices[r.name.as_str()][elements].0])
as usize
})
})
.collect(),
)
}

fn mk_bool(&self, value: bool) -> Bdd {
Expand Down

0 comments on commit f0513ee

Please sign in to comment.