Documentation ¶
Overview ¶
Copyright 2018/2019, University of Freiburg, Chair of Artificial Intelligence. Authors:
- Robert Grönsfeld
- Tim Schulte <schultet@informatik.uni-freiburg.de>.
Index ¶
- Constants
- func DistanceToRoot(n Node) int
- func DotEdgeString(n1, n2 *DmtMakespanNode) string
- func DotGraph(root *DmtMakespanNode, file string)
- func DotNodeLabel(n *DmtMakespanNode, m int) string
- func DotNodeString(n *DmtMakespanNode, m int) string
- func DotPlan(goal *DmtMakespanNode, file string)
- func RegisterStrategy(info *StrategyInfo)
- func Satisfies(s state.State, cs task.ConditionSet) bool
- func Successor(s state.State, o *task.Action) state.State
- type AStarQueue
- func (q *AStarQueue) Get(i int) ValueNode
- func (q AStarQueue) Len() int
- func (q AStarQueue) Less(i, j int) bool
- func (q *AStarQueue) Pop() interface{}
- func (q *AStarQueue) Push(x interface{})
- func (q *AStarQueue) Put(x interface{})
- func (q AStarQueue) Swap(i, j int)
- func (q *AStarQueue) Take() interface{}
- type ActionEvaluator
- type ActionPruner
- type BackupQueue
- func (q *BackupQueue) Clear()
- func (q BackupQueue) Len() int
- func (q BackupQueue) Less(i, j int) bool
- func (q *BackupQueue) Pop() interface{}
- func (q *BackupQueue) Push(x interface{})
- func (q *BackupQueue) Put(x interface{})
- func (q BackupQueue) Swap(i, j int)
- func (q *BackupQueue) Take() interface{}
- type ClosedList
- type Dmt
- type DmtMakespan
- type DmtMakespanNode
- type DmtMessage
- type DmtNode
- type Engine
- type FactPair
- type Mafs
- type MafsMessage
- type MafsNode
- type Move
- type Node
- type NodeAccessor
- type NodeGetter
- type NodeQueue
- type PhonyPruner
- type Plan
- type PlanExtractionMessage
- type PlanExtractor
- type PlanRegistry
- type PriorityQueue
- func (q *PriorityQueue) Get(i int) ValueNode
- func (q PriorityQueue) Len() int
- func (q PriorityQueue) Less(i, j int) bool
- func (q *PriorityQueue) Pop() interface{}
- func (q *PriorityQueue) Push(x interface{})
- func (q *PriorityQueue) Put(x interface{})
- func (q PriorityQueue) Swap(i, j int)
- func (q *PriorityQueue) Take() interface{}
- type PriorityQueueFIFO
- func (q *PriorityQueueFIFO) Get(i int) ValueNode
- func (q PriorityQueueFIFO) Len() int
- func (q PriorityQueueFIFO) Less(i, j int) bool
- func (q *PriorityQueueFIFO) Pop() interface{}
- func (q *PriorityQueueFIFO) Push(n interface{})
- func (q *PriorityQueueFIFO) Put(x interface{})
- func (q PriorityQueueFIFO) Swap(i, j int)
- func (q *PriorityQueueFIFO) Take() interface{}
- type ProgressInfo
- type StateActionMessage
- type Status
- type Strategy
- func NewDmtBfs(e *Engine, opts *opt.OptionSet) Strategy
- func NewDmtGus(e *Engine, opts *opt.OptionSet) Strategy
- func NewDmtMakespanBfs(e *Engine, opts *opt.OptionSet) Strategy
- func NewDmtUCB1(e *Engine, opts *opt.OptionSet) Strategy
- func NewMafs(e *Engine, opts *opt.OptionSet) Strategy
- func NewStrategy(engine *Engine, args []string) Strategy
- func NewWeightedDmtMakespan(e *Engine, opts *opt.OptionSet) Strategy
- type StrategyInfo
- type StubbornSets
- type StubbornSetsSimple
- type TextMessage
- type ValueNode
- type XMessage
Constants ¶
const (
MinInt32 = -1 << 31
)
Variables ¶
This section is empty.
Functions ¶
func DistanceToRoot ¶
DistanceToRoot computes how many actions away a node is from the root
func DotEdgeString ¶
func DotEdgeString(n1, n2 *DmtMakespanNode) string
func DotGraph ¶
func DotGraph(root *DmtMakespanNode, file string)
func DotNodeLabel ¶
func DotNodeLabel(n *DmtMakespanNode, m int) string
func DotNodeString ¶
func DotNodeString(n *DmtMakespanNode, m int) string
func DotPlan ¶
func DotPlan(goal *DmtMakespanNode, file string)
func RegisterStrategy ¶
func RegisterStrategy(info *StrategyInfo)
RegisterStrategy a new StrategyInfo object to the strategyRegistry. This step is required to select the underlying strategy from the command line.
Types ¶
type AStarQueue ¶
type AStarQueue struct {
// contains filtered or unexported fields
}
Queue for A* search
func NewAStarQueue ¶
func NewAStarQueue() *AStarQueue
func (*AStarQueue) Get ¶
func (q *AStarQueue) Get(i int) ValueNode
Get returns node at index i (NodeGetter interface)
func (AStarQueue) Len ¶
func (q AStarQueue) Len() int
func (AStarQueue) Less ¶
func (q AStarQueue) Less(i, j int) bool
func (*AStarQueue) Pop ¶
func (q *AStarQueue) Pop() interface{}
Pop removes the first element from the queue
func (*AStarQueue) Push ¶
func (q *AStarQueue) Push(x interface{})
Push adds a new element to the queue
func (*AStarQueue) Put ¶
func (q *AStarQueue) Put(x interface{})
func (AStarQueue) Swap ¶
func (q AStarQueue) Swap(i, j int)
func (*AStarQueue) Take ¶
func (q *AStarQueue) Take() interface{}
type ActionEvaluator ¶
type ActionEvaluator interface { ApplicableActions(s state.State) task.ActionList ApplicableAgents(s state.State) []int }
An ActionEvaluator can compute applicable actions
func NewActionEvaluator ¶
NewActionEvaluator creates and returns an appTester
func NewPruningEvaluator ¶
func NewPruningEvaluator(am ActionEvaluator, ap ActionPruner) ActionEvaluator
type ActionPruner ¶
ActionPruner interface type to implement various pruning techniques (like stubborn sets) for pruning actions
type BackupQueue ¶
type BackupQueue struct {
// contains filtered or unexported fields
}
BackupQueue implements a PQ for node backups ordered by depth in the tree
func (*BackupQueue) Clear ¶
func (q *BackupQueue) Clear()
clear resets and re-initializes a DmtQueue
func (BackupQueue) Len ¶
func (q BackupQueue) Len() int
Len returns the number of elements in the queue
func (*BackupQueue) Pop ¶
func (q *BackupQueue) Pop() interface{}
Pop removes the first element from the queue
func (*BackupQueue) Push ¶
func (q *BackupQueue) Push(x interface{})
Push adds a new element to the queue
func (*BackupQueue) Put ¶
func (q *BackupQueue) Put(x interface{})
func (BackupQueue) Swap ¶
func (q BackupQueue) Swap(i, j int)
Swap swaps the position of the elements at the provided indices in the queue
func (*BackupQueue) Take ¶
func (q *BackupQueue) Take() interface{}
type ClosedList ¶
ClosedList is a hashmap containing all nodes expanded during search
func (ClosedList) Add ¶
func (cl ClosedList) Add(n *MafsNode)
type Dmt ¶
type Dmt struct { *Engine // contains filtered or unexported fields }
Dmt search, implements search.Strategy interface
func (*Dmt) HasNode ¶
HasNode returns the node stored with NodeID id in transmittedNodes and a truth value representing whether the id is in the table.
type DmtMakespan ¶
type DmtMakespan struct { *Engine // contains filtered or unexported fields }
DmtMakespan search, implements search.Strategy interface
func (*DmtMakespan) HasNode ¶
func (d *DmtMakespan) HasNode(sid state.StateID) (Node, bool)
HasNode returns the node stored with NodeID id in transmittedNodes and a truth value representing whether the id is in the table.
func (*DmtMakespan) Initialize ¶
func (d *DmtMakespan) Initialize()
Initialize initializes dmt search TODO: testing
func (*DmtMakespan) Step ¶
func (d *DmtMakespan) Step() Status
Step executes a single search step (is called repeatedly by search.Engine)
type DmtMakespanNode ¶
type DmtMakespanNode struct {
// contains filtered or unexported fields
}
DmtMakespanNode implements search.Node
func (*DmtMakespanNode) Action ¶
func (n *DmtMakespanNode) Action() *task.Action
Action returns the nodes creating action
func (*DmtMakespanNode) ID ¶
func (n *DmtMakespanNode) ID() state.StateID
ID returns the unique NodeID of the node
func (*DmtMakespanNode) Parent ¶
func (n *DmtMakespanNode) Parent() Node
Parent returns the nodes parent node
func (*DmtMakespanNode) String ¶
func (n *DmtMakespanNode) String() string
String returns a string representation of n
type DmtMessage ¶
DmtMessage contains the search state and other information
type DmtNode ¶
type DmtNode struct {
// contains filtered or unexported fields
}
DmtNode implements search.Node
func NewDmtNode ¶
NewDmtNode creates a new DmtNode
type Engine ¶
Engine holds all the data structures needed for performing the actual search. It implements a high level Search algorithm, that repetitively calls the step() method of the Strategy object.
func NewEngine ¶
func NewEngine(t *task.Task, server comm.Server, dispatcher comm.Dispatcher, conns comm.ConnList, opts *opt.OptionSet) *Engine
NewEngine creates a new search engine.
func (*Engine) Search ¶
Search is the engine's main search routine, calling the implemented Strategy's step() function until status changes to solved, failed, or timeout
func (*Engine) SetComm ¶
func (e *Engine) SetComm(s comm.Server, d comm.Dispatcher)
SetComm sets the engine's communication server and dispatcher
func (*Engine) SetDispatcher ¶
func (e *Engine) SetDispatcher(d comm.Dispatcher)
SetDispatcher sets the engine's message dispatcher to d
func (*Engine) SetStrategy ¶
SetStrategy sets the engine's search strategy to s
type FactPair ¶
FactPair represents a variable value-assignment (its basically the same as task.VariableValuePair or task.Condition)
type Mafs ¶
type Mafs struct { *Engine // contains filtered or unexported fields }
Mafs (Multi agent forward search) implements search.Strategy interface
type MafsMessage ¶
MafsMessage contains a search state, and other information
type MafsNode ¶
type MafsNode struct {
// contains filtered or unexported fields
}
MafsNode is the node type for mafs search implementing search.Node interface
type NodeAccessor ¶
NodeAccessor contains methods to access nodes
type NodeGetter ¶
NodeGetter instances can access an element at index i with Get(i)
type PhonyPruner ¶
type PhonyPruner struct{}
PhonyPruner does not prune anything
func NewPhonyPruner ¶
func NewPhonyPruner(t *task.Task) *PhonyPruner
NewPhonyPruner returns a new PhonyPruner instance
type Plan ¶
type Plan []Move
Plan consists of Moves of an agent
type PlanExtractionMessage ¶
PlanExtractionMessage is used for distributed plan extraction procedure. The message means that during planning, the sender (with senderID) has received a state from the other agent containing stateID in the tokenlist. The other agent can lookup the stateID and tokens to continue plan extraction from there.
type PlanExtractor ¶
type PlanExtractor struct {
// contains filtered or unexported fields
}
func (*PlanExtractor) Extract ¶
func (x *PlanExtractor) Extract(n Node)
Extract the plan steps of this agent, then ask other agents for their parts.
func (*PlanExtractor) Msg ¶
func (x *PlanExtractor) Msg() *XMessage
type PlanRegistry ¶
type PlanRegistry struct {
// contains filtered or unexported fields
}
func NewPlanRegistry ¶
func NewPlanRegistry(e *Engine) *PlanRegistry
func (*PlanRegistry) BestCostPlan ¶
func (pr *PlanRegistry) BestCostPlan() Plan
func (*PlanRegistry) BestMakespanPlan ¶
func (pr *PlanRegistry) BestMakespanPlan() (string, Plan)
func (*PlanRegistry) NumPlans ¶
func (pr *PlanRegistry) NumPlans() int
type PriorityQueue ¶
type PriorityQueue []ValueNode
A PriorityQueue implements heap.Interface and holds ValueNodes
func NewPriorityQueue ¶
func NewPriorityQueue() *PriorityQueue
func (*PriorityQueue) Get ¶
func (q *PriorityQueue) Get(i int) ValueNode
Get returns node at index i (NodeGetter interface)
func (PriorityQueue) Len ¶
func (q PriorityQueue) Len() int
func (PriorityQueue) Less ¶
func (q PriorityQueue) Less(i, j int) bool
func (*PriorityQueue) Pop ¶
func (q *PriorityQueue) Pop() interface{}
Pop removes the first element from the queue
func (*PriorityQueue) Push ¶
func (q *PriorityQueue) Push(x interface{})
Push adds a new element to the queue
func (*PriorityQueue) Put ¶
func (q *PriorityQueue) Put(x interface{})
func (PriorityQueue) Swap ¶
func (q PriorityQueue) Swap(i, j int)
func (*PriorityQueue) Take ¶
func (q *PriorityQueue) Take() interface{}
type PriorityQueueFIFO ¶
type PriorityQueueFIFO struct {
// contains filtered or unexported fields
}
Queue for A* search
func NewPriorityQueueFIFO ¶
func NewPriorityQueueFIFO() *PriorityQueueFIFO
func (*PriorityQueueFIFO) Get ¶
func (q *PriorityQueueFIFO) Get(i int) ValueNode
Get returns node at index i (NodeGetter interface)
func (PriorityQueueFIFO) Len ¶
func (q PriorityQueueFIFO) Len() int
func (PriorityQueueFIFO) Less ¶
func (q PriorityQueueFIFO) Less(i, j int) bool
func (*PriorityQueueFIFO) Pop ¶
func (q *PriorityQueueFIFO) Pop() interface{}
Pop removes the first element from the queue
func (*PriorityQueueFIFO) Push ¶
func (q *PriorityQueueFIFO) Push(n interface{})
Push adds a new element to the queue
func (*PriorityQueueFIFO) Put ¶
func (q *PriorityQueueFIFO) Put(x interface{})
func (PriorityQueueFIFO) Swap ¶
func (q PriorityQueueFIFO) Swap(i, j int)
func (*PriorityQueueFIFO) Take ¶
func (q *PriorityQueueFIFO) Take() interface{}
type ProgressInfo ¶
type ProgressInfo struct {
// contains filtered or unexported fields
}
ProgressInfo collects information on search progress
func NewProgressInfo ¶
NewProgressInfo creates a new ProgressInfo object
func (*ProgressInfo) Print ¶
func (i *ProgressInfo) Print()
Print prints the current progress to stdout
func (*ProgressInfo) PrintCurrent ¶
func (i *ProgressInfo) PrintCurrent()
PrintCurrent prints the current progress to stdout (same as Print) but is used to report progress after a given duration
func (*ProgressInfo) PrintTime ¶
func (i *ProgressInfo) PrintTime()
PrintTime prints the time (in minutes) since the object was created
func (*ProgressInfo) SetPlan ¶
func (i *ProgressInfo) SetPlan(plan *PlanExtractor)
SetPlan that this progress information is about.
func (*ProgressInfo) SummaryJSON ¶
func (i *ProgressInfo) SummaryJSON() string
SummaryJSON summarizes the progress as JSON string.
type StateActionMessage ¶
type StateActionMessage struct { SenderID int State []int // SharedState Actions []int Costs []int H int }
StateActionMessage contains a search state, actions, and other information
func (*StateActionMessage) G ¶
func (m *StateActionMessage) G() int
type Strategy ¶
type Strategy interface { // Initialize is called once before the search starts and contains all the // required initialization logic. Initialize() // Step is continiously called in the search.Engine's main loop. It executes // a single search step and returns the new search status. Step() Status }
Strategy is the basic search strategy interface
func NewDmtMakespanBfs ¶
NewDmtMakespanBfs returns a greedy dmt strategy
func NewDmtUCB1 ¶
NewDmtUCB1 returns a balanced (uct-like) dmt strategy
func NewStrategy ¶
ParseStrategy retrieves the specified strategy from the strategyRegistry (if the respective strategy was registered before), parses its command line options, then builds and returns the specified Strategy
type StrategyInfo ¶
type StrategyInfo struct { Name string Description string NewStrategy func(*Engine, *opt.OptionSet) Strategy Options *opt.OptionSet }
StrategyInfo holds information necessary for strategy creation based on command line arguments. For each search strategy selectable via cmd arguments, an according StrategyInfo object must exist in the (global) strategyRegistry
func GetStrategy ¶
func GetStrategy(name string) (*StrategyInfo, error)
GetStrategy returns the strategyinfo registered with the provided name (= name of the strategy, as used in the command line argument)
type StubbornSets ¶
type StubbornSets struct {
// contains filtered or unexported fields
}
StubbornSets is the `superclass` type, that is embedded by all concrete StubbornSets types (like StubbornSetsSimple or StubbornSetsEC). It provides all common methods (and instance variables) between the different implementations of stubborn sets.
func NewStubbornSets ¶
func NewStubbornSets(t *task.Task) *StubbornSets
NewStubbornSets creates a new StubbornSets object
type StubbornSetsSimple ¶
type StubbornSetsSimple struct { *StubbornSets // contains filtered or unexported fields }
StubbornSetsSimple implements simple stubborn set computation
func NewStubbornSetsSimple ¶
func NewStubbornSetsSimple(t *task.Task) *StubbornSetsSimple
NewStubbornSetsSimple builds and returns a new StubbornSetsSimple object
type TextMessage ¶
TextMessage is the message type for sending strings