pyclustering.gcolor.hysteresis.hysteresisgcolor Class Reference

Class represents graph coloring algorithm based on hysteresis oscillatory network. More...

+ Inheritance diagram for pyclustering.gcolor.hysteresis.hysteresisgcolor:
+ Collaboration diagram for pyclustering.gcolor.hysteresis.hysteresisgcolor:

Public Member Functions

def __init__ (self, graph_matrix, alpha, eps)
 Constructor of hysteresis oscillatory network for graph coloring. More...
 
def process (self, steps, time, collect_dynamic=True)
 Peforms graph coloring analysis using simulation of the oscillatory network. More...
 
- Public Member Functions inherited from pyclustering.nnet.hysteresis.hysteresis_network
def outputs (self)
 Returns current outputs of neurons. More...
 
def outputs (self, values)
 Sets outputs of neurons.
 
def states (self)
 Return current states of neurons. More...
 
def states (self, values)
 Set current states of neurons.
 
def __init__ (self, num_osc, own_weight=-4, neigh_weight=-1, type_conn=conn_type.ALL_TO_ALL, type_conn_represent=conn_represent.MATRIX)
 Constructor of hysteresis oscillatory network. More...
 
def simulate (self, steps, time, solution=solve_type.RK4, collect_dynamic=True)
 Performs static simulation of hysteresis oscillatory network. More...
 
def simulate_static (self, steps, time, solution=solve_type.RK4, collect_dynamic=False)
 Performs static simulation of hysteresis oscillatory network. More...
 
- Public Member Functions inherited from pyclustering.nnet.network
def height (self)
 Height of the network grid (that is defined by amout of oscillators in each column), this value is zero in case of non-grid structure. More...
 
def width (self)
 Width of the network grid, this value is zero in case of non-grid structure. More...
 
def structure (self)
 Type of network structure that is used for connecting oscillators.
 
def __init__ (self, num_osc, type_conn=conn_type.ALL_TO_ALL, conn_repr=conn_represent.MATRIX, height=None, width=None)
 Constructor of the network. More...
 
def __len__ (self)
 Returns size of the network that is defined by amount of oscillators.
 
def has_connection (self, i, j)
 Returns True if there is connection between i and j oscillators and False - if connection doesn't exist. More...
 
def set_connection (self, i, j)
 Couples two specified oscillators in the network with dynamic connections. More...
 
def get_neighbors (self, index)
 Finds neighbors of the oscillator with specified index. More...
 

Detailed Description

Class represents graph coloring algorithm based on hysteresis oscillatory network.

This is bio-inspired algorithm where the network uses relaxation oscillators that is regarded as a multi-vibrator. Each ensemble of synchronous oscillators corresponds to only one color.

Example

# import required modules
from pyclustering.nnet.hysteresis import hysteresis_visualizer;
from pyclustering.gcolor.hysteresis import hysteresisgcolor;
from pyclustering.utils.graph import read_graph, draw_graph;
# load graph from a file
graph = read_graph(filename);
# create oscillatory network for solving graph coloring problem
network = hysteresisgcolor(graph.data, alpha, eps);
# perform simulation of the network
output_dynamic = network.simulate(2000, 20);
# show dynamic of the network
hysteresis_visualizer.show_output_dynamic(output_dynamic);
# obtain results of graph coloring and display results
coloring_map = hysteresis_visualizer.allocate_map_coloring();
draw_graph(graph, coloring_map);

Definition at line 94 of file hysteresis.py.

Constructor & Destructor Documentation

◆ __init__()

def pyclustering.gcolor.hysteresis.hysteresisgcolor.__init__ (   self,
  graph_matrix,
  alpha,
  eps 
)

Constructor of hysteresis oscillatory network for graph coloring.

Parameters
[in]graph_matrix(list): Matrix representation of a graph.
[in]alpha(double): Positive constant (affect weight between two oscillators w[i][j]).
[in]eps(double): Positive constant (affect feedback to itself (i = j) of each oscillator w[i][j] = -alpha - eps).

Definition at line 129 of file hysteresis.py.

Member Function Documentation

◆ process()

def pyclustering.gcolor.hysteresis.hysteresisgcolor.process (   self,
  steps,
  time,
  collect_dynamic = True 
)

Peforms graph coloring analysis using simulation of the oscillatory network.

Parameters
[in]steps(uint): Number steps of simulations during simulation.
[in]time(double): Time of simulation.
[in]collect_dynamic(bool): Specified requirement to collect whole dynamic of the network.
Returns
(hysteresis_analyser) Returns analyser of results of clustering.

Definition at line 161 of file hysteresis.py.


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