LLMMCTS Examples
This directory contains example scripts demonstrating how to use LLMMCTS for various problem types.
Examples
- simple_example.jl - Basic MCTS usage with a simple state transition function
- pathfinding.jl - Grid-based pathfinding problem
- math_problem.jl - Solving math problems using MCTS-guided reasoning
- tool_use.jl - Coordinating with external tools (APIs, databases)
- chess_game.jl - Game playing scenario (simplified chess-like)
- code_generation.jl - Guiding LLM code generation
- reasoning.jl - Multi-step reasoning with chain-of-thought
- configuration_examples.jl - Demonstrating different MCTS configuration options
Running Examples
julia examples/simple_example.jl
julia examples/pathfinding.jl
julia examples/configuration_examples.jl
Key Concepts
State
The state is represented as a Dict{String, Any} that contains all information needed for the problem.
Transition Function
The transition function takes the current state and returns:
Dict(
:newNodeKey => unique_id,
:newstate => new_state_dict,
:progressvalue => llm_estimate
)
Progress Value
progressvalue is provided by LLM reasoning and guides the search without waiting for terminal rewards.
State Value
statevalue is computed through Monte Carlo simulations and provides accurate long-term estimates.
Configuration Parameters
maxiterations- Number of MCTS iterations (default: 10)explorationweight- UCT exploration weight (default: 1.0)maxSimulationDepth- Maximum simulation rollout depth (default: 3)horizontalSampleExpansionPhase- Children per expansion (default: 3)multithread- Enable parallel simulation (default: false)saveSimulatedNode- Keep simulation nodes (default: false)
See Also
- README.md - Complete package documentation
- workprocess.md - Detailed technical documentation