mirror of
https://github.com/ellmau/adf-obdd.git
synced 2025-12-19 09:29:36 +01:00
fixed all warnings
Signed-off-by: Stefan Ellmauthaler <stefan.ellmauthaler@tu-dresden.de>
This commit is contained in:
parent
d4cbec0a76
commit
ee1e1bd1bf
12
src/adf.rs
12
src/adf.rs
@ -1,7 +1,5 @@
|
||||
use std::{
|
||||
collections::HashMap,
|
||||
num::ParseFloatError,
|
||||
ops::Deref,
|
||||
str::{self, FromStr},
|
||||
};
|
||||
|
||||
@ -22,7 +20,8 @@ impl Statement {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn add_ac(&mut self, ac: usize) {
|
||||
|
||||
pub fn _add_ac(&mut self, ac: usize) {
|
||||
self.ac = Some(ac);
|
||||
}
|
||||
}
|
||||
@ -70,7 +69,8 @@ impl Adf {
|
||||
/// This ac needs to be in the prefix notation for ADFs as defined by the DIAMOND implementation.
|
||||
pub fn add_ac(&mut self, statement: &str, ac: &str) {
|
||||
if let Some(stmt) = self.dict.get(statement) {
|
||||
self.add_ac_by_number(*stmt, ac)
|
||||
let st = *stmt;
|
||||
self.add_ac_by_number(st, ac)
|
||||
}
|
||||
}
|
||||
|
||||
@ -85,7 +85,7 @@ impl Adf {
|
||||
|
||||
pub fn grounded(&mut self) -> Vec<usize> {
|
||||
let mut interpretation: Vec<usize> = Vec::new();
|
||||
let mut change:bool = false;
|
||||
let mut change:bool;
|
||||
|
||||
for it in self.stmts.iter(){
|
||||
interpretation.push((*it).ac.unwrap())
|
||||
@ -119,7 +119,7 @@ impl Adf {
|
||||
fn setvarvalue(&mut self,interpretation:Vec<usize>, var:usize, val:bool) -> Option<Vec<usize>>{
|
||||
let mut interpretation2:Vec<usize> = vec![0;interpretation.len()];
|
||||
let mut change: bool = false;
|
||||
for (pos,it) in interpretation.iter().enumerate(){
|
||||
for (pos,_it) in interpretation.iter().enumerate(){
|
||||
interpretation2[pos] = self.bdd.restrict(interpretation[pos], var, val);
|
||||
if interpretation[pos] != interpretation2[pos]{
|
||||
change = true
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
use std::borrow::Borrow;
|
||||
use std::{env, process::exit};
|
||||
use std::fs::File;
|
||||
use std::io::{self, BufRead};
|
||||
@ -37,13 +36,13 @@ fn main() {
|
||||
|
||||
println!("parsed {} statements", statements.len());
|
||||
if statements.len() > 0 && ac.len() > 0 {
|
||||
let mut myAdf = Adf::new();
|
||||
myAdf.init_statements(statements.iter().map(AsRef::as_ref).collect());
|
||||
let mut my_adf = Adf::new();
|
||||
my_adf.init_statements(statements.iter().map(AsRef::as_ref).collect());
|
||||
for (s,c) in ac {
|
||||
myAdf.add_ac(s.as_str(), c.as_str());
|
||||
my_adf.add_ac(s.as_str(), c.as_str());
|
||||
}
|
||||
|
||||
let result = myAdf.grounded();
|
||||
let result = my_adf.grounded();
|
||||
println!("{:?}",result);
|
||||
for (p,s) in statements.iter().enumerate(){
|
||||
match result[p] {
|
||||
|
||||
@ -143,13 +143,13 @@ impl Bdd {
|
||||
self.if_then_else(terma, BDD_TOP, termb)
|
||||
}
|
||||
|
||||
fn printtree(&self, tree: Term) {
|
||||
fn _printtree(&self, tree: Term) {
|
||||
let node = self.nodes[tree];
|
||||
println!("Index: {}, Node: {}", tree, node);
|
||||
|
||||
if tree > BDD_TOP {
|
||||
self.printtree(node.lo);
|
||||
self.printtree(node.hi);
|
||||
self._printtree(node.lo);
|
||||
self._printtree(node.hi);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -238,7 +238,6 @@ mod test {
|
||||
let b = bdd.or(v2, v1);
|
||||
|
||||
let con1 = bdd.and(a, conj);
|
||||
let con2 = bdd.and(v1, v3);
|
||||
|
||||
let end = bdd.or(con1, b);
|
||||
let x = bdd.restrict(end, 1, false);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user