Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate all valid models for a given logical formula and/or CNF #166

Open
mattxwang opened this issue Jul 27, 2023 · 0 comments
Open

Generate all valid models for a given logical formula and/or CNF #166

mattxwang opened this issue Jul 27, 2023 · 0 comments

Comments

@mattxwang
Copy link
Member

Motivated from a conversation with Lisa: on top of model counting with .wmc(), it would be moderately useful to list out all valid models that satisfy a logical formula, and (optionally) the associated weights with each model.

Since this is computationally hard, we should do this on-demand only from the user. We can probably use the existing PartialModel struct; we could then return a tuple for each model, which contains both the assignments for each variable, and the associated weight.

I'm thinking something that looks like this:

let weights = WmcParams::new(/* ... */);
let formula: DDNNFPtr = builder.compile_cnf(); // can be whatever approach we'd prefer
let valid_models: ValidModels = formula.enumerate_models(&order, &weights);
for model in valid_models {
  println!("weight: {}, assignments: {}", model.weight(), model.assignments())
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Development

No branches or pull requests

1 participant