-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'decision-trees' into 0.4.0
- Loading branch information
Showing
33 changed files
with
1,591 additions
and
424 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
name: build | ||
on: [push] | ||
|
||
## At the moment, everything is running on nightly. Once Rocket 0.5 is out, stable/beta can be enabled. | ||
|
||
jobs: | ||
# Check formatting | ||
fmt: | ||
name: Rustfmt | ||
runs-on: ubuntu-latest | ||
env: | ||
RUSTFLAGS: "-D warnings" | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions-rs/toolchain@v1 | ||
with: | ||
profile: minimal | ||
toolchain: nightly | ||
override: true | ||
- run: rustup component add rustfmt | ||
- uses: actions-rs/cargo@v1 | ||
with: | ||
command: fmt | ||
args: --all -- --check | ||
|
||
|
||
# Run basic code validity check. | ||
check: | ||
needs: fmt | ||
name: Check | ||
runs-on: ubuntu-latest | ||
env: | ||
RUSTFLAGS: "-D warnings" | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions-rs/toolchain@v1 | ||
with: | ||
profile: minimal | ||
toolchain: nightly | ||
override: true | ||
- uses: actions-rs/cargo@v1 | ||
with: | ||
command: check | ||
|
||
# Run all tests | ||
#test: | ||
# needs: check | ||
# name: Test Suite | ||
# runs-on: ubuntu-latest | ||
# env: | ||
# RUSTFLAGS: "-D warnings" | ||
# steps: | ||
# - uses: actions/checkout@v2 | ||
# - uses: actions-rs/toolchain@v1 | ||
# with: | ||
# profile: minimal | ||
# toolchain: stable | ||
# override: true | ||
# - uses: actions-rs/cargo@v1 | ||
# with: | ||
# command: test | ||
# args: --features "shields_up" | ||
|
||
# Run all tests, but with beta | ||
#test-beta: | ||
# needs: check | ||
# name: Test Suite (Beta) | ||
# runs-on: ubuntu-latest | ||
# env: | ||
# RUSTFLAGS: "-D warnings" | ||
# steps: | ||
# - uses: actions/checkout@v2 | ||
# - uses: actions-rs/toolchain@v1 | ||
# with: | ||
# profile: minimal | ||
# toolchain: beta | ||
# override: true | ||
# - uses: actions-rs/cargo@v1 | ||
# with: | ||
# command: test | ||
# args: --features "shields_up" | ||
|
||
# Run all tests, but with nightly | ||
test-nightly: | ||
needs: check | ||
name: Test Suite (Nightly) | ||
runs-on: ubuntu-latest | ||
env: | ||
RUSTFLAGS: "-D warnings" | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions-rs/toolchain@v1 | ||
with: | ||
profile: minimal | ||
toolchain: nightly | ||
override: true | ||
- uses: actions-rs/cargo@v1 | ||
with: | ||
command: test | ||
args: --features "shields_up" | ||
|
||
# Check code style | ||
clippy: | ||
needs: check | ||
name: Clippy | ||
runs-on: ubuntu-latest | ||
env: | ||
RUSTFLAGS: "-D warnings" | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions-rs/toolchain@v1 | ||
with: | ||
profile: minimal | ||
toolchain: nightly | ||
override: true | ||
- run: rustup component add clippy | ||
- uses: actions-rs/cargo@v1 | ||
with: | ||
command: clippy |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
use crate::scc::ProgressTracker; | ||
use crate::GraphTaskContext; | ||
use biodivine_lib_param_bn::symbolic_async_graph::{GraphColoredVertices, SymbolicAsyncGraph}; | ||
use std::sync::atomic::{AtomicBool, Ordering}; | ||
|
||
impl Default for GraphTaskContext { | ||
fn default() -> Self { | ||
GraphTaskContext::new() | ||
} | ||
} | ||
|
||
impl GraphTaskContext { | ||
/// Create a new task context. | ||
pub fn new() -> GraphTaskContext { | ||
GraphTaskContext { | ||
is_cancelled: AtomicBool::new(false), | ||
progress: ProgressTracker::new(), | ||
} | ||
} | ||
|
||
/// Re-initialize the task context with a fresh graph. | ||
pub fn restart(&self, graph: &SymbolicAsyncGraph) { | ||
self.progress.init_from_graph(graph); | ||
self.is_cancelled.store(false, Ordering::SeqCst); | ||
} | ||
|
||
/// True if the task is cancelled. | ||
pub fn is_cancelled(&self) -> bool { | ||
self.is_cancelled.load(Ordering::SeqCst) | ||
} | ||
|
||
/// Set the status of this task to cancelled. | ||
/// | ||
/// Return true if the computation was set to cancelled by this call, false if it was | ||
/// cancelled previously. | ||
pub fn cancel(&self) -> bool { | ||
!self.is_cancelled.swap(true, Ordering::SeqCst) | ||
} | ||
|
||
/// Indicate that the given set still needs to be processed by the task. | ||
pub fn update_remaining(&self, remaining: &GraphColoredVertices) { | ||
self.progress.update_remaining(remaining); | ||
} | ||
|
||
/// Output a string which represent the percentage of remaining state space. | ||
pub fn get_percent_string(&self) -> String { | ||
self.progress.get_percent_string() | ||
} | ||
} |
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
Oops, something went wrong.