-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* initial commit to include solver * renaming and cleanup (I) * cleanup (II) * cleanup(III) * deleted graphgeneratortest * initial refactoring * cleanup and doc * cleanup * add test case for loops Co-authored-by: Markus Frohme <[email protected]>
- Loading branch information
1 parent
e1e198b
commit 905df31
Showing
17 changed files
with
1,229 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
72 changes: 72 additions & 0 deletions
72
modelchecking/m3c/src/main/java/net/automatalib/modelcheckers/m3c/solver/WitnessTree.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
/* Copyright (C) 2013-2022 TU Dortmund | ||
* This file is part of AutomataLib, http://www.automatalib.net/. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package net.automatalib.modelcheckers.m3c.solver; | ||
|
||
import java.util.ArrayList; | ||
import java.util.Collections; | ||
import java.util.List; | ||
|
||
import net.automatalib.graphs.Graph; | ||
import net.automatalib.graphs.base.compact.CompactGraph; | ||
import net.automatalib.words.Word; | ||
import org.checkerframework.checker.nullness.qual.MonotonicNonNull; | ||
|
||
/** | ||
* A tree-like {@link Graph} that represents the BFS-style exploration of the tableau generated by the | ||
* {@link WitnessTreeExtractor}. Edges may represent the extraction of inner subformulae, procedural calls/returns | ||
* to/from other procedures, or actual steps in the transition system (modal nodes). | ||
* | ||
* @param <L> | ||
* label type | ||
* @param <AP> | ||
* atomic proposition type | ||
* | ||
* @author freese | ||
* @author frohme | ||
*/ | ||
@SuppressWarnings("type.argument.type.incompatible") // we only add non-null properties | ||
public class WitnessTree<L, AP> extends CompactGraph<WitnessTreeState<?, L, ?, AP>, String> { | ||
|
||
private @MonotonicNonNull Word<L> result; | ||
|
||
public Word<L> getWitness() { | ||
assert result != null; | ||
return result; | ||
} | ||
|
||
void computePath(int finishingNode) { | ||
int currentNode = finishingNode; | ||
|
||
final List<L> tmpPath = new ArrayList<>(); | ||
|
||
while (currentNode >= 0) { | ||
final WitnessTreeState<?, L, ?, AP> prop = super.getNodeProperty(currentNode); | ||
assert prop != null; | ||
|
||
final L label = prop.edgeLabel; | ||
prop.isPartOfResult = true; | ||
|
||
if (label != null) { | ||
tmpPath.add(label); | ||
} | ||
|
||
currentNode = prop.parentId; | ||
} | ||
|
||
Collections.reverse(tmpPath); | ||
this.result = Word.fromList(tmpPath); | ||
} | ||
} |
Oops, something went wrong.