Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Add support for 'strict' targets on the Agent interface #62

Merged
merged 3 commits into from
Apr 10, 2024

Conversation

pipex
Copy link
Collaborator

@pipex pipex commented Apr 9, 2024

A Target in Mahler is by default 'relative', meaning that only property
changes and additions should be considered when comparing current and
target states for planning. Property deletion need to be done explicitely
via the UNDEFINED symbol. This allows a cleaner interface for for
defining system targets and allows the system state to have additional properties
than the target.

A 'relative' target is the opposite to a 'strict' (or absolute) target, where what is passed to
the planner/agent describes exactly the desired state of the system is.

This PR introduces the StrictTarget type and the seekStrict method
on the Agent interface. This allows users some additional flexibility
to specify an absolute state of the final system.

Example: let's say we are modelling the state of two variables x and y.

Given the current state {x: 0}, the target state {y: 1} means that the
planner needs to only to find a task that can create the variable y and increase its
value to 1. The final expected state should be {x: 0, y:1} (assuming nothing else changes x).

If the goal was to remove the variable x at the same time that variable y is introduced, the
relative target would need to be {x: UNDEFINED, y: 1}

The equivalent strict target in this case is just {y: 1}.

Change-type: minor

pipex added 3 commits April 9, 2024 19:23
This documents the difference between a 'relative' target and a 'strict'
target and renames the `Target.from` function to `Target.fromStrict` for
better clarity on what the function provides
The conversion from strict to relative target was not recursing into
the sub-objects if a glob match was found. This is not the right
behavior

Change-type: patch
A Target in Mahler is by default 'relative', meaning that only property
changes and additions should be considered when comparing current and
target states for planning. Property deletion need to be done explicitely
via the `UNDEFINED` symbol. This allows a cleaner interface for for
defining system targets and allows the system state to have additional properties
than the target.

A 'relative' target is the opposite to a 'strict' (or absolute) target, where what is passed to
the planner/agent describes exactly the desired state of the system is.

This PR introduces the `StrictTarget` type and the `seekStrict` method
on the `Agent` interface. This allows users some additional flexibility
to specify an absolute state of the final system.

Example: let's say we are modelling the state of two variables `x` and `y`.

Given the current state `{x: 0}`, the target state `{y: 1}` means that the
planner needs to only to find a task that can create the variable `y` and increase its
value to `1`. The final expected state should be `{x: 0, y:1}` (assuming nothing else changes `x`).

If the goal was to remove the variable `x` at the same time that variable `y` is introduced, the
relative target would need to be `{x: UNDEFINED, y: 1}`

The equivalent strict target in this case is just `{y: 1}`.

Change-type: minor
@flowzone-app flowzone-app bot enabled auto-merge April 9, 2024 23:52
@pipex
Copy link
Collaborator Author

pipex commented Apr 10, 2024

I self-certify!

@flowzone-app flowzone-app bot merged commit 46b5194 into main Apr 10, 2024
46 checks passed
@flowzone-app flowzone-app bot deleted the strict-target branch April 10, 2024 15:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant