2021年3月19日星期五

How to use data structures instead of command line arguments with clingo - (ASP)

I'm starting off with logical programming, and I am working on a simple program to find shortest paths between nodes. The only tutorial I could really understand dealt with command arguments.

Is there a way I can replace Args in my program for a hardcoded structure like a list or something? Is that possible with asp?

import com.sap.cxlabs.bewater.logic.asp._  val shortestPath = SModels(Args( %here is where I'd like to use a data structure.   p.path(X, Y, W) :-(p.start(X), p.edge(X, Y, W)),   p.path(X, Z, A + B) :- (p.path(X, Y, A), p.edge(Y, Z, B)),   p.shortest(W) :- (p.end(Y), p.path(X, Y, W), not p.path(X, Y, Z), W < Z),  ))  shortestPath.deduct(facts)  

edit Args is start-nodes, end-nodes, edges

https://stackoverflow.com/questions/66717122/how-to-use-data-structures-instead-of-command-line-arguments-with-clingo-asp March 20, 2021 at 08:20AM

没有评论:

发表评论