This is Python script that turns a csv file into a xml file that can work with AIspace's Consistency Based CSP Solver. http://www.aispace.org/downloads.shtml
A sample CSV file needs to be in this format.
Number of Variables n,,,...,
Variable 1’s Name,Varaible 1’s Domain Size,Value 1,Value 2,...,Value k1,,,...,
Variable 2’s Name,Varaible 2’s Domain Size,Value 1,Value 2,...,Value k2,,,...,
...
Variable n’s Name,Varaible n’s Domain Size,Value 1,Value 2,...,Value kn,,,...,
Number of All Different Constraints m,,,...,
Variable Name 1,Variable Name 2,...,Variable Name j1,,,...,
Variable Name 1,Variable Name 2,...,Variable Name j2,,,...,
...
     
2
Variable Name 1,Variable Name 2,...,Variable Name jm,,,...,
Number of Conjunctive Normal Form Clauses p,,,...,
Clause 1’s Literal 1,Clause 1’s Literal 2,...,Clause 1’s Literal i1,,,...,
Clause 2’s Literal 1,Clause 2’s Literal 2,...,Clause 2’s Literal i2,,,...,
...
Clause p’s Literal 1,Clause p’s Literal 2,...,Clause p’s Literal ip,,,...,
It can then be converted into a XML file with tags such as and
There is a sample csv file that includes simple CSV files that can be converted then solved.
Note: a empty output.xml is given in the repo., so you can skip some of the steps
Remember to clear the output.xml before running a new csv file
Open terminal in folder Type
chmod +x makemac.sh
./makemac.sh
Open parser.py in the 7th and 8th line, change the filename to the filename that you want to run the parser on.
python3 parser.py
Open prompt
make
OR just create a file named output.xml
Then Open parser.py in the 7th and 8th line, change the filename to the filename that you want to run the parser on.
c:\python23\python3 parser.py.