small fixes

This commit is contained in:
Malte Tammena 2024-04-25 13:45:09 +02:00
parent b94555e703
commit 76dcb32dc5
3 changed files with 6 additions and 5 deletions

View file

@ -19,8 +19,7 @@ OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
OTHER DEALINGS IN THE SOFTWARE.
"""
import sys, random
import argparse
import random
def create_framework(n_sentences, n_assumptions, n_rules_per_head, size_of_bodies):
"""
@ -58,6 +57,7 @@ def print_ICCMA_format(assumptions, contraries, rules, n_sentences, out_filename
Print the given framework in the ICCMA 2023 format.
"""
offset = len(assumptions)
with open(out_filename, 'w') as out:
out.write(f"p aba {n_sentences}\n")
for i, asm in enumerate(assumptions):

View file

@ -71,7 +71,6 @@ framework = create_framework(n_sentences, n_a, n_rph, n_spb, cycle_prob)
print_ASP(framework[0], framework[2], framework[3], "generated_benchmark.asp", "s0")
'''
parser = argparse.ArgumentParser()
parser.add_argument('-d', '--directory')
parser.add_argument('-i', '--identifier')

View file

@ -58,15 +58,17 @@ fn count_loops(aba: &Aba, max_loops: Option<usize>) -> usize {
graph.update_edge(*from, *to, ());
});
let mut loops = 0;
const LOOP_SIZE_IN_MULT_UNIVERSE_SIZE: f32 = 1.0;
let max_loops = if let Some(max) = max_loops {
max
} else {
(universe.len() as f32 * LOOP_SIZE_IN_MULT_UNIVERSE_SIZE) as usize
usize::MAX
};
let mut output_printed = false;
graph.visit_cycles(|_graph, _cycle| {
loops += 1;
if loops % 100_000 == 0 {
eprintln!("{loops}");
}
if loops >= max_loops {
if !output_printed {
eprintln!(