Utils
This folder contains all the auxiliary functions needed.
Functions
Dionysos.Utils.QuadraticStateControlFunction — Type
QuadraticStateControlFunction{T, MT<:AbstractMatrix{T}}Quadratic function on state and input defined as x'Qx + u'Ru + 2x'Nu + 2x'q + 2u'r + v
Search
Dionysos.Utils.expand — Function
Yield the nodes reachable from this node.
Dionysos.Utils.path_cost — Function
Return the cost of a solution path that arrives at state2 from state1 via action, assuming cost c to get up to state1. If the problem is such that the path doesn't matter, this function will only look at state2. If the path does matter, it will consider c and maybe state1 and action. The default method costs 1 for every step in the path.
Dionysos.Utils.breadth_first_graph_search — Function
Search the shallowest nodes in the search tree first.
Dionysos.Utils.depth_first_graph_search — Function
Search the deepest nodes in the search tree first.
Dionysos.Utils.best_first_graph_search — Function
Search the nodes with the lowest f scores first. You specify the function f(node) that you want to minimize; for example, if f is a heuristic estimate to the goal, then we have greedy best first search; if f is node.depth then we have depth-first search.
Dionysos.Utils.path — Function
Create a list of nodes from the root to this node.
Create a list of nodes from the root to this node.
Dionysos.Utils.AbstractQueue — Type
AbstractQueue is an abstract type. There are three types: MyStack(): A Last In First Out Queue. FIFOQueue(): A First In First Out Queue. MyPriorityQueue(f,ext): Queue where items are sorted by f, (default <). Each type supports the following methods and functions: append!(q,item) – add an item to the queue extend!(q,items) – equivalent to: for item in items: append(q,item) pop!(q) – return the top item from the queue length(q) – number of items in q
Dionysos.Utils.MyStack — Type
Return an empty list, suitable as a Last-In-First-Out Queue.
Dionysos.Utils.tree_search — Function
Search through the successors of a problem to find a goal. The argument fringe should be an empty queue. Don't worry about repeated paths to a state.
Dionysos.Utils.goal_test — Function
Return True if the state is a goal. The default method compares the state to P.goal, as specified in the constructor. Implement this method if checking against a single goal is not enough.
Dionysos.Utils.astar_graph_search — Function
A* search is best-first graph search with f(n) = g(n)+h(n). You need to specify the h function when you call astar_search.
Dionysos.Utils.astar_tree_search — Function
A* search is best-first graph search with f(n) = g(n)+h(n). You need to specify the h function when you call astar_search.
Dionysos.Utils.breadth_first_tree_search — Function
Search the shallowest nodes in the search tree first.
Dionysos.Utils.graph_search — Function
Search through the successors of a problem to find a goal. The argument fringe should be an empty queue. If two paths reach a state, only use the best one.
Dionysos.Utils.best_first_tree_search — Function
Search the nodes with the lowest f scores first. You specify the function f(node) that you want to minimize; for example, if f is a heuristic estimate to the goal, then we have greedy best first search; if f is node.depth then we have depth-first search.
Dionysos.Utils.successor — Function
Given a state, return a sequence of (action, state) pairs reachable from this state. If there are many successors, consider an iterator that yields the successors one at a time, rather than building them all at once.
Dionysos.Utils.Node — Type
A node in a search tree. Contains a pointer to the parent (the node that this is a successor of) and to the actual state for this node. Note that if a state is arrived at by two paths, then there are two nodes with the same state. Also includes the action that got us to this state, and the total pathcost (also known as g) to reach the node. Other functions may add an f and h value; see bestfirstgraphsearch and astar_search for an explanation of how the f and h values are handled.
Dionysos.Utils.depth_first_tree_search — Function
Search the deepest nodes in the search tree first.
Dionysos.Utils.MyPriorityQueue — Type
A queue in which the minimum (or maximum) element (as determined by f) is returned first. Keys of type T and priorities of type V.
Dionysos.Utils.FIFOQueue — Type
A First-In-First-Out Queue.
Dionysos.Utils.SearchProblem — Type
SearchProblemFields
- `initial` -- initial state of type `S` or a list of initial state of type `S`.
- `goal` -- possibly a goal state of type 'Union{Nothing,S}''.Example
struct Problem{S} <: SearchProblem{S}
initial::Union{S,Vector{S}}
goal::Union{Nothing,S}
end
The constructor specifies the initial state, and possibly a goal
state, if there is a unique goal.
function Problem(initial::S; goal=nothing) where S
return Problem{S}(initial,goal)
endDionysos.Utils.BranchAndBound.Abstract_BB_Problem — Type
Abstract_BB_Problem #abstract branch and bound problemSould implement the methods below
Dionysos.Utils.get_min_bounding_box — Function
get_min_bounding_box(elli, optimizer)Finds the minimum bounding box containing the ellipsoid {(x-c)'P(x-c) < 1}.
Dionysos.Utils.NodeT — Type
cost: cost to reach its parent
Dionysos.Utils.collect_children — Function
Return a list with all the children of node
Dionysos.Utils.RRT — Function
Basic generic RRT algorihtm
SI : initial state (this will be the root of the tree) ;
SF : target state that we try to reach ;
distance : function that defines a metric between the states ;
rand_state : function that returns a random candidate state ;
new_conf : function that returns a reachable state, with the action and the cost ;
keep : function to filter the node that we want to add during an iteration;
stop_crit : stop criteria ;
RRTstar : boolean to use RRT* ;
compute_transition : to compute transition between to given state (if RRTstar is true).Dionysos.Utils.add_node! — Function
add a node as a leave
Dionysos.Utils.propagate_cost_to_leaves — Function
assuming that the path_cost of a node has changed (and its depth), we should propagate the new cost to its children
Dionysos.Utils.get_path — Function
return the path from node to the root of the tree
Dionysos.Utils.Tree — Type
Tree structure with
- cost for transitions (the cost function a non-negative function);
- an underlying metric between the states that are encapsulated in the nodes of the tree
Geometric shapes
Dionysos.Utils.set_in_period — Function
set_in_period(
rect::HyperRectangle,
start::SVector{P, T},
periods::SVector{P, T},
periodic_dims::SVector{P, Int}
) -> LazyUnionSetArray{HyperRectangle}Split a rectangle along periodic boundaries (if it crosses any) and return a LazyUnionSetArray of wrapped rectangles.
Dionysos.Utils.HyperRectangle — Type
HyperRectangle{VT}Defines a hyper-rectangle using lb (lower bound) and ub (upper bound).
Dionysos.Utils.DeformedRectangle — Type
DeformedRectangle(rect, f, N, shape)A deformed rectangle.