OORL.MCGS (object v0.1.2)

Monte Carlo Graph Search implementation with Graph Attention and Contrastive Learning.

Implements AAOS Section 7.7 specifications for:

  • Graph attention mechanisms
  • Contrastive learning for feature representation
  • Multi-head attention for complex graph structures
  • Feature embedding optimization

Summary

Functions

Calculates feature similarity for contrastive learning validation.

Performs Monte Carlo Graph Search with attention and contrastive learning.

Validates contrastive learning feature representation quality.

Types

graph()

@type graph() :: %{
  nodes: list(),
  edges: list(),
  node_features: map(),
  edge_features: map()
}

search_options()

@type search_options() :: %{
  max_depth: integer(),
  iterations: integer(),
  graph_attention: boolean(),
  contrastive_learning: boolean(),
  attention_heads: integer(),
  feature_embedding_dim: integer(),
  contrastive_temperature: float()
}

Functions

calculate_feature_similarity(features1, features2, temperature \\ 0.1)

Calculates feature similarity for contrastive learning validation.

Parameters

  • features1: First feature vector
  • features2: Second feature vector
  • temperature: Contrastive learning temperature

Returns

Similarity score between 0 and 1

graph_search(start_node, graph, goal_nodes, options \\ %{})

Performs Monte Carlo Graph Search with attention and contrastive learning.

Parameters

  • start_node: Starting node ID
  • graph: Graph structure with nodes, edges, and features
  • goal_nodes: List of goal node IDs
  • options: Search configuration

Returns

{:ok, search_results} with path, attention weights, and learned features

Examples

iex> OORL.MCGS.graph_search(1, graph, [45, 50], %{iterations: 500})
{:ok, %{path: [1, 3, 7, 45], attention_weights: weights, features: embeddings}}

validate_contrastive_learning(positive_pairs, negative_pairs, temperature \\ 0.1)

Validates contrastive learning feature representation quality.

Parameters

  • positive_pairs: List of {feature1, feature2} tuples that should be similar
  • negative_pairs: List of {feature1, feature2} tuples that should be dissimilar
  • temperature: Contrastive temperature parameter

Returns

{:ok, validation_results} with similarity metrics