|
|
@ -215,9 +215,7 @@ jlong _strat // strategy storage |
|
|
// open file to store adversary (if required)
|
|
|
// open file to store adversary (if required)
|
|
|
if (export_adv_enabled != EXPORT_ADV_NONE) { |
|
|
if (export_adv_enabled != EXPORT_ADV_NONE) { |
|
|
fp_adv = fopen(export_adv_filename, "w"); |
|
|
fp_adv = fopen(export_adv_filename, "w"); |
|
|
if (fp_adv) { |
|
|
|
|
|
fprintf(fp_adv, "%d ?\n", n); |
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
|
if (!fp_adv) { |
|
|
PS_PrintWarningToMainLog(env, "Adversary generation cancelled (could not open file \"%s\").", export_adv_filename); |
|
|
PS_PrintWarningToMainLog(env, "Adversary generation cancelled (could not open file \"%s\").", export_adv_filename); |
|
|
export_adv_enabled = EXPORT_ADV_NONE; |
|
|
export_adv_enabled = EXPORT_ADV_NONE; |
|
|
} |
|
|
} |
|
|
@ -304,6 +302,13 @@ jlong _strat // strategy storage |
|
|
|
|
|
|
|
|
// Traverse matrix to extract adversary
|
|
|
// Traverse matrix to extract adversary
|
|
|
if (export_adv_enabled != EXPORT_ADV_NONE) { |
|
|
if (export_adv_enabled != EXPORT_ADV_NONE) { |
|
|
|
|
|
// Do two passes: first to compute the number of transitions,
|
|
|
|
|
|
// the second to actually do the export
|
|
|
|
|
|
int num_trans = 0; |
|
|
|
|
|
for (int pass = 1; pass <= 2; pass++) { |
|
|
|
|
|
if (pass == 2) { |
|
|
|
|
|
fprintf(fp_adv, "%d %d\n", n, num_trans); |
|
|
|
|
|
} |
|
|
h1 = h2 = 0; |
|
|
h1 = h2 = 0; |
|
|
for (i = 0; i < n; i++) { |
|
|
for (i = 0; i < n; i++) { |
|
|
if (!use_counts) { l1 = row_starts[i]; h1 = row_starts[i+1]; } |
|
|
if (!use_counts) { l1 = row_starts[i]; h1 = row_starts[i+1]; } |
|
|
@ -314,6 +319,11 @@ jlong _strat // strategy storage |
|
|
else { l2 = h2; h2 += choice_counts[j]; } |
|
|
else { l2 = h2; h2 += choice_counts[j]; } |
|
|
// But only output a choice if it is in the adversary
|
|
|
// But only output a choice if it is in the adversary
|
|
|
if (j == adv[i]) { |
|
|
if (j == adv[i]) { |
|
|
|
|
|
switch (pass) { |
|
|
|
|
|
case 1: |
|
|
|
|
|
num_trans += (h2-l2); |
|
|
|
|
|
break; |
|
|
|
|
|
case 2: |
|
|
for (k = l2; k < h2; k++) { |
|
|
for (k = l2; k < h2; k++) { |
|
|
switch (export_adv_enabled) { |
|
|
switch (export_adv_enabled) { |
|
|
case EXPORT_ADV_DTMC: |
|
|
case EXPORT_ADV_DTMC: |
|
|
@ -328,6 +338,8 @@ jlong _strat // strategy storage |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
// stop clocks
|
|
|
// stop clocks
|
|
|
stop = util_cpu_time(); |
|
|
stop = util_cpu_time(); |
|
|
|