Commit 78112581 authored by VIGNET Pierre's avatar VIGNET Pierre
Browse files

Correct partial definitions & cleaner code

parent d1c63b32
......@@ -6,6 +6,7 @@ from __future__ import print_function
import argparse
import re
import os
from functools import partial
# Custom imports
from cadbiom.models.clause_constraints.mcl.MCLAnalyser import MCLAnalyser
......@@ -51,6 +52,9 @@ def make_logical_formula(previous_frontier_places, start_prop):
forbid all combinaisons: not((A and B) or (B and C))
"""
logical_and = partial(logical_operator, operator='and')
logical_or = partial(logical_operator, operator='or')
def add_start_prop(prev_frontier_places_formula):
"""Deal with start_prop if given"""
......@@ -61,12 +65,12 @@ def make_logical_formula(previous_frontier_places, start_prop):
else:
return start_prop
cam_list = [logical_operator(frontier_places, 'and')
cam_list = [logical_and(frontier_places)
for frontier_places in previous_frontier_places]
if len(cam_list) != 0:
# Logical or between each line
return add_start_prop('not(' + logical_operator(cam_list, 'or') + ')')
return add_start_prop('not(' + logical_or(cam_list) + ')')
else:
return add_start_prop('')
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment