leonbohn / automata

MIT License
4 stars 0 forks source link

Bug in `streamline` function #79

Closed fesemeyer closed 5 months ago

fesemeyer commented 5 months ago

I am trying to streamline randomly generated DBA and DPA but when the streamlined function is called there is an error message: Here are code examples that produce the error: For a DBA:

let dba = DTS::builder()
            .with_transitions([
                (0, 'a', false, 3),
                (0, 'b', false, 0),
                (1, 'a', false, 2),
                (1, 'b', false, 2),
                (2, 'a', false, 2),
                (2, 'b', true, 1),
                (3, 'a', false, 2),
                (3, 'b', false, 1),
            ])
            .default_color(Void)
            .into_dba(0);
dba.streamline();

that errors with

thread 'main' panicked at {...}automata\src\automaton\omega\parity.rs:501:21:  
Could not find recoloring for edge (0, 'a')

And for a DPA:

let dpa = DTS::builder()
            .with_transitions([
                (0, 'a', 3, 2),
                (0, 'b', 3, 0),
                (1, 'a', 4, 0),
                (1, 'b', 3, 2),
                (2, 'a', 2, 1),
                (2, 'b', 0, 2),
            ])
            .default_color(Void)
            .into_dpa(0);
dpa.streamlined();

that errors with:

thread 'main' panicked at {...}automata\src\automaton\omega\parity.rs:501:21:  
Could not find recoloring for edge (0, 'a')

Note: Both examples have a problem with edge (0,'a') but this is not always the case.

leonbohn commented 5 months ago

Fixed by a commit that was merged in #78 .