steiner tree: eliminate identity loops
This commit is contained in:
parent
b7fb889dbf
commit
ad4b23d40e
3 changed files with 13 additions and 6 deletions
|
@ -98,7 +98,12 @@ impl<M: Morphism + Clone> MorphismBase<M> {
|
|||
&src_type.clone().param_normalize(),
|
||||
&m.get_type().src_type.param_normalize(),
|
||||
) {
|
||||
dst_types.push(MorphismInstance{ halo, m: m.clone(), σ });
|
||||
let dst_type =
|
||||
m.get_type().dst_type.clone()
|
||||
.apply_substitution( &|x| σ.get(x).cloned() )
|
||||
.clone();
|
||||
|
||||
dst_types.push( (σ, dst_type) );
|
||||
}
|
||||
}
|
||||
dst_types
|
||||
|
|
|
@ -107,8 +107,13 @@ impl PathApproxSteinerTreeSolver {
|
|||
let mut new_path_iter = new_path.into_iter().peekable();
|
||||
|
||||
// check all existing nodes..
|
||||
|
||||
if new_path_iter.peek().unwrap() == &src_type {
|
||||
new_path_iter.next();
|
||||
}
|
||||
|
||||
for mt in tree.iter() {
|
||||
// assert!( mt.src_type == &src_type );
|
||||
//assert!( mt.src_type == &src_type );
|
||||
if let Some(t) = new_path_iter.peek() {
|
||||
if &mt.dst_type == t {
|
||||
// eliminate this node from new path
|
||||
|
|
|
@ -14,8 +14,6 @@ pub enum TypeTerm {
|
|||
Num(i64),
|
||||
Char(char),
|
||||
|
||||
|
||||
|
||||
/* Complex Terms */
|
||||
|
||||
// Type Parameters
|
||||
|
@ -47,10 +45,9 @@ impl TypeTerm {
|
|||
*self = TypeTerm::App(vec![
|
||||
self.clone(),
|
||||
t.into()
|
||||
])
|
||||
])
|
||||
}
|
||||
}
|
||||
|
||||
self
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue