79313444

Date: 2024-12-28 08:32:33
Score: 0.5
Natty:
Report link

Related answer here, which says such mutability is not possible.

In ASP truth values do not change over time, either atoms are true or false for a specific answer set, they can not be overwritten.

So here's the solution I went with, using a #max directive:

roomCost(0).
finalroomCost(W) :- roomCost(0), #max {X, 1 : roomCost(X)} = W.
Reasons:
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (0.5):
Posted by: Kaushik Narayan