3 ms·
ah! backtracking. combinatorial optimisation would be incredibly useful for me. if prolog is indeed backtracking as a language I definitely need to look into it
by lacampbell 10y ago
ah! backtracking. combinatorial optimisation would be incredibly useful for me. if prolog is indeed backtracking as a language I definitely need to look into it.
- tom_mellior 10y agoIt is indeed backtracking as a language, but you don't get optimization entirely for free. The backtracking part only means that you can write down a problem that has multiple solutions and get Prolog to enumerate those solutions using its default order. If the set of solutions is small enough, you can enumerate all of them and pick out the best one, or have it enumerate them until you get one that is good enough. But if you need a smarter exploration of the search space, you will (in general) have to write that yourself. Many implementations include an integer constraints library that will give you functionality similar to an ILP solver, which may or may not fit your domain.
- bloaf 10y agoWould it work well for algorithms like A*, or other quazi-AI problems that crop up in games?
- tom_mellior 10y agoYes, but you shouldn't expect it to have much more magic support for this kind of algorithms than other languages.