Class swarmauri_core.programs.IProgram.IProgram
swarmauri_core.programs.IProgram.IProgram
Bases: ABC
Interface for programs under evolution.
This abstract class defines the contract that all evolvable programs must implement, providing methods for comparing, modifying, and validating program representations.
diff
abstractmethod
diff(other)
Calculate the difference between this program and another.
PARAMETER | DESCRIPTION |
---|---|
other
|
Another program to compare against
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
DiffType
|
A structured representation of the differences between programs |
RAISES | DESCRIPTION |
---|---|
TypeError
|
If the other program is not compatible for diffing |
Source code in swarmauri_core/programs/IProgram.py
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
|
apply_diff
abstractmethod
apply_diff(diff)
Apply a diff to this program to create a new modified program.
PARAMETER | DESCRIPTION |
---|---|
diff
|
The diff structure to apply to this program
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
IProgram
|
A new program instance with the diff applied |
RAISES | DESCRIPTION |
---|---|
ValueError
|
If the diff cannot be applied to this program |
TypeError
|
If the diff is not in the expected format |
Source code in swarmauri_core/programs/IProgram.py
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
|
validate
abstractmethod
validate()
Validate that this program is well-formed and executable.
RETURNS | DESCRIPTION |
---|---|
bool
|
True if the program is valid, False otherwise |
Source code in swarmauri_core/programs/IProgram.py
50 51 52 53 54 55 56 57 58 |
|
clone
abstractmethod
clone()
Create a deep copy of this program.
RETURNS | DESCRIPTION |
---|---|
IProgram
|
A new program instance with the same state |
Source code in swarmauri_core/programs/IProgram.py
60 61 62 63 64 65 66 67 68 |
|