Commit f8ccc316 authored by Florent D'Halluin's avatar Florent D'Halluin
Browse files

Update accessible benchmark.

* src/bench/accessible/Makefile.bench: Adjust benchmark values.
* src/bench/accessible/accessible_bench.hh,
* src/bench/common/bench_constructs.hh: Move automaton creation.
parent 76eaaf17
2009-06-19 d-halluin <d-halluin@lrde.epita.fr>
Update accessible benchmark.
* src/bench/accessible/Makefile.bench: Adjust benchmark values.
* src/bench/accessible/accessible_bench.hh,
* src/bench/common/bench_constructs.hh: Move automaton creation.
2009-06-19 d-halluin <d-halluin@lrde.epita.fr>
 
Benchmarks: add documentation.
......
......@@ -5,7 +5,7 @@ bench: all
echo '=================='; \
echo '|accessible bench|'; \
echo '=================='; \
for n in 1000 2000 3000 4000 5000; do \
for n in 500 1000 1500 2000 2500; do \
echo "----------------------For $$n:"; \
echo "-------------- accessible:"; \
./accessible_bench $$n; \
......
......@@ -24,36 +24,34 @@
# include CONTEXT_HEADER
# include <vaucanson/algorithms/accessible.hh>
# include <iostream>
# include <vector>
using namespace vcsn;
using namespace vcsn::CONTEXT;
#include <common/bench_constructs.hh>
void accessible_bench(int n)
{
if (not n)
return;
AUTOMATON_TYPES_EXACT(automaton_t);
alphabet_t alpha;
alpha.insert('a');
automaton_t a = make_automaton(alpha);
std::vector<hstate_t> state_list;
for (int i = 0; i < n; ++i)
state_list.push_back(a.add_state());
a.set_initial(a.get_state(0));
a.set_final(a.get_state(0));
for (std::vector<hstate_t>::iterator i = state_list.begin(); i != state_list.end(); ++i)
for (std::vector<hstate_t>::iterator j = state_list.begin(); j != state_list.end(); ++j)
a.add_spontaneous(*i, *j);
BENCH_START("Vaucanson accessible", "FIXME.");
//automaton_t ret = accessible(a);
automaton_t a = aut_complete(n);
BENCH_START("Vaucanson accessible",
"Benchmark for listing the accessible states of an automaton\n"
"using Vaucanson.\n"
"\n"
"Input is a complete automaton with n states:\n"
"Between any two states, there exists a spontaneous transition.\n"
"(see src/bench/common/README_AUTOMATA for aut_complete).\n"
"\n"
"Process:\n"
"\n"
"1. Generate the input automaton (with parameter _n_).\n"
"2* Run accessible_states on the input automaton.\n");
accessible_states(a);
BENCH_STOP();
......
......@@ -141,4 +141,29 @@ automaton_t aut_ab()
}
/// Create a aut_complete automaton
/// (spontaneous transition between any two states).
/// See README_AUTOMATA for aut_complete.
automaton_t aut_complete(int n)
{
AUTOMATON_TYPES_EXACT(automaton_t);
alphabet_t alpha;
alpha.insert('a');
automaton_t a = make_automaton(alpha);
std::vector<hstate_t> state_list;
for (int i = 0; i < n; ++i)
state_list.push_back(a.add_state());
a.set_initial(a.get_state(0));
a.set_final(a.get_state(0));
for (std::vector<hstate_t>::iterator i = state_list.begin(); i != state_list.end(); ++i)
for (std::vector<hstate_t>::iterator j = state_list.begin(); j != state_list.end(); ++j)
a.add_spontaneous(*i, *j);
return a;
}
#endif // ! VCSN_BENCH_COMMON_BENCH_CONSTRUCTS_HH
Supports Markdown
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