Replies: 1 comment
-
|
@alexdewar I know you're extremely busy, but if you have any thoughts or time to chat about this then let me know! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Currently there's a real lack of consistency in the way we're reading in, validating and structuring the data, which is making the code very difficult to work with. I feel we need to come to a consensus and use a consistent approach throughout, particularly for dealing with maps/connections between tables.
I had fun with #474, but leaning against this approach as it feels like overengineering and it only really works when year is the only key, which is never. I think #475 is more the approach I'm leaning towards, although it's still incomplete.
This is very much a scattered collection of thoughts/notes/ideas, but I think we can come up with a solid plan based on this. Also very happy to hear other opinions and ideas
Notes:
Mapobject (can come up with a more creative name) which could just be an alias forHashMapto start with, but would allow us to add features e.g. more helpful error messages, validation methodsCommodityID,AgentIDetc. so it's clear how each map can be looked up. Conversion of a key from a string to an ID type could require checking the string against the list of valid IDs, so an ID type always implies the key is validAgentSearchSpaceMapwould beMap<(CommodityID, YearID), SearchSpace>Processes) should also be kept in maps (i.e.ProcessMap = Map<ProcessID, Process>)datamodule. This should should just contain the struct definitions, without any functionsMap<ProcessID, Rc<Process>>), and be consistent. I guess it's better to store references, but not sureAgentObjectiveshould not have ayearfield because year is a key in the mapMapto validate thisMapto ensure that there are no clashes/overwriting of data (e.g. if "all" and a specific year are specified)XRawstruct, which should have ato_xmethod (which can optionally call avalidatemethod to perform row-level validation). We could modifyto_xto return the final object as well as a tuple of keys, for easy insertion into a mapThe final data structures would look something like this:
commodity:
Map<CommodityID, Commodity>Map<(RegionID, YearID, TimeSliceID), f64>Map<(RegionID, YearID, TimesliceID), CommodityCost>process:
Map<ProcessID, Process>Map<(RegionID, YearID), ProcessParameter>Map<(RegionID, YearID, TimesliceID), RangeInclusive<f64>>Map<(RegionID, YearID), Vec<ProcessFlow>>agent:
Map<AgentID, Agent>Map<(CommodityID, YearID), f64>Map<(CommodityID, YearID), <Vec<AgentObjective>>>Map<(CommodityID, YearID), SearchSpace>assets:
Map<AssetID, Asset>regions:
Map<RegionID, Region>Beta Was this translation helpful? Give feedback.
All reactions