HN user

firechickenbird

61 karma
Posts4
Comments47
View on HN

My graph is a partial representation of the supermarket and does not contain all the goods. It has just the stuff that I've bought at least once and manually positioned into the nodes. Sometimes the supermarket decides to relocate groups of goods and I have to update my graph again, but it does not happen too often (they do it probably once or twice a year)

An app that helps me with shopping at my main supermarket.

I usually go always to the same supermarket twice a week. I was frustrated that every time I changed something in my shopping list I had to mentally recompute the optimal path to pick up everything.

Now with my app I am able to build the graph of the entire supermarket (each node represents a rack with shopping items) and then given my shopping list it computes the optimal path from the entrance to the exit. It's a version of the classical travelling salesman problem

No? In fact, if you understand what what I wrote, by generalizing this small piece of code it would mean that most of the codebase must be also partially rewritten to rust to be able to interoperate with the new data structures moved in rust. Thus these “less than 100 lines of code” refer to just this simple example program, which was fully rewritten in rust, hence, by generalizing, the premise was pointless

OP fully rewrote the example program in rust, by also moving the entire data structures there. This would mean that any interaction with these ndarrays could be possible only on the rust side, hence any other code that uses them must be rewritten, unless there’s some porting of rust ndarrays to python numpy ndarrays

Why SAT Is Hard 3 years ago

Let me first try to briefly summarize NP-completeness:

A problem A is NP-complete if:

- you can verify it's solution in polynomial time

- you can reduce it to any other NP-complete problem in polynomial time

Since polynomial reduction is transitive, the second point is equivalent to saying that "you can reduce it to SAT in polynomial time".

The reduction is simply a function that compiles the starting problem to SAT and preserves it's solvability (in a bijective way). In other words, to prove that a problem is NP-compelte, you must write a compilation function to SAT and also prove that every solution to the starting problem is also a solution to the destination problem in SAT. Furthermore you must also prove that any solution in the SAT version can be "decompiled" to a proper solution in the starting problem, so this is where the equivalence comes from and it's the reason that SAT is not really anyhow harder than other NP-complete problems.

The thing is, SAT has been heavily researched, so that's why you have extremely efficient SAT-solvers. So if you want to solve an NP-complete problem, you can simply compile it to SAT, solve it with well-known SAT-solvers and "decompile" the solution to your starting problem

Why SAT Is Hard 3 years ago

That is not entirely true

what are you referring to?

Obviously x^4 != x^10, but noone has ever proven that "if SAT is P, then it would have the lowest (or highest) polynomial complexity among the other problems", or anything similar

Why SAT Is Hard 3 years ago

Interesting informal summarization of SAT. However, there is no such thing as "the hardest" NP-complete problem. By definition of NP-completeness, if you solve ANY NP-complete problem in polynomial time, you can solve every other NP-complete problem in polynomial time, thus they have equivalent difficulty (although, some problems may seem intuitively easier than others).

IMO CTOs must have a broad knowledge of how things are done in all the fields, eg. web, mobile, backend, devops, nowadays ML etc. That way they can take more sane high-level and long term technological decisions. Otherwise you end up with a cto asking you to move everything on microservices for your 1k users app because he/she heard of a friend's company using them (based on a true story)

It makes no sense to me also. One of the reasons Python so popular is due to it's interoperability with libraries written in C/C++, otherwise it's just super slow language. In the browser you can't access these fast libraries so you are left with a crap language with an even slower execution due to the interpreter VM written in JS