Anoma.Node.Intents.Solver (Anoma v0.25.0)
I am a strawman intent solver for testing purposes.
Public API
I have the following public functionality:
get_solved/0
send/1
Summary
Functions
Returns a specification to start this module under a supervisor.
I return all the solved intents.
I return all the unsolved intents.
I create a new solver process .
I generate all possible subsets of a given list of elements as a stream.
I check if a list of intents is valid by composing them and verifying if they satisfy the Intent.valid? predicate.
Types
@type t() :: %Anoma.Node.Intents.Solver{ node_id: String.t() | nil, solved: MapSet.t(Anoma.RM.Intent.t()), unsolved: MapSet.t(Anoma.RM.Intent.t()) }
I hold the state for the solver process.
Fields
:unsolved
- The set of unsolved intents.:solved
- The set of solved intents.
Functions
child_spec(init_arg)
Returns a specification to start this module under a supervisor.
See Supervisor
.
do_solve(state)
get_solved(node_id)
@spec get_solved(String.t()) :: [Anoma.RM.Intent.t()]
I return all the solved intents.
get_unsolved(node_id)
@spec get_unsolved(String.t()) :: [Anoma.RM.Intent.t()]
I return all the unsolved intents.
solve(intents)
@spec solve([Anoma.RM.Intent.t()] | MapSet.t(Anoma.RM.Intent.t())) :: MapSet.t(Anoma.RM.Intent.t()) | nil
start_link(args)
I create a new solver process .
subsets(list)
@spec subsets(Enumerable.t()) :: Enumerable.t()
I generate all possible subsets of a given list of elements as a stream.
valid?(intents)
@spec valid?([Anoma.RM.Intent.t()]) :: boolean()
I check if a list of intents is valid by composing them and verifying if they satisfy the Intent.valid? predicate.