SAT Random Solutions

17 views
Skip to first unread message

Juan Grados

unread,
Jul 25, 2016, 7:14:34 AM7/25/16
to sage-support
Hello 

I am trying to get different random solution for every loop in my code sage

    from sage.sat.boolean_polynomials import solve as solve_sat # optional - cryptominisat
    sr = mq.SR(1,1,1,4,gf2=True,polybori=True)
    F,s = sr.polynomial_system()
    iter = 0
    while(iter < 5):
        s = solve_sat(F)                                            # optional - cryptominisat
        F.subs(s[0])                                            # optional - cryptominisat
        s = solve_sat(F, n=1, s_verbosity=1, c_max_vars_sparse=4, c_cutting_number=8) # optional - cryptominisat
        print s[0]
        print '   '
        iter = iter + 1

but I get always the same solution. I try to use c_randomize=seed or set_random_seed(n), but I do not get different "random" solutions. Could you help me please?

--
---------------------------------------------------------------------
MSc. Juan del Carmen Grados Vásquez
Laboratório Nacional de Computação Científica 
Tel: +55 21 97633 3228
(http://www.lncc.br/)
http://juaninf.blogspot.com
---------------------------------------------------------------------

Martin R. Albrecht

unread,
Jul 26, 2016, 6:01:19 AM7/26/16
to sage-s...@googlegroups.com
Hi there,

did you check that your system has more than one solution? In any case,
solve_sat() takes a parameter `n` which tells it to recover more/all
solutions.

"""
* "n" - number of solutions to return. If "n" is +infinity then
all solutions are returned. If "n <infinity" then "n" solutions
are returned if "F" has at least "n" solutions. Otherwise, all
solutions of "F" are returned. (default: "1")
"""

Cheers,
Martin
--

_pgp: https://keybase.io/martinralbrecht
_www: https://martinralbrecht.wordpress.com
_jab: martinr...@jabber.ccc.de
_otr: 47F43D1A 5D68C36F 468BAEBA 640E8856 D7951CCF

Reply all
Reply to author
Forward
0 new messages