corneto.methods.future.CarnivalILP#

class corneto.methods.future.CarnivalILP(beta_weight=0.2, max_dist=None, penalize='edges', use_perturbation_weights=False, interaction_graph_attribute='interaction', disable_acyclicity=False, data_type_key='role', data_input_key='input', data_output_key='output', backend=None)#

Bases: Method

Improved version of the original CARNIVAL ILP method implementation.

Implements CARNIVAL as a standard optimization problem without flows. Uses binary variables and ILP constraints to model signal propagation.

Parameters:
  • beta_weight (float) – Regularization term weight. Default: 0.2

  • max_dist (int | None) – Max distance between vertices. If None, uses vertex count. Default: None

  • penalize (str) – What to regularize - ‘nodes’/’edges’/’both’. Default: ‘edges’

  • use_perturbation_weights (bool) – Include perturbation weights. Default: False

  • interaction_graph_attribute (str) – Edge attribute for interactions. Default: ‘interaction’

  • disable_acyclicity (bool) – Skip acyclicity constraints. Default: False

  • backend (Backend | None) – Optimization backend. Default: None

  • data_type_key (str)

  • data_input_key (str)

  • data_output_key (str)

__init__(beta_weight=0.2, max_dist=None, penalize='edges', use_perturbation_weights=False, interaction_graph_attribute='interaction', disable_acyclicity=False, data_type_key='role', data_input_key='input', data_output_key='output', backend=None)#
Parameters:
  • beta_weight (float)

  • max_dist (int | None)

  • penalize (str)

  • use_perturbation_weights (bool)

  • interaction_graph_attribute (str)

  • disable_acyclicity (bool)

  • data_type_key (str)

  • data_input_key (str)

  • data_output_key (str)

  • backend (Backend | None)

Methods

__init__([beta_weight, max_dist, penalize, ...])

build(graph, data)

Build the complete optimization problem.

create_problem(graph, data)

Create the ILP optimization problem.

get_citations()

Returns citation keys for this method.

preprocess(graph, data)

Preprocess the input graph and dataset before optimization.

show_bibtex()

Display raw BibTeX entries in a formatted block for easy copying.

show_citations()

Display formatted citations in a Jupyter notebook.

Attributes

backend

Return the optimization backend being used.

preprocess(graph, data)#

Preprocess the input graph and dataset before optimization.

This method performs: 1. Graph pruning based on input conditions to remove irrelevant vertices 2. Data standardization for optimization

Parameters:
  • graph (BaseGraph) – The input network graph

  • data (Data) – Experimental dataset with inputs/outputs

Returns:

A tuple containing preprocessed graph and dataset

Return type:

Tuple[BaseGraph, Data]

create_problem(graph, data)#

Create the ILP optimization problem.

This method implements the core CARNIVAL optimization problem by: 1. Creating binary variables for vertex and edge states 2. Setting up consistency constraints 3. Adding acyclicity constraints if enabled 4. Incorporating measurements into the objective

Parameters:
  • graph (BaseGraph) – The preprocessed network graph

  • data (Data) – The preprocessed dataset

Returns:

The configured optimization problem

static get_citations()#

Returns citation keys for this method.

Returns:

A list of citation keys that can be used to lookup BibTeX entries.