- Main Page
- Namespaces
- Classes
- Files
- Related Pages

# /Users/fpy/titan-1-5-MBARI/Mers/Solvers/SAT/GATSAT/CompileSAT/SATCompare.cpp

    00001 //#include <process.h>
    00002 #include <cstdio>
    00003
    00004
    00005 int main(int argc, char * argv[])
    00006 {
    00007         char const * generatorName = "generator.exe";
    00008
    00009         //char const * designFileName = "des%d.in";
    00010         //char const * dependentFileName = "sta%d.in";
    00011         //char const * constraintFileName = "con%d.in";
    00012         //char const * constraintFileName2 = "con%d.in2";
    00013
    00014         char const * designFileName = "desAUTO.in";
    00015         char const * dependentFileName = "staAUTO.in";
    00016         char const * constraintFileName = "conAUTO.in";
    00017         char const * constraintFileName2 = "conAUTO.in2";
    00018
    00019         unsigned int numVars = 30;
    00020
    00021         //char const * numVarsStr = "15";
    00022         unsigned int domainSize = 10;
    00023         //char const * domainSizeStr = "10";
    00024         unsigned int numDepVars = 23;
    00025         //char const * numDepVarsStr = "10";
    00026         //unsigned int numConstraint = 5;
    00027         //char const * numConstraintsStr = "5";
    00028         unsigned int maxConstraints = 5;
    00029         //char const * maxConstraintsStr = "5";
    00030
    00031         char const * ClauseSATName = "GATSATTest";
    00032         char const * ClauseSATOutputFileName = "GATSAT_Output.txt";
    00033         char const * OpsatName = "GATSATTest";
    00034         char const * OpsatOutputFileName = "SGATSAT_Output.txt";
    00035
    00036         unsigned int numConstraintsBegin = 1, numConstraintsEnd = 401,
    00037                 numConstraintsStep = 10;
    00038         unsigned int totalSamples = 5;
    00039
    00040         //_spawnlp(_P_WAIT, generatorName, generatorName,
    00041         //      numVarsStr, domainSizeStr, designFileName,
    00042         //      numDepVarsStr, dependentFileName,
    00043         //      numConstraintsStr, maxConstraintsStr, constraintFileName, NULL);
    00044
    00045         FILE * out = fopen("gen.bat", "w");
    00046         if(!out){
    00047                 perror("gen.bat");
    00048                 return 1;
    00049         }
    00050
    00051         unsigned int fileID, numConstraints;
    00052
    00053         fileID = 0;
    00054
    00055         fprintf(out, "@echo off\necho %s > %s\necho S%s > %s\n\n",
    00056                 ClauseSATName, ClauseSATOutputFileName,
    00057                 OpsatName, OpsatOutputFileName);
    00058
    00059         unsigned int uid = 0;
    00060         for(numConstraints = numConstraintsBegin; numConstraints <= numConstraintsEnd;
    00061         numConstraints += numConstraintsStep)
    00062         {
    00063                 unsigned int numSamples;
    00064                 for(numSamples = 0; numSamples < totalSamples; numSamples++, uid++){
    00065                         fprintf(out, "%s %d %d %03d%s %d %03d%s %d %d %03d%s\n", generatorName,
    00066                                 numVars, domainSize, uid, designFileName,
    00067                                 numDepVars, uid, dependentFileName,
    00068                                 numConstraints, maxConstraints, uid, constraintFileName);
    00069                         fprintf(out, "echo %s %d/%d %d/%d\n", ClauseSATName,
    00070                                 (numConstraints - numConstraintsBegin) / numConstraintsStep + 1,
    00071                                 (numConstraintsEnd - numConstraintsBegin) / numConstraintsStep + 1,
    00072                                 numSamples + 1, totalSamples);
    00073                         fprintf(out, "echo Start >> %s\nPrintTime >> %s\necho Test %d >> %s\n",
    00074                                 ClauseSATOutputFileName, ClauseSATOutputFileName, uid, ClauseSATOutputFileName);
    00075                         fprintf(out, "%s %03d%s %03d%s %03d%s -n10000 >> %s\n", ClauseSATName,
    00076                                 uid, designFileName, uid, dependentFileName, uid, constraintFileName2,
    00077                                 ClauseSATOutputFileName);
    00078                         fprintf(out, "echo End >> %s\nPrintTime >> %s\n",
    00079                                 ClauseSATOutputFileName, ClauseSATOutputFileName);
    00080                         fprintf(out, "echo %s %d/%d %d/%d\n", OpsatName,
    00081                                 (numConstraints - numConstraintsBegin) / numConstraintsStep + 1,
    00082                                 (numConstraintsEnd - numConstraintsBegin) / numConstraintsStep + 1,
    00083                                 numSamples + 1, totalSamples);
    00084                         fprintf(out, "echo Start >> %s\nPrintTime >> %s\necho Test %d >> %s\n",
    00085                                 OpsatOutputFileName, OpsatOutputFileName, uid, OpsatOutputFileName);
    00086                         fprintf(out, "%s %03d%s %03d%s %03d%s -n10000 -s >> %s\n", OpsatName,
    00087                                 uid, designFileName, uid, dependentFileName, uid, constraintFileName2,
    00088                                 OpsatOutputFileName);
    00089                         fprintf(out, "echo End >> %s\nPrintTime >> %s\n",
    00090                                 OpsatOutputFileName, OpsatOutputFileName);
    00091                         fputc('\n', out);
    00092                 }
    00093         }
    00094
    00095         return 0;
    00096 }