Re:Constraint Programming
by rhn_mk1 on Monday September 12, 2022 @04:30AM
(#32807481)
Does Prolog naturally support optimizing for an objective function?
[ Parent
| on HN ]
Re:Constraint Programming
by rad_gruchalski on Monday September 12, 2022 @05:22AM
(#32807735)
In Prolog, the predicate order matters. So, if I understand your question correctly, no. It's up to the dev to order predicates in such a way that the amount of backtracking is kept to minimal.
Well, most Prolog support clp(fd) (Constraint Logic Programming, Finite Domain) which mostly include support for minimizing/maximizing objectives.
Re:Constraint Programming
by rad_gruchalski on Monday September 12, 2022 @07:14AM
(#32808423)
By unification, which will only match the arity, not the rules inside of a predicate. I could be wrong, though. Still learning all ins and outs.