Thu, 17/05/2012 - 16:30 — John E. Rogers04
I'm currently creatinfg a model that conditional constructs a large Hexagon grid. The smallest grid contains 49601 hexagons and it takes about 60 - 75 minutes to compile. Is there a way to capture this list so that it doesn't have to be compiles each time the model needs to be opened? Will snapshot do the trick?
Reporter:
John E. Rogers04
Created:
Thu, 17/05/2012 - 16:30
Updated:
Fri, 12/10/2012 - 12:41
Comments
#1
It depends what is taking the time.
If there is a relation between members of the polygon submodel, then this will take a long time to create, and in the case where the polygon submodel itself is conditional, there is no easy way around this. But if the time is taken by loading parameters from data files, you might be able to improbe things by storing the parameters as byte arrays (this is a checkbox option on the file loader dialogue).
If the problem is in calculating the membership of a relation, let me know and I might be tempted to try and do something about the issue in the long-awaited v6.0 release.
#2
I guess the prblem is not so much in creating the grid but in determining the neighbors for a given hexigon. I load the x and y coordinates obtained from ARCGIS as files. I then use conditional statements using the coordinates to identify neighbors. This is the long step. If I could use the neighbor files that I can capture from snapshot it would save loads of time in subsequent runs by just making them part of the parameter file. The goal is to get the model to populate hexs with seagrass and then transfer the data back to ARVGIS to create a series of maps.
This model is catching some interest in the agency and I will need to do some uncertainty analysis. How would I run simile on a super computer. An interface for the C++ code?
#3
There are several options for speeding up the initialization of your model. I'm assuming the hexagon submodels themselves are fixed-membership, since they are able to read parameterization data from files. If that is the case, you can use one-sided relation enumeration to speed up the calculation of the membership of the neighbour relation. This basically involves calculating the indices of one hexagon's neighbours without reference to data in the other hexagon, and requires the hexagons to be specified in a certain order.
You can also use this with a data file specifying the neighbour relation. One way to do this would be to create a grid .csv file with the hexagon indices on the rows in the first column, and the indices of their neighbours in subsequent columns arranged 'ragged right'. Now you can load the neighbour indices into a per-record submodel inside the hexagon submodel, and use them to enumerate the neighbour relation by giving it a condition of the form "any(index(1) is {neighbour}).
If this is not possible, you can try this: Create another submodel whose members represent overlapping regions in your target domain. The number of regions should be about the square root of the number of hexagons. Now create a satellite of the hexagon submodel inside the region submodel, with a condition that its members are only those hexagons falling within the region. You can now make a neighbour relation between hexagons within each region, making sure those in one of the roles are in a central, non-overlapping sub-region to avoid duplication of relations in different region submodels. This will reduce the complexity overall from n^2 to n^(3/2) but you can go better if needed by setting up a hierarchy of different sized regions and subregions,
If you're unsure what to do, send your model and data to support@simulistics.com and I'll try to implement one of these plans.
Re your other question, you can interface directly to the model code via the 5-D (straight c) or 6-D (c++ class based) shared library interfaces. There is also a package for accessing saved models from the R scripting language.
#4