satispy icon indicating copy to clipboard operation
satispy copied to clipboard

Satispy can use constans

Open crptcusco opened this issue 5 years ago • 2 comments

I use satispy to solve boolean functions, but I need some variables to have constant values 0 or 1, True or False. Can the library do that?

crptcusco avatar Apr 12 '19 18:04 crptcusco

@crptcusco Hey did you find out anything about this? Would be grateful if you can share.

Arvind-777 avatar Aug 26 '23 07:08 Arvind-777

Yes, use a boolean property that can be used to set values. It is about placing the formula in CNF and we put the variable that we want to set by adding the variable to the formula with AND.

For example, to set the variable x5 , in the function

(x1 OR x5 OR -x2) AND (-x3 OR x4 OR x1)

If we want to set it positive, we can formulate it in CNF

(x1 OR x5 OR -x2) AND (-x3 OR x4 OR x1) AND x5

If we want the value in negative we put like this

(x1 OR x5 OR -x2) AND (-x3 OR x4 OR x1) AND -x5

So the SAT-Solver the only way to give a true answer is through the fixed value. This property works with Satispy.

crptcusco avatar Aug 26 '23 19:08 crptcusco