From 8f6e646d6d209213b07b0911be9f0432a53e9fff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eva=20=C5=A0mij=C3=A1kov=C3=A1?= Date: Thu, 28 Nov 2024 10:43:13 +0100 Subject: [PATCH] Initial states for phenotype control (#36) * Initial states for phenotype control * fmt * Remove `clap`. --------- Co-authored-by: Samuel Pastva --- Cargo.toml | 4 ++-- pyproject.toml | 2 +- src/bindings/pbn_control/control.rs | 15 ++++++++++++++- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 6f494af..93a499a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "biodivine-aeon-py" -version = "1.2.0" +version = "1.2.1" edition = "2021" [lib] @@ -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" } diff --git a/pyproject.toml b/pyproject.toml index 8830ccf..dd59bc2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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", diff --git a/src/bindings/pbn_control/control.rs b/src/bindings/pbn_control/control.rs index 94f2c67..03d8348 100644 --- a/src/bindings/pbn_control/control.rs +++ b/src/bindings/pbn_control/control.rs @@ -139,7 +139,7 @@ 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, @@ -147,6 +147,7 @@ impl Control { oscillation_type: Option, size_limit: Option, stop_when_found: bool, + initial_states: Option<&VertexSet>, ) -> PyResult { let verbose = should_log(global_log_level(py)?); @@ -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()); @@ -164,6 +176,7 @@ impl Control { phenotype.as_native().clone(), size_limit, p_type, + initial_states_native, stop_when_found, verbose, );