evoldoers / machineboss

Bioinformatics Open Source Sequence machine
BSD 3-Clause "New" or "Revised" License
33 stars 7 forks source link

Calculation bugs causing overflows with --output-chars and --decode #74

Closed ihh closed 5 years ago

ihh commented 5 years ago

Correct:

% bossmachine preset/bittern.json --accept-chars 0022 --decode -v6
Command '--accept-chars' ==> acceptor for explicit character sequence '>>'
Composing 15-state transducer with 5-state transducer
Finding accessible states
Performing depth-first search of state space (max 75 states): started at Fri Oct  5 09:28:56 2018
Constructing namespace (24 states): started at Fri Oct  5 09:28:56 2018
Computing transition weights (24 states): started at Fri Oct  5 09:28:56 2018
Transducer composition yielded 24-state machine
Trimmed 24-state transducer into 3-state ergodic machine
Machine has no backward silent transitions; sort unnecessary
Machine is already an advancing machine; no transformation necessary
Machine is ergodic; no transformation necessary
Evaluating transition weights: started at Fri Oct  5 09:28:56 2018
Adding node <root>
Nodes: 1 Extending * (0)
Adding node 0
log(Sum_x(P(Sx*)) / P(S*)) = 0
Nodes: 2 Extending 0* (0)
Adding node 00
Nodes: 3 Best sequence so far: 00 (0)
log(Sum_x(P(Sx*)) / P(S*)) = 0
[{"input":{"name":"input","sequence":["0","0"]},"output":{"name":"","sequence":[]}}]

Incorrect:

% bossmachine preset/bittern.json --output-chars 0022 --decode -v6
Evaluating transition weights: started at Fri Oct  5 09:27:26 2018
Warning: pExit[0] = 2
Warning: pExit[1] = 2
Warning: pExit[2] = 2
Adding node <root>
Nodes: 1 Extending * (0)
Adding node 0
Adding node 1
log(Sum_x(P(Sx*)) / P(S*)) = 0
Nodes: 3 Extending 0* (0)
Adding node 00
Warning: LogP(00*)=1.09861 rose from LogP(0*)=0
Nodes: 4 Best sequence so far: 00 (0)
Adding node 01
log(Sum_x(P(Sx*)) / P(S*)) = 1.09861
Nodes: 5 Extending 00* (1.09861)
Adding node 000
Adding node 001
log(Sum_x(P(Sx*)) / P(S*)) = -1.09861
[{"input":{"name":"input","sequence":["0","0"]},"output":{"name":"0022","sequence":["0","0","2","2"]}}]