Commit 14ca2518 authored by Sébastien Piat's avatar Sébastien Piat
Browse files

eppstein: test with rmin

Address #113.

* tests/python/lightest.py: Here.
* vcsn/algos/lightest.hh: Here.
parent a887c2a3
......@@ -315,8 +315,8 @@ def PLAN():
print('PASS:', npass)
print('FAIL:', nfail)
def weightset_is(ctx, expected):
def weightset_of(ctx):
s = str(ctx).lower().split('-> ')
return 0 < len(s) and s[-1] == expected.lower()
return s[-1] if 0 < len(s) else None
atexit.register(PLAN)
......@@ -11,7 +11,7 @@ k_algos = ['auto', 'breadth-first', 'yen', 'eppstein']
def check_aut(aut, re, num, exp, tests = []):
for algo in tests if tests else algos if num == 1 else k_algos:
if algo != 'eppstein' or weightset_is(ctx, 'nmin'):
if algo != 'eppstein' or weightset_of(ctx) in ['nmin', 'rmin', 'zmin']:
print(algo + ':' + re)
p = aut.lightest(num=num, algo=algo)
CHECK_EQ(exp, p)
......@@ -61,7 +61,7 @@ check(r'\z', 3, r'\z')
check(r'\e', 3, r'<0>\e')
check('a+b', 2, '<0>a + <0>b')
check('ababab', 10, '<0>ababab')
check('(<1>a+<1>b)*', 7, r'<0>\e + <1>a + <1>b + <2>aa + <2>ab + <2>ba + <2>bb', ['auto'])
check('(<1>a+<1>b)*', 7, r'<0>\e + <1>a + <1>b + <2>aa + <2>ab + <2>ba + <2>bb', ['auto', 'eppstein'])
check('<4>a+(<1>a<1>b)+<1>c+<2>d', 1, '<1>c')
zero = ctx.expression(r'\z').standard()
......
......@@ -203,9 +203,9 @@ namespace vcsn
}
else if (algo == "eppstein")
{
require(std::is_same<weightset_t_of<Aut>, vcsn::nmin>::value,
require(is_tropical<weightset_t_of<Aut>>::value,
"lightest: eppstein: invalid weightset: ",
aut->weightset());
*aut->weightset());
const auto ps = make_word_polynomialset(aut->context());
auto res = ps.zero();
auto computed = compute_eppstein(aut, aut->pre(), aut->post(), num);
......
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