This repository has been archived by the owner on Jun 4, 2019. It is now read-only.
/ smaccm Public archive

Resolute collection semantics#91

Closed
opened this issue Mar 8, 2018 · 2 comments
Closed

Resolute collection semantics #91

opened this issue Mar 8, 2018 · 2 comments
Assignees
Labels

kfhoech commented Mar 8, 2018

 Presently the collection semantics in Resolute is that of lists. There are models where this semantics is appropriate. @reteprelief provides the following where proper summation over the collection depends on allowing duplicate elements: ``````-- recursively total of weight budgets of all components AddAllBudgets(self : component) : real = let subs :{component} = subcomponents(self); let totals: real = sum({AddAllBudgets(t) for (t: subs)}) + NetWeight(self); if (length(subs) = 0 or totals = 0.0) then WeightBudget(self) else totals -- c omputational function to calculate total of weight budget from subcomponents AddSubcomponentWeightBudgets(self: component) : real = sum({WeightBudget(t) for (t: subcomponents(self))}) WeightBudget(self:component): real = if (has_property(self,SEI::GrossWeight)) then property(self,SEI::GrossWeight,0.0 kg) else property(self,SEI::NetWeight,0.0 kg) `````` Conversely, there are models that depend on the semantics being those of sets. The Flight model is one such model. In this model a recursive function is used to walk over the connections in the model and collect the reachable set of destinations. This allows an argument as to whether there is separation between model elements and and answer can certain elements in the model reach (influence) other elements without traversing an intermediate such as a firewall or decryptor. In this model immediate problem encountered is that with duplicates allowed in the collections, the exit criterion for the recursive walk is never met, resulting in an infinite loop in the Resolute evaluator. Accordingly, both set semantics and list semantics are wanted. For making this improvement in Resolute I propose: Changing the behavior back to sets. Adding grammar elements and evaluators for lists based on the existing code, but adding the missing list accessors (e.g. head, tail) so that it's possible to write recursive functions that operate on lists. adding fold (a.k.a accumulate) operator. The text was updated successfully, but these errors were encountered:

konrad-slind commented Mar 8, 2018 via email

self-assigned this Mar 12, 2018
mentioned this issue Mar 12, 2018
added a commit that referenced this issue Mar 19, 2018
``` Merge pull request #95 from smaccm/develop_issue91 ```
``` b6851bd ```
`Resolve Resolute collection semantics (Issue #91)`

kfhoech commented Mar 19, 2018

 Resolved by Pull Request 95.