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

Types

t()

I hold the state for the solver process.

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

Link to this function

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

Link to this function

do_solve(state)

Link to this function

get_solved(node_id)

@spec get_solved(String.t()) :: [Anoma.RM.Intent.t()]

I return all the solved intents.

Link to this function

get_unsolved(node_id)

@spec get_unsolved(String.t()) :: [Anoma.RM.Intent.t()]

I return all the unsolved intents.

Link to this function

start_link(args)

I create a new solver process .

@spec subsets(Enumerable.t()) :: Enumerable.t()

I generate all possible subsets of a given list of elements as a stream.

Link to this function

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.