remove cnf_expr for dimacs oracle constructor
@@ -55,28 +55,21 @@ class DimacsOracle(Oracle):
}
}
- def __init__(self, dimacs_cnf=None, cnf_expr=None, mct_mode='basic'):
+ def __init__(self, dimacs_str=None, mct_mode='basic'):
"""
Constructor.
Args:
- dimacs_cnf (str): The string representation in DIMACS format, will be ignored if cnf_expr is specified
- cnf_expr (list of lists of ints): List of lists of non-zero integers to represent the CNF
+ dimacs_str (str): The string representation in DIMACS format
mct_mode (str): The mode to use for building Multiple-Control Toffoli
"""
self.validate(locals())
self._mct_mode = mct_mode
- if cnf_expr:
- if dimacs_cnf:
- logger.warning('The dimacs_cnf is ignored at the presence of cnf_expr.')
- else:
- pass
- else:
- if dimacs_cnf:
+ if dimacs_str:
ls = [
- l.strip() for l in dimacs_cnf.split('\n')
+ l.strip() for l in dimacs_str.split('\n')
if len(l) > 0 and not l.strip()[0] == 'c'
]
headers = [l for l in ls if l[0] == 'p']
@@ -102,8 +95,7 @@ class DimacsOracle(Oracle):
)
]
else:
- raise ValueError(
- 'The CNF needs to be specified as either a list of lists or a string in DIMACS format.')
+ raise ValueError('Missing input DIMACS string.')
self._cnf = CNF(cnf_expr)
super().__init__()
