Compare commits

...

12 Commits

Author SHA1 Message Date
103c4d4481
Add signal handler for SIGTERM
As the benchmark runner doesn’t send a SIGINT but a SIGTERM, the signal
handler printing the statistics wasn’t triggered.
2018-02-01 14:45:00 +01:00
62ec122116
Remove memory statistics for interrupt safety
Reading the memory statistics requires a call to fopen, which uses the
async-signal-unsafe function malloc. For this reason, interrupting
Madagascar could lead to a crash when coinciding with allocations.

Removing the memory statistics doesn’t do much harm, as this can still
be read from an outside program such as the benchmark runner.
2018-01-31 18:28:49 +01:00
6c25431873
Add more statistics
This adds the following statistics: the number of state variables before
and after preprocessing, the number of ground actions before and after
preprocessing, and the maximum size of a strongly connected component.
2018-01-31 17:24:06 +01:00
f0b59029d1
Hide iterations section if none were performed 2018-01-26 18:57:24 +01:00
36472346f8
Fix out-of-bounds access if no iteration performed 2018-01-26 18:56:16 +01:00
bf2400fd98
Print statistics on SIGINT 2018-01-26 18:56:16 +01:00
a9ee64ed81
Print plan statistics only if plan found 2018-01-26 18:46:42 +01:00
704fbcf130
Move statistics output to dedicated function 2018-01-26 18:37:03 +01:00
583ee11728
Add detailed statistics in YAML format 2018-01-26 17:23:54 +01:00
46bdb212de
Print more statistics 2018-01-25 17:48:56 +01:00
e960f0d764
Fix syntax error 2018-01-25 16:57:05 +01:00
ffe5ae8914
Make Mp the default planner 2018-01-25 16:56:43 +01:00
4 changed files with 113 additions and 37 deletions

View File

@ -1,17 +1,17 @@
# 2012 (C) Jussi Rintanen, jrintanen.jr@gmail.com # 2012 (C) Jussi Rintanen, jrintanen.jr@gmail.com
# Uncomment for Madagascar with the planning heuristic as default (Mp) # Uncomment for Madagascar with the planning heuristic as default (Mp)
#VERSION = -DMPDOWNLOAD VERSION = -DMPDOWNLOAD
#EXECUTABLE=Mp EXECUTABLE=Mp
# Uncomment for Madagascar C with the planning heuristic as default (MpC) # Uncomment for Madagascar C with the planning heuristic as default (MpC)
VERSION = -DCMPDOWNLOAD #VERSION = -DCMPDOWNLOAD
EXECUTABLE=MpC #EXECUTABLE=MpC
# Uncomment for Madagascar with VSIDS as default (M) # Uncomment for Madagascar with VSIDS as default (M)
#VERSION = -DVSIDS #VERSION = -DVSIDS
#EXECUTABLE=M #EXECUTABLE=M
#ARCH=-m32 #ARCH=-m32
INSTRUMENT = #-g -ggdb -pg INSTRUMENT = -g -ggdb -pg
CONFIGURATION= -DLBD -DREPRTHREE -DWEIGHTS #-DFUIP #-DMULTICORE #-DSPREAD -DCOSTS -DCFMA -DCP3 CONFIGURATION= -DLBD -DREPRTHREE -DWEIGHTS #-DFUIP #-DMULTICORE #-DSPREAD -DCOSTS -DCFMA -DCP3

View File

@ -1524,7 +1524,7 @@ int solve0(satinstance sati,int conflictstogo,int restart) {
sati->value = 0; sati->value = 0;
return 0; return 0;
SAT: SAT:
printf("SAT (%i decisions %i conflicts)\n",sati->decisions,sati->conflicts); printf("SAT (%i ID %i decisions %i conflicts %i variables)\n",sati->id,sati->decisions,sati->conflicts,sati->nOfVars);
#ifdef COSTS #ifdef COSTS
printf("FINAL COST %i.\n",sati->currentcost); printf("FINAL COST %i.\n",sati->currentcost);
sati->costbound = sati->currentcost; sati->costbound = sati->currentcost;

View File

@ -304,7 +304,7 @@ inline int ctruep(cfma f) {
} }
#endif #endif
inline int truep(fma *f) { int truep(fma *f) {
fmalist *fs; fmalist *fs;
switch(f->t) { switch(f->t) {
case natom: return (onelits[f->a] != 1); case natom: return (onelits[f->a] != 1);

136
main.c
View File

@ -35,6 +35,14 @@
#include <omp.h> #include <omp.h>
#endif #endif
int numberOfGroundActionsAfterParsing = -1;
int numberOfStateVariablesAfterParsing = -1;
int numberOfGroundActionsAfterSimplification = -1;
int numberOfStateVariablesAfterSimplification = -1;
int maxSizeOfStronglyConnectedComponents = -1;
char state_for_random[256]; char state_for_random[256];
char dump_for_random[256]; char dump_for_random[256];
@ -73,22 +81,10 @@ void givememorystatistics() {
unsigned text;// text (code) unsigned text;// text (code)
unsigned lib;// library unsigned lib;// library
unsigned data;// data/stack unsigned data;// data/stack
int MB;
fscanf(pf, "%u %u %u %u %u %u", &size, &resident, &share, &text, &lib, &data); fscanf(pf, "%u %u %u %u %u %u", &size, &resident, &share, &text, &lib, &data);
MB = ((double)size)/256.0; printf("memoryConsumption:\n total: %.1f # [MB]\n", ((double)size)/256.0);
printf("total size %.3f %s\n",
/*
resident size: %u\n
shared pages : %u\n
text (code) : %u\n
library : %u\n
data/stack : %u\n",
*/
(MB < 700.0) ? MB : MB / 1024.0,
(MB < 700.0) ? "MB" : "GB");
} }
fclose(pf); fclose(pf);
} }
@ -211,7 +207,96 @@ void processheuristic(char *decls) {
} }
void printStatistics()
{
printf("\n\n# statistics in YAML format\n---\n");
printf("runtime:\n total: %.2f # [s]\n preprocessing: %.2f # [s]\n",
time2real(time10ms() - TIMEstart),
time2real(TIMEpreprocess - TIMEstart));
printf("maxLearnedClauseLength: %i\n",stats_longest_learned);
if (numberOfGroundActionsAfterParsing > -1)
printf("groundActions:\n afterParsing: %i\n",numberOfGroundActionsAfterParsing);
if (numberOfGroundActionsAfterSimplification > -1)
printf(" afterPreprocessing: %i\n",numberOfGroundActionsAfterSimplification);
if (numberOfStateVariablesAfterParsing > -1)
printf("stateVariables:\n afterParsing: %i\n",numberOfStateVariablesAfterParsing);
if (numberOfStateVariablesAfterSimplification > -1)
printf(" afterPreprocessing: %i\n",numberOfStateVariablesAfterSimplification);
if (maxSizeOfStronglyConnectedComponents > -1)
printf("stronglyConnectedComponents:\n maxSize: %i\n",maxSizeOfStronglyConnectedComponents);
int solutionIndex = -1;
for (int i = 0; seqs[i].sati; i++)
{
if (seqs[i].sati->value != 1)
continue;
solutionIndex = i;
break;
}
printf("plan:\n found: ");
if (solutionIndex < 0)
printf("false\n");
else
{
printf("true\n");
const auto planLength = seqs[solutionIndex].sati->nOfTPoints - 1;
int numberOfActions = 0;
const satinstance sati = seqs[solutionIndex].sati;
for (int t = 0; t < sati->nOfTPoints - 1; t++)
for (int i = 0; i < sati->nOfActions; i++)
if (vartruep(sati,TACT(i,t)))
numberOfActions++;
printf(" length: %i\n actions: %i\n", planLength, numberOfActions);
}
if(flagOutputDIMACS == 0) {
if (seqs[0].sati)
printf("iterations:\n");
int i = 0;
while(i*outputTimeStep+firstTimePoint < lastTimePoint && seqs[i].sati) {
printf(" - horizon: %i\n",seqs[i].sati->nOfTPoints-1);
printf(" result: ");
if (seqs[i].sati->value == 0)
printf("unsatisfiable");
else if (seqs[i].sati->value == 1)
printf("satisfiable");
else
printf("unknown");
printf("\n");
printf(" conflicts: %i\n",seqs[i].sati->conflicts);
printf(" decisions: %i\n",seqs[i].sati->decisions);
printf(" variables: %i\n",seqs[i].sati->nOfVars);
i += 1;
}// && seqs[i-1].sati->value != 1);
// } while(i*outputTimeStep+firstTimePoint < lastTimePoint);
}
printf("...\n");
}
void handleSignal()
{
printStatistics();
exit(0);
}
int main(int argc,char **argv) { int main(int argc,char **argv) {
signal(SIGINT, handleSignal);
signal(SIGTERM, handleSignal);
int i,j; int i,j;
syntacticclass sclass; syntacticclass sclass;
@ -652,6 +737,9 @@ int main(int argc,char **argv) {
NEWgroundoperators(); NEWgroundoperators();
numberOfGroundActionsAfterParsing = nOfActions;
numberOfStateVariablesAfterParsing = nOfAtoms;
printf("Parser: %i ground actions and %i state variables\n",nOfActions,nOfAtoms); printf("Parser: %i ground actions and %i state variables\n",nOfActions,nOfAtoms);
if(flagShowInput) { if(flagShowInput) {
@ -688,6 +776,9 @@ int main(int argc,char **argv) {
if(flagEliminateConverses) mergecontras(); if(flagEliminateConverses) mergecontras();
numberOfGroundActionsAfterSimplification = nOfActions;
numberOfStateVariablesAfterSimplification = nOfAtoms;
printf("Simplified: %i ground actions and %i state variables\n",nOfActions,nOfAtoms); printf("Simplified: %i ground actions and %i state variables\n",nOfActions,nOfAtoms);
sortactions(); sortactions();
@ -720,6 +811,7 @@ int main(int argc,char **argv) {
int maxsize; int maxsize;
TIMEdisabling = time10ms(); TIMEdisabling = time10ms();
maxsize = scc(nOfActions); maxsize = scc(nOfActions);
maxSizeOfStronglyConnectedComponents = maxsize;
printf(" %.2f secs (max SCC size %i)\n",time2real(time10ms() - TIMEdisabling),maxsize); printf(" %.2f secs (max SCC size %i)\n",time2real(time10ms() - TIMEdisabling),maxsize);
} }
@ -727,23 +819,7 @@ int main(int argc,char **argv) {
encoding(); encoding();
printf("total time %.2f preprocess %.2f \n", printStatistics();
time2real(time10ms() - TIMEstart),
time2real(TIMEpreprocess - TIMEstart));
givememorystatistics();
printf("max. learned clause length %i\n",stats_longest_learned);
if(flagOutputDIMACS == 0) {
printf("t val conflicts decisions\n");
i = 0;
do {
printf("%i %i %i %i\n",seqs[i].sati->nOfTPoints-1,seqs[i].sati->value,seqs[i].sati->conflicts,seqs[i].sati->decisions);
i += 1;
} while(i*outputTimeStep+firstTimePoint <= lastTimePoint && seqs[i].sati && seqs[i-1].sati->value != 1);
// } while(i*outputTimeStep+firstTimePoint < lastTimePoint);
}
} }