hi
i need code for brute force Boolean satisfyability program.
plz help me i need it asap
thank u

(Waving hand) What you need is to turn your computer off and re-think your life!
3
Contributors
2
Replies
4
Views
8 Years
Discussion Span
Last Post by 0x69

hi
i need code for brute force Boolean satisfyability program.
plz help me i need it asap
thank u

hahahahahahahah

lol

thanks, man.

i needed that.

Hey man, you need to do homeworks yourself. But given that your mentioned problem is interesting NP problem,- i'll give you small pseudocode snippet:

``````#define OP_NOT 1
#define OP_AND 2
#define OP_OR 3
int bool_formula[6] = {OP_NOT,0,OP_AND,0,OP_OR,0};
int bit_pattern = -1;
char x1,x2,x3;
int is_formula_satisfiable = 0;
WHILE (bit_pattern <= 7 /*111 in binary*/) {
++bit_pattern;
x1 = extract_first_bit(bit_pattern);
x2 = extract_second_bit(bit_pattern);
x3 = extract_third_bit(bit_pattern);
substitute_x_variables_to(bool_formula);
// such as bool formula will become =>
// {OP_NOT,x1,OP_AND,x2,OP_OR,x3};
is_formula_satisfiable = Evaluate_bool_formula(bool_formula);
if (is_formula_satisfiable) {
// this bool formula is satisfiable and there is no need to
// analyze other combinations of x1,x2,x3
break;
}
}
// if after while loop variable is_formula_satisfiable == 0, then
// this bool formula is un-satisfiable or in other words -> is in-distinguishable
// from FALSE constant``````

Generalize this example to include support for parenthesis in bool formula and other details which you need.