Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

How to set any other skills to optional #62

Open
CICS-Oleg opened this issue Jan 29, 2025 · 1 comment
Open

How to set any other skills to optional #62

CICS-Oleg opened this issue Jan 29, 2025 · 1 comment
Assignees
Labels
help wanted Extra attention is needed question Further information is requested tutorial Tutorial question

Comments

@CICS-Oleg
Copy link
Contributor

Suppose we have a set of permissible skills:

(= (permissible economics) True)
(= (permissible capital-markets) True)
(= (permissible tokenomics) True)
(= (permissible credit-risk) True)
(= (permissible portfolio-construction) True)

And suppose we have some agents that have some of the skills:

(= (economics m1) True)
(= (capital-markets m2) True)
(= (tokenomics m3) True)
(= (credit-risk m4) True)
(= (portfolio-construction m5) True)
(= (tokenomics m1) True)

To do their work agents should have at least one skill. We have a predicate to check permissibility of skill e for agent m:

(= (permissible (experience $e $m))
    (and (== ($e $m) True)
     (== (permissible $e) True)))

Since we need only one permissible skill for an agent to give him a further task, any other skill possessed by the agent becomes optonal:

(= (optional (experience $e $m))
    (and (permissible (experience $e $m))
    (omissible (experience $e $m))))

The question is
how to implement omissible function in the most MeTTa-like way to automatically check if an agent has 2 or more skills and mark all of them but one (which one?) as omissible?

@CICS-Oleg CICS-Oleg added help wanted Extra attention is needed question Further information is requested tutorial Tutorial question labels Jan 29, 2025
@Necr0x0Der
Copy link
Contributor

Necr0x0Der commented Jan 30, 2025

Well, I'm not precisely sure what do you mean by "mark". You are not putting info into the space, right? But I suppose that you mean that omissible function will return True for all the agent skill except one of them.

"which one?" is the question to the domain semantics. Apparently, you either should have one non-omissible skill, or skills should be omissible conditionally. Maybe, the latter cannot be described in the representation of this logic - I don't know.

I'm also not sure what (experience $e $m) means. Is it a function, or a constructor? If it's a constructor, I'd propose to follow some naming conventions to distinguish them from functions, e.g. Experience. Also (= (permissible economics) True) might be better as (= (permissible (Skill economics)) True), but it depends...

There is a pretty simple way to get all agent skills:

(= (agent-skills $agent)
   (if (and (== (permissible $skill) True)
            (== ($skill $agent) True))
       $skill
       Empty)
)

Then, this will give you the agent skill list omitting the first skill as a tuple:

!(let $skills (collapse (agent-skills m1))
      (cdr-atom $skills))

If you want to mark these skills by putting the corresponding equalities into the space, it will be quite straightforward to do. You may want to check if this is not yet added to the space, though. But if you want to have omissible function without side effects, then it looks a little bit less straightforward. If I guessed your notations right, then it can look like this

(= (omissible (experience $agent $skill))
   (let* (($skills (collapse (agent-skills $agent)))
          ($skls-1 (cdr-atom $skills))
          ($om-skl (superpose $skls-1)))
      (if (== $skill $om-skl) True Empty))
)

!(omissible (experience m1 economics))
!(omissible (experience m1 tokenomics))

It will return Empty in the last case (not False). If we put just (== $skill $om-skl) instead of (if (== $skill $om-skl) True Empty)), there will be too many False. So, if you really need False instead of Empty, one more wrapper function is needed.

I don't like this solution too much, because it will collect all the skills and check if the given skill is in the truncated list. But maybe it's ok. There is also no guarantee that agent-skills will always return skills in the same order. It kinda works now, but returning the list (or nondeterministic set) of omissible skills would be more efficient and solid than checking omissible individually without putting results in the space. But what is preferable depends on a more general context.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
help wanted Extra attention is needed question Further information is requested tutorial Tutorial question
Projects
None yet
Development

No branches or pull requests

3 participants