Question: Solving SAT, Please program in C++ -Create a program that must read a file in the DIMACS format. The format is well documented -The file
Solving SAT, Please program in C++ -Create a program that must read a file in the DIMACS format. The format is well documented -The file can be read in without looking at lines. Each data item in the file will be a single word -The first two words are to be ignored - the third word word is the count of variables in the problem. This will be less than 32. - The fourth word is the count of clauses in the input file. This will be less than 32. -The rest of the data comes in the format of clauses. -Each clause is made out of a few numbers.The numbers can be positive or negative. The lastnumber in a clause is 0. All non-zero numbers are part of the clause. -You are permitted to look up the DIMACS format for details. - A clause is satisfied when at least one of its variables is satisfied.Your program should keep track of the state of all problem variables. Each solution variable can be true or false. I will call this your proposed solution. -To check if your problem is solved, you need to look at every clause in the problem and see if aproposed solution satisfies all clauses.For every clause, check each variable. If your proposed solution has the variable set to true and your clause had this variable as a positive number then the clause is satisfied. If your proposed solution has the variable set to false and your clause had this variable as a negative number then the clause is satisfied. If you find a proposed solution that satisfies all clauses, you should print that solution and you are done. -Assign true or false to each proposed solution variable at random. Repeat this until the problem becomes solved.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
