Commit 1319ec0b authored by Alexandre Duret-Lutz's avatar Alexandre Duret-Lutz
Browse files

sat-minimize: limit number of iterations

* src/tgbaalgos/dtbasat.cc, src/tgbaalgos/dtgbasat.cc: Compute the
actual number of reachable states in the produced automaton to prepare
the next iteration.
parent e1be8e6e
// -*- coding: utf-8 -*- // -*- coding: utf-8 -*-
// Copyright (C) 2013 Laboratoire de Recherche et Développement // Copyright (C) 2013, 2014 Laboratoire de Recherche et Développement
// de l'Epita. // de l'Epita.
// //
// This file is part of Spot, a model checking library. // This file is part of Spot, a model checking library.
...@@ -803,6 +803,8 @@ namespace spot ...@@ -803,6 +803,8 @@ namespace spot
dtba_sat_synthetize(const tgba* a, int target_state_number, dtba_sat_synthetize(const tgba* a, int target_state_number,
bool state_based) bool state_based)
{ {
if (target_state_number == 0)
return 0;
trace << "dtba_sat_synthetize(..., states = " << target_state_number trace << "dtba_sat_synthetize(..., states = " << target_state_number
<< ", state_based = " << state_based << ")\n"; << ", state_based = " << state_based << ")\n";
dict d; dict d;
...@@ -834,6 +836,9 @@ namespace spot ...@@ -834,6 +836,9 @@ namespace spot
dtba_sat_synthetize(prev ? prev : a, --n_states, state_based); dtba_sat_synthetize(prev ? prev : a, --n_states, state_based);
if (next == 0) if (next == 0)
break; break;
else
n_states = stats_reachable(next).states;
delete prev; delete prev;
prev = next; prev = next;
} }
...@@ -860,7 +865,7 @@ namespace spot ...@@ -860,7 +865,7 @@ namespace spot
{ {
delete prev; delete prev;
prev = next; prev = next;
max_states = target - 1; max_states = stats_reachable(next).states - 1;
} }
} }
return prev; return prev;
......
// -*- coding: utf-8 -*- // -*- coding: utf-8 -*-
// Copyright (C) 2013 Laboratoire de Recherche et Développement // Copyright (C) 2013, 2014 Laboratoire de Recherche et Développement
// de l'Epita. // de l'Epita.
// //
// This file is part of Spot, a model checking library. // This file is part of Spot, a model checking library.
...@@ -947,6 +947,8 @@ namespace spot ...@@ -947,6 +947,8 @@ namespace spot
dtgba_sat_synthetize(const tgba* a, unsigned target_acc_number, dtgba_sat_synthetize(const tgba* a, unsigned target_acc_number,
int target_state_number, bool state_based) int target_state_number, bool state_based)
{ {
if (target_state_number == 0)
return 0;
trace << "dtgba_sat_synthetize(..., acc = " << target_acc_number trace << "dtgba_sat_synthetize(..., acc = " << target_acc_number
<< ", states = " << target_state_number << ", states = " << target_state_number
<< ", state_based = " << state_based << ")\n"; << ", state_based = " << state_based << ")\n";
...@@ -983,6 +985,8 @@ namespace spot ...@@ -983,6 +985,8 @@ namespace spot
--n_states, state_based); --n_states, state_based);
if (next == 0) if (next == 0)
break; break;
else
n_states = stats_reachable(next).states;
delete prev; delete prev;
prev = next; prev = next;
} }
...@@ -1011,7 +1015,7 @@ namespace spot ...@@ -1011,7 +1015,7 @@ namespace spot
{ {
delete prev; delete prev;
prev = next; prev = next;
max_states = target - 1; max_states = stats_reachable(next).states - 1;
} }
} }
return prev; return prev;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment