Apply controllers and implement set commands during lattice expansion#74
Merged
Conversation
Brings expansion in line with pals#237 (Controller) and pals#268 (lattice expansion), neither of which the pipeline previously acted on. Controllers were evaluated but never applied: control_type was read and ignored, so the lattice was untouched. Now the ABSOLUTE controllers are applied to the parameters they drive, each set to the sum over the controllers driving it, and RELATIVE ones take no part in expansion. They run after branch and fork expansion and before the bookkeeper, so the reference and dependent parameters are computed from the driven values. Controllers that drive another controller's variable form a hierarchy, evaluated top-down with cycles reported; control_type defaults to ABSOLUTE; a variable with no value is zero and an initial value is a constant expression, since neither it nor a control expression may reach outside its own controller. set and expand_lattice were absent altogether. An expand_lattice node now divides the facility list, and the pipeline follows the documented order: pre-expansion sets, branch and fork expansion, controllers, bookkeeper, post-expansion sets, controllers again, bookkeeper again. A set ahead of expand_lattice writes the element definitions, and only those defined before it in the list; one after it writes each expanded element separately. An unwritten parameter reads as zero unless a member of its linked family is written, in which case its value is still to be derived and reading it is an error. That same family notion lets a post-expansion set drop what it invalidated so the second bookkeeper pass rebuilds it rather than flagging an inconsistency. absolute_error/relative_error are reported rather than applied: the standard gives the error magnitude but not its distribution, and this library defers randomness everywhere else for reproducibility. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Brings lattice expansion in line with pals#237 (
Controller) and pals#268 (lattice expansion), plus thesetandexpand_latticesections already onpalsmain.Controllers
Controllers were evaluated but never applied —
control_typewas read and ignored, so the lattice was untouched.parameterpattern matches, each set to the sum over the controllers driving it, replacing the element's own value. A parameter the element does not carry is created.control_typedefaults toABSOLUTEand is materialized. A variable with no value is zero, and an initial value is a constant expression — neither it nor a control expression may reach outside its own controller.expr(...)-delayed, a target matching nothing, an unknowncontrol_type.setandexpand_latticeBoth were absent entirely. An
expand_latticenode now divides thefacilitylist and the pipeline follows the documented order:expand_latticea set writes the element definitions, and only those defined earlier in the list — so every expanded copy inherits one value.SELF.s_position).valueexpressions takePARAMETER(the value being replaced) andSELF.<path>(the owning element). The compactsets:form is supported.Bs1/Ks1example.Not implemented
absolute_error/relative_errorare parsed and reported rather than applied: the standard gives the error magnitude (absolute_error + relative_error * |value|) but not its distribution, and this library defers randomness everywhere else soexpandedstays reproducible.Tests
203 pass (was 174). New
tests/test_sets.cpp(14 cases) and a rewrittentests/test_controllers.cpp.🤖 Generated with Claude Code