|
9 | 9 | class AbstractWalkModelDiGraph(ABC): |
10 | 10 | # storing some defaults |
11 | 11 | optimize_with_safe_sequences = True |
| 12 | + optimize_with_safe_sequences_allow_geq_constraints = True |
12 | 13 | # TODO: optimize_with_subset_constraints_as_safe_sequences = True |
13 | 14 | optimize_with_safety_as_subset_constraints = False |
14 | 15 | optimize_with_max_safe_antichain_as_subset_constraints = False |
15 | 16 | allow_empty_walks = False |
| 17 | + allow_empty_walks = False |
16 | 18 |
|
17 | 19 | def __init__( |
18 | 20 | self, |
@@ -123,6 +125,7 @@ def __init__( |
123 | 125 | self.allow_empty_walks = optimization_options.get("allow_empty_walks", AbstractWalkModelDiGraph.allow_empty_walks) |
124 | 126 | self.optimize_with_safety_as_subset_constraints = optimization_options.get("optimize_with_safety_as_subset_constraints", AbstractWalkModelDiGraph.optimize_with_safety_as_subset_constraints) |
125 | 127 | self.optimize_with_max_safe_antichain_as_subset_constraints = optimization_options.get("optimize_with_max_safe_antichain_as_subset_constraints", AbstractWalkModelDiGraph.optimize_with_max_safe_antichain_as_subset_constraints) |
| 128 | + self.optimize_with_safe_sequences_allow_geq_constraints = optimization_options.get("optimize_with_safe_sequences_allow_geq_constraints", AbstractWalkModelDiGraph.optimize_with_safe_sequences_allow_geq_constraints) |
126 | 129 |
|
127 | 130 | self._is_solved = False |
128 | 131 |
|
@@ -362,7 +365,7 @@ def _apply_safety_optimizations(self): |
362 | 365 | # print("Fixing variables for safe list #", i) |
363 | 366 | # iterate over the edges in the safe list to fix variables to 1 |
364 | 367 | for u, v in self.walks_to_fix[i]: |
365 | | - if self.G._is_scc_edge(u, v): |
| 368 | + if self.G._is_scc_edge(u, v) and self.optimize_with_safe_sequences_allow_geq_constraints: |
366 | 369 | self.solver.add_constraint( |
367 | 370 | self.edge_vars[(u, v, i)] >= 1, |
368 | 371 | name=f"safe_list_u={u}_v={v}_i={i}", |
|
0 commit comments