r/AskComputerScience • • Feb 26 '26

3sat "deterministic" solvers remain exponential?

Hello. I am a (french) amateur and uneducated in CompSci, please forgive me for my naïve question.

I spend about a year trying to solve 3 sat problems for fun and found by luck a way to solve
simple problems in a deterministic way (counting variables, applying a rule to each clauses and rectifying the "false/unchecked" clauses by a simple rule) which was very successful with low constraint ratios. Unfortunately not successful with satlib Solvable problems.
I discussed this fact with a probabilistic mathematician friend who explained to me I could imagine "hidden configurations" which made it so my solver would "loop" infinitely.

From what I understand, the more a variable is present in a 3 sat problem, the closest you are from an unsolvable problem, and clauses become more and more interlinked.

I don't have much knowledge in all of this, I feel I understand the logic but I was wondering if there are logic ways to overcome in a determinstic way these hidden loops.

My friend allso told me deterministic algorithms for solving Np-complete problems stay exponential in nature, which I don't really understand.

When I see how my algorithm works, it actually seems to lower the amount of procedures compared to random ( it loops in a smaller amount of variables than random) and so I feel it may not be really exponential. If any one feels to explain to me how that is I would be very grateful :)

Have a good day :)

7 Upvotes

14 comments sorted by

View all comments

Show parent comment

2

u/Objective_Mine MSCS, CS Pro (10+) Feb 26 '26

I'm at least happy to see layperson interest with an actual computer science question here. I think that's what this sub should be for!

Often the big challenge is coming up with algorithms that truly and provably work for all possible inputs, even the weird corner cases and the hardest possible "pathological" cases.

Since there are generally an infinite number of possible inputs, an algorithm can't be shown to be correct just by just trying lots of examples. For classical algorithms, computer scientists formally prove that an algorithm will always inevitably produce the correct answer, sort of like mathematicians prove that a formula always works. In addition to the correctness of an algorithm, its time complexity is also typically formally proven.

The time complexity of an algorithm tells how the time taken scales with the size of the input, such as the number of terms in 3SAT. At least the worst-case scenario is pretty much always analysed. Best-case and average-case time complexities are also often analysed but the best case is rarely interesting. For theoretical research the worst case tends to be the most interesting one.

Covering all possible instances is also often the challenge when trying to find efficient algorithms. A purported algorithm for a known hard problem such as 3SAT may work well for some subset of instances but for other instances will either fail to find the correct answer at all or will take a lot of time.

Unfortunately, especially for known hard problems, the likelihood of an amateur finding an algorithm that actually works efficiently in all cases is fairly low. Designing an algorithm that correctly solves all instances in any amount of time tends to take experience in computer science or mathematics. An amateur algorithm will often become a patchwork of trying to cover different problematic cases one by one. (So will attempts by beginning computer science students!)

The upside is that for some practical applications, an algorithm doesn't necessarily need to work in all theoretically possible cases as long as it works in some practically useful ones. Theoretical computer science is a lot more interested in hard formal proof, though.

1

u/Particular_Dig_6495 Feb 27 '26

Well, thank you (!!!) both of your answers are super instructive and show how this domain is truly fascinating. I'll take the time to understand much of what you have said :)

1

u/Particular_Dig_6495 Feb 27 '26 edited Feb 28 '26

From what I've read so far, would you say that measuring how many variables become "fixed" (or stop being part of unsatisfied clauses) after the initialization phase is a good practical way to judge how strong a heuristic really is?
In other words, if on a consistent basis the number of remaining active variables drops to something sub-exponential (like √n or log n --- which is theorically impossible), but still with the "smallest" score, would that be a solid sign that the heuristic has real meaningful power and could work well on a broader set of problems ? Is this a common "tool"? is this a practical way to evaluate the usefulness of an algorithm?
In my case it doesn't happen (I stay around 70 % of variables active in first phase ), but I'm genuinely curious about this idea.
My stuff is just simple variable counting, clause polarity voting and a basic correction step without backtracking.
For my simple mind it feels logically "sound" in theory, but I realize I'm missing a lot of advanced knowledge and it seems way too complex for me right now :)