Infrared
Loading...
Searching...
No Matches
infrared.infrared.EngineBase Class Reference

Abstract base class for samplers and optimizers. More...

Inheritance diagram for infrared.infrared.EngineBase:
Collaboration diagram for infrared.infrared.EngineBase:

Public Member Functions

 __init__ (self, model, td_factory=TreeDecompositionFactory(), lazy=True)
 Construct with model and optional td_factory.
 
 requires_reinitialization (self)
 
 setup_engine (self, *skip_ct=False)
 Sets up the constraint model / cluster tree sampling engine.
 
 evaluate (self)
 Evaluates the cluster tree.
 
 is_consistent (self)
 
 plot_td (self, filename, to="pdf")
 Plot the tree decomposition to pdf file filename write to filename to target format, support conversion to "pdf" or "png".
 
 treewidth (self)
 Get tree width.
 
 gen_cluster_tree (self)
 Generate the populated cluster tree td tree decomposition Returns cluster tree.
 

Protected Attributes

 _model
 
 _td_factory
 
 _td
 
 _ct
 

Properties

 model = property
 
 td = property
 
 ct = property
 

Detailed Description

Abstract base class for samplers and optimizers.

Constructor & Destructor Documentation

◆ __init__()

infrared.infrared.EngineBase.__init__ (   self,
  model,
  td_factory = TreeDecompositionFactory(),
  lazy = True 
)

Construct with model and optional td_factory.

Parameters
model[const] Constraint network model
td_factoryFactory for tree decomposition
lazydelay construction of the data structures until required
Note
the model is deepcopied such that it won't be modified and/or later modifications of the model don't have effect on the sampler

Reimplemented in infrared.infrared.ArcticOptimizer, infrared.infrared.BoltzmannSampler, and infrared.infrared.MultiDimensionalBoltzmannSampler.

Member Function Documentation

◆ evaluate()

infrared.infrared.EngineBase.evaluate (   self)

Evaluates the cluster tree.

Returns
partition function
Note
Evaluation is a potentially (depending on the treewidth) costly operation. The method does not re-evaluate the tree if this was already done

◆ gen_cluster_tree()

infrared.infrared.EngineBase.gen_cluster_tree (   self)

Generate the populated cluster tree td tree decomposition Returns cluster tree.

Reimplemented in infrared.infrared.ArcticOptimizer, and infrared.infrared.BoltzmannSampler.

◆ is_consistent()

infrared.infrared.EngineBase.is_consistent (   self)

◆ plot_td()

infrared.infrared.EngineBase.plot_td (   self,
  filename,
  to = "pdf" 
)

Plot the tree decomposition to pdf file filename write to filename to target format, support conversion to "pdf" or "png".

Anything else writes graphviz dot format

◆ requires_reinitialization()

infrared.infrared.EngineBase.requires_reinitialization (   self)

◆ setup_engine()

infrared.infrared.EngineBase.setup_engine (   self,
skip_ct = False 
)

Sets up the constraint model / cluster tree sampling engine.

Note
do nothing, if the engine was already initialized before
Parameters
skip_ctskip the potentially expensive construction and evaluation of the cluster tree

◆ treewidth()

infrared.infrared.EngineBase.treewidth (   self)

Get tree width.

Returns
tree width

Member Data Documentation

◆ _ct

infrared.infrared.EngineBase._ct
protected

◆ _model

infrared.infrared.EngineBase._model
protected

◆ _td

infrared.infrared.EngineBase._td
protected

◆ _td_factory

infrared.infrared.EngineBase._td_factory
protected

Property Documentation

◆ ct

infrared.infrared.EngineBase.ct = property
static

◆ model

infrared.infrared.EngineBase.model = property
static

◆ td

infrared.infrared.EngineBase.td = property
static

The documentation for this class was generated from the following file: