Skip to content

Commit

Permalink
Initial states for phenotype control (#36)
Browse files Browse the repository at this point in the history
* Initial states for phenotype control

* fmt

* Remove `clap`.

---------

Co-authored-by: Samuel Pastva <[email protected]>
  • Loading branch information
smijeva and daemontus authored Nov 28, 2024
1 parent d52e970 commit 8f6e646
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "biodivine-aeon-py"
version = "1.2.0"
version = "1.2.1"
edition = "2021"

[lib]
Expand All @@ -21,7 +21,7 @@ pyo3 = { version = "0.22.5", features = ["abi3-py37", "extension-module", "num-b
biodivine-lib-param-bn = { version="0.5.13", features=["solver-z3"] }
biodivine-lib-bdd = "0.5.22"
#biodivine-pbn-control = "0.3.1"
biodivine-pbn-control = { git = "https://github.com/sybila/biodivine-pbn-control", rev = "99f9da756c370daf5428b3d61ef76c24e7d8de5f" }
biodivine-pbn-control = { git = "https://github.com/sybila/biodivine-pbn-control", rev = "1fcef228bd6accd89cb3a287d82c80c9c8f9b6a4" }
biodivine-hctl-model-checker = "0.3.0"
rand = "0.8.5"
macros = { path = "macros" }
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ build-backend = "maturin"
[project]
name = "biodivine_aeon"
description = "Python bindings for the tool AEON."
version = "1.2.0"
version = "1.2.1"
requires-python = ">=3.9"
classifiers = [
"Programming Language :: Rust",
Expand Down
15 changes: 14 additions & 1 deletion src/bindings/pbn_control/control.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,14 +139,15 @@ impl Control {
/// so far are still returned.
///
#[staticmethod]
#[pyo3(signature = (graph, phenotype, oscillation_type = None, size_limit = None, stop_when_found = false))]
#[pyo3(signature = (graph, phenotype, oscillation_type = None, size_limit = None, stop_when_found = false, initial_states = None))]
pub fn phenotype_permanent(
py: Python,
graph: Py<AsynchronousPerturbationGraph>,
phenotype: &VertexSet,
oscillation_type: Option<String>,
size_limit: Option<usize>,
stop_when_found: bool,
initial_states: Option<&VertexSet>,
) -> PyResult<ColoredPerturbationSet> {
let verbose = should_log(global_log_level(py)?);

Expand All @@ -156,6 +157,17 @@ impl Control {
PhenotypeOscillationType::Forbidden
};

// If initial states is not set, we consider all networks states as potential initial states
let initial_states_native = match initial_states {
Some(x) => x.as_native().clone(),
None => graph
.get()
.as_native()
.mk_unit_colored_vertices()
.vertices()
.clone(),
};

// If size limit is not set, we consider the largest possible size.
let size_limit =
size_limit.unwrap_or_else(|| graph.get().as_native().perturbable_variables().len());
Expand All @@ -164,6 +176,7 @@ impl Control {
phenotype.as_native().clone(),
size_limit,
p_type,
initial_states_native,
stop_when_found,
verbose,
);
Expand Down

0 comments on commit 8f6e646

Please sign in to comment.