import java.util.ArrayList;\r
import java.util.List;\r
import java.util.Random;\r
+import java.io.*;\r
\r
/* Randomly generates problem instances that contain nested array operations */\r
\r
// Both Indexes and values have the same bitwidth, potentially missing some errors.\r
\r
-// Doesn't generate extensional problems yet..\r
+// Doesn't generate extensional problems!\r
\r
public class ArrayGenerator\r
{\r
static Random r = new Random();\r
\r
static int MAX_DEPTH;\r
+ static int numberOfInstances = 500;\r
\r
- public static void main(String[] args)\r
+ public static void main(String[] args) throws IOException\r
{\r
bits.add("b1");\r
bits.add("b2");\r
arrays.add("a2");\r
arrays.add("a3");\r
\r
- // When we get to the nesting depth, start to return leaf nodes (like symbols).\r
- MAX_DEPTH = r.nextInt(15) +1;\r
\r
- randomGenerate();\r
- }\r
+ for (int i=0; i < numberOfInstances; i++)\r
+ {\r
+ // When we get to the nesting depth, start to return leaf nodes (like symbols).\r
+ MAX_DEPTH = r.nextInt(15) +1;\r
\r
- static void randomGenerate()\r
+ randomGenerate("f"+i+".smt");\r
+ \r
+ }\r
+}\r
+\r
+ static void randomGenerate(String fileName) throws IOException\r
{\r
StringBuilder output = new StringBuilder();\r
output.append("(\n");\r
output.append(":assumption " + generateProp(0) + "\n");\r
\r
output.append(":formula true \n )\n");\r
- System.out.println(output);\r
+ \r
+ FileWriter fstream = new FileWriter(fileName);\r
+ BufferedWriter out = new BufferedWriter(fstream);\r
+ out.write(output.toString());\r
+ out.close();\r
+\r
}\r
\r
// Arrays are either array symbols, ites, or stores.\r