Comments (5)
Maybe I am missing something, but from your description, it sounds like var_select
followed by var_project
would do what you are after, right?
I have implemented a quick prototype here - if this corresponds to what you are describing, I can put it into the next release :) (Granted, there is probably a slightly faster algorithm to do this in one "go" - I don't have the time to implement it at the moment though, maybe later this year if everything goes well)
from biodivine-lib-bdd.
Thanks for the reply, i will have a look into the var_select
+ var_project
approach and test whether it works out as intended and performs good enough for my application.
In the next release it will be pretty easy to adapt to the "restrict" function then.
I'll let you know when I've done the related testing in the following days.
from biodivine-lib-bdd.
Cool! I'll keep this issue open until it is implemented properly, and I've added this into the 0.4.0
milestone. Thank you for reporting!
from biodivine-lib-bdd.
Thanks again for the advice. The solution where both operations are chained is working reasonable well on the first tests. (honestly I did not expect that chaining both operations is that well-performing).
Till the feature is implemented in the project, i have implemented a trait for easier use.
/// Implementations of the restrict-operations on BDDs
pub trait BddRestrict {
/// Provides an implementation of the restrict-operation on BDDs for one variable
fn var_restrict(&self, variable: biodivine_lib_bdd::BddVariable, value: bool) -> Self;
/// Provides an implementation of the restrict-operation on a set of variables
fn restrict(&self, variables: &[(biodivine_lib_bdd::BddVariable, bool)]) -> Self;
}
impl BddRestrict for biodivine_lib_bdd::Bdd {
fn var_restrict(&self, variable: biodivine_lib_bdd::BddVariable, value: bool) -> Self {
self.var_select(variable, value).var_project(variable)
}
fn restrict(&self, variables: &[(biodivine_lib_bdd::BddVariable, bool)]) -> Self {
let mut variablelist: Vec<biodivine_lib_bdd::BddVariable> = Vec::new();
variables
.iter()
.for_each(|(var, _val)| variablelist.push(*var));
self.select(variables).project(&variablelist)
}
}
PS: I'm not happy about the construction of the helping vector in here, but it is just a quick workaround for now.
from biodivine-lib-bdd.
For now, I have merged the "naive" algorithm that combines select
and project
. This is now released as part of version 0.4.0
. Further performance improvements to the method will be tracked as part of #28.
from biodivine-lib-bdd.
Related Issues (20)
- Faster projection/selection/restriction algorithms. HOT 1
- Functions `read_as_string` a `write_as_string` are private HOT 1
- A greedy `pick` implementation
- Implementation of `infer_regulatory_graph` can use too much memory HOT 1
- Allow BDD operations to execute as interruptible async functions
- Isses with BDD serialisation on buffered reader/writer HOT 1
- Convert `BddValuation` back to `Bdd`. HOT 1
- Reconsider `Ord` trait on `BddValuation` HOT 5
- Add linear-time algorithm for BDD -> CNF conversion HOT 1
- Add algorithm to build BDD satisfied by valuations of size `k`. HOT 1
- support if_then_else op HOT 3
- Is it possiable to impl AndAbstract? HOT 5
- Ensure uniform sampling for randomized operations
- Implement `From BddValuation for BddPartialValuation` HOT 1
- Self-referential substitution
- Add the "optimized DNF" introduced in `balm` HOT 1
- Faster `restrict` algorithm HOT 1
- Provide generic `BddVariableSet` that does not necessarily rely on string names HOT 1
- Support `Conditional` ternary operator HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from biodivine-lib-bdd.