answer-set-programming

Attempting two-way communication between Python2.7 and ASP: writing contents of named pipe to a text file not working

流过昼夜 提交于 2019-12-25 08:36:55
问题 I'm using Python2.7, the SPARC ASP solver, and am running my code from the Ubuntu14.04 command line. I'm trying to set up two-way communication between my Python code and my ASP (answer-set-programming) code. To do this I am sending queries from python to ASP, putting the ASP response into a fifo pipe, and in the python code the contents of the fifo is read into a string and that string is then written to a text file (this is so that I can check the text file to see if I'm getting the output

How do I run an Answer Set Programming file from a C++ File?

淺唱寂寞╮ 提交于 2019-12-13 11:26:40
问题 What methods are there that I can use to run an ASP file from the main function of my C++ code? I'm doing a project in which I am expected to control a simulated turtlebot using a C++ file, and use ASP code to construct an action plan that the robot can use to achieve a specified goal. I'm using Ubuntu 14.04, SPARC (an ASP solver), ROS indigo, and gazebo. 回答1: Am I correct that SPARC is implemented in Java (this link)? If this is the case, there are quite a few options: You can use Java

How do I use output from SPARC solver as input to a python file?

*爱你&永不变心* 提交于 2019-12-13 07:18:27
问题 My question: I need to save the output from a SPARC solver (which is currently appearing as text in the terminal) as a variable in my Python code. How can I do this? Quick note: SPARC is a solver used for ASP (answer-set-programming) files - just mentioning this so that people don't get confused and think I am referring to asp.net. I am running a Python file and an ASP file (in query mode) simultaneously, in the same terminal, using the command python pythonfile.py | java -jar sparc.jar

Clingo: assert partial constraints

一曲冷凌霜 提交于 2019-12-12 01:23:52
问题 I am trying to implement a program in clingo that solves one of those classic riddles where you have a series of assertions of facts and constraints and you have to deduce other facts. Here goes the problem: Five men of different nationalities live in five side-by-side houses, each of a different color; they all have different jobs, a different favourite animal and favourite beverages. We know that: The English man lives in the red house. The Spanish man's favourite animal is the dog. The

Clingo/ASP: Best way to generate characters in a story generator

扶醉桌前 提交于 2019-12-11 15:17:25
问题 I am trying to write a story generator in Clingo. I am trying to say "new characters can be born if existing characters give birth to them." I define new characters as entity(<int\>) , which is the best way I could think of to representing entities. I cannot hardcode this as varying number of entities can be created in a story. My code is : % Create instances of time, only 3 for testing time(0..2). % Arrow of time flows forward next_t(T, T+1) :- time(T), time(T+1). % Entity 1 exists at time 0