-
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.
Add initial implementation of
ControlComputation
.
- Loading branch information
Showing
6 changed files
with
574 additions
and
445 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,2 @@ | ||
# Ignore the actual `cargo/config.toml`. You should pick one of the pre-defined values for your current machine. | ||
config.toml |
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,5 @@ | ||
[env] | ||
Z3_SYS_Z3_HEADER="/opt/homebrew/include/z3.h" | ||
|
||
[build] | ||
rustflags=["-C", "link-args=-L/opt/homebrew/lib"] |
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,31 @@ | ||
use biodivine_pbn_control::control::PhenotypeControlMap; | ||
use biodivine_pbn_control::perturbation::PerturbationGraph; | ||
use std::sync::Arc; | ||
use std::thread::JoinHandle; | ||
use std::time::{SystemTime, UNIX_EPOCH}; | ||
|
||
pub struct ControlComputation { | ||
pub timestamp: SystemTime, | ||
pub finished_timestamp: Option<SystemTime>, | ||
pub input_model: String, | ||
pub graph: Arc<PerturbationGraph>, | ||
pub thread: Option<JoinHandle<()>>, | ||
pub results: Option<PhenotypeControlMap>, | ||
} | ||
|
||
impl ControlComputation { | ||
pub fn start_timestamp(&self) -> u128 { | ||
self.timestamp | ||
.duration_since(UNIX_EPOCH) | ||
.expect("Time error") | ||
.as_millis() | ||
} | ||
|
||
pub fn end_timestamp(&self) -> Option<u128> { | ||
self.finished_timestamp.map(|t| { | ||
t.duration_since(UNIX_EPOCH) | ||
.expect("Time error") | ||
.as_millis() | ||
}) | ||
} | ||
} |
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.