repast.simphony | Git repository for Repast Simphony development | Version Control System library
kandi X-RAY | repast.simphony Summary
kandi X-RAY | repast.simphony Summary
Git repository for Repast Simphony development.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Initialize primitives
- Produce a closure as a string
- Encodes a procedure invocation
- Looks up a color by its color
- Match tokens
- Match a NUMBER
- Get a WSWS
- Get a NUMBER
- Initialize the service
- Create the control
- Retrieve the classes from the database
- Save a graph
- Performs the action
- Save the current settings
- Set the values of TransitionChart
- Set the value of TransitionChart
- Add this component to the panel
- Creates the header section
- Handle a key
- Handle key event
- Add the list of agent options
- Initializes the shapeModel
- Applies a value layer to the given style
- Initializes the default color space
- Unescapes a string
- Get the geometry
repast.simphony Key Features
repast.simphony Examples and Code Snippets
Community Discussions
Trending Discussions on repast.simphony
QUESTION
I am working with a code base that has relied on Eclipse for compilation until now. My objective is to compile it with javac
(via ant
) to simplify the build process. The project compiles without complaint in Eclipse (version 2019-12 (4.14.0)), but javac
(OpenJDK, both versions 1.8.0_275 and 14.0.2) produces method ... cannot be applied to given types
errors involving upper bounded wildcards.
Note that the repository is 64 MB at time of writing:
...ANSWER
Answered 2021-Jan-02 at 22:05You've misunderstood the rules on what ? extends
means as far as type compatibility is concerned.
Any two occurrences of ? extends Number
are not compatible with each other, nor is ? extends Number
compatible with Number
itself. Here is a trivial 'proof' of why that is:
QUESTION
I have a model with some calculations associated with a number of hubs, each with a unique hub code. Hence I configure the batch run as a list of hub codes. However, there could be some errors happens for certain hubs. In such case, the batch run will be auto stopped at the time error happens.
I am wondering if I could configure to tell the batch run to auto jump the hubs that are reporting errors and continue to calculate the remaining hubs to finish the entire batch run list of hubs.
Update on issue clarification:
I have a batch run configuration consists of two key parameters. The hub name and the date. "Hub name" is a list of all hub codes. I have 300 hubs to simulate. The "date" indicates the demand data of a particular date for a hub. I have set the date range from 1 to 5. Thereafter, I have 300 x 5 combination of scenarios to simulate, which forms the batch run configuration.
The batch run, however is likely to be interrupted as some part of the input data is missing for simulating certain hub scenarios (e.g. some hub does not have full 5 days demand data, when the model pulls the input data of a particular date which is missing, the model reports runtime error causing the whole batch run ended). Hence, in reality there is not full 300 X 5 viable scenarios, some are missing or invalid.
I want the batch run to jump simulating the scenarios if there are some errors and continue to simulate the rest of the valid scenarios. e.g. if I have hub-1, hub-2, hub-3, hub-4, hub-5 as the batch scenarios. if these 5 scenarios are happen to be allocated to the same cpu core, I hope it will finish whatever it can finish. i.e. if hub-3 reportes an error, batch run will jump it and continue to simulate hub-4 and hub-5 scenarios. so finally I can still get hub-1,2,4,5 results except hub-3 being error reportred and hence empty result.
Update: the traceback info: (it seems try catch exception (RunEnvironment.getInstance().endRun();) won't work in initialization (context builder)
INFO [AWT-EventQueue-0] 14:11:03,592 repast.simphony.batch.gui.BatchConfigMediator - Writing batch run config file to: C:\Users\xxx\Desktop\Repast\Hub_Unload\output\config.props INFO [AWT-EventQueue-0] 14:11:03,692 repast.simphony.batch.gui.BatchConfigMediator - Unrolling batch parameter file: C:\Users\xxx\Desktop\Repast\Hub_Unload\batch\batch_params.xml to C:\Users\xxx\AppData\Local\Temp\unrolledParamFile.txt INFO [SwingWorker-pool-2-thread-1] 14:11:13,463 repast.simphony.batch.ssh.LocalSession - Copying locally C:\Users\xxx\AppData\Local\Temp\Jie_localhost7191822269942717344.zip to C:\Users\xxx\AppData\Local\Temp\simphony_model_1595484669853 ... INFO [SwingWorker-pool-2-thread-1] 14:11:13,492 repast.simphony.batch.ssh.LocalSession - Copying Finished. INFO [SwingWorker-pool-2-thread-1] 14:11:13,494 repast.simphony.batch.ssh.SessionsDriver - Initialization Time: 0.0606 INFO [SwingWorker-pool-2-thread-1] 14:11:13,494 repast.simphony.batch.ssh.LocalSession - Unzipping model C:\Users\xxx\AppData\Local\Temp\simphony_model_1595484669853\Jie_localhost7191822269942717344.zip INFO [SwingWorker-pool-2-thread-1] 14:11:13,955 repast.simphony.batch.ssh.LocalSession - Running model on localhost ... INFO [Thread-0] 14:11:21,769 repast.simphony.batch.ssh.LocalSession - WARNING: An illegal reflective access operation has occurred INFO [Thread-0] 14:11:21,769 repast.simphony.batch.ssh.LocalSession - WARNING: Illegal reflective access by com.thoughtworks.xstream.core.util.Fields (file:/C:/Users/xxx/AppData/Local/Temp/simphony_model_1595484669853/lib/xstream-1.4.7.jar) to field java.util.TreeMap.comparator INFO [Thread-0] 14:11:21,769 repast.simphony.batch.ssh.LocalSession - WARNING: Please consider reporting this to the maintainers of com.thoughtworks.xstream.core.util.Fields INFO [Thread-0] 14:11:21,770 repast.simphony.batch.ssh.LocalSession - WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations INFO [Thread-0] 14:11:21,770 repast.simphony.batch.ssh.LocalSession - WARNING: All illegal access operations will be denied in a future release INFO [Thread-0] 14:11:21,806 repast.simphony.batch.ssh.LocalSession - INFO [Thread-0] 14:11:21,807 repast.simphony.batch.ssh.LocalSession - Hub Code: 769WX INFO [Thread-0] 14:11:21,807 repast.simphony.batch.ssh.LocalSession - Date: 2 INFO [Thread-0] 14:11:21,807 repast.simphony.batch.ssh.LocalSession - INFO [Thread-0] 14:11:21,807 repast.simphony.batch.ssh.LocalSession - Header a.require_id,a.line_code,a.send_zone_code,a.arrive_zone_code,a.line_level,a.arr_date,a.arr_time,sim_date,sim_date_adj,arr_time_adj,shift,shift_start,shift_last_arr,shift_end,a.car_type,sum_qty,sum_t77,sum_und3_qty,sum_und3bag_qty,sum_lt_qty,sum_hv_qty INFO [Thread-0] 14:11:21,810 repast.simphony.batch.ssh.LocalSession - Header ��ת������,ж���ڱ���,���߱��,ж������,ж��������ж����,���ػ�ж���ٶȣ���/Сʱ��,�ػ�ж���ٶȣ���/Сʱ��,�����������(��/Сʱ) INFO [Thread-0] 14:11:21,817 repast.simphony.batch.ssh.LocalSession - Dock INFO [Thread-0] 14:11:21,866 repast.simphony.batch.ssh.LocalSession - WARN [main] 14:11:21,864 repast.simphony.query.AbstractPropertyQuery - Possible error while creating property query INFO [Thread-0] 14:11:21,866 repast.simphony.batch.ssh.LocalSession - java.lang.IllegalArgumentException: Property 'arr_tm' not found. INFO [Thread-0] 14:11:21,867 repast.simphony.batch.ssh.LocalSession - at repast.simphony.query.AbstractPropertyQuery.propertyNotFound(AbstractPropertyQuery.java:88) INFO [Thread-0] 14:11:21,867 repast.simphony.batch.ssh.LocalSession - at repast.simphony.query.PropertyLessThanEquals.createPredicate(PropertyLessThanEquals.java:94) INFO [Thread-0] 14:11:21,867 repast.simphony.batch.ssh.LocalSession - at repast.simphony.query.AbstractPropertyQuery.query(AbstractPropertyQuery.java:83) INFO [Thread-0] 14:11:21,867 repast.simphony.batch.ssh.LocalSession - at hub_Unload.Initialization_Builder.build(Initialization_Builder.java:274) INFO [Thread-0] 14:11:21,867 repast.simphony.batch.ssh.LocalSession - at repast.simphony.dataLoader.engine.ClassNameContextBuilder.build(ClassNameContextBuilder.java:41) INFO [Thread-0] 14:11:21,867 repast.simphony.batch.ssh.LocalSession - at repast.simphony.dataLoader.engine.DataLoaderControllerAction.runInitialize(DataLoaderControllerAction.java:48) INFO [Thread-0] 14:11:21,867 repast.simphony.batch.ssh.LocalSession - at repast.simphony.engine.controller.DefaultController$2.visit(DefaultController.java:214) INFO [Thread-0] 14:11:21,867 repast.simphony.batch.ssh.LocalSession - at repast.simphony.engine.controller.DefaultController$2.visit(DefaultController.java:1) INFO [Thread-0] 14:11:21,867 repast.simphony.batch.ssh.LocalSession - at repast.simphony.util.collections.NaryTree.preOrderTraverals(NaryTree.java:292) INFO [Thread-0] 14:11:21,867 repast.simphony.batch.ssh.LocalSession - at repast.simphony.util.collections.NaryTree.preOrderTraverals(NaryTree.java:295) INFO [Thread-0] 14:11:21,867 repast.simphony.batch.ssh.LocalSession - at repast.simphony.util.collections.NaryTree.preOrderTraverals(NaryTree.java:295) INFO [Thread-0] 14:11:21,868 repast.simphony.batch.ssh.LocalSession - at repast.simphony.util.collections.NaryTree.preOrderTraversal(NaryTree.java:288) INFO [Thread-0] 14:11:21,868 repast.simphony.batch.ssh.LocalSession - at repast.simphony.engine.controller.DefaultController.runInitialize(DefaultController.java:212) INFO [Thread-0] 14:11:21,868 repast.simphony.batch.ssh.LocalSession - at repast.simphony.engine.controller.DefaultController.runInitialize(DefaultController.java:383) INFO [Thread-0] 14:11:21,868 repast.simphony.batch.ssh.LocalSession - at repast.simphony.batch.OneRunBatchRunner.run(OneRunBatchRunner.java:101) INFO [Thread-0] 14:11:21,868 repast.simphony.batch.ssh.LocalSession - at repast.simphony.batch.InstanceRunner.run(InstanceRunner.java:195) INFO [Thread-0] 14:11:21,868 repast.simphony.batch.ssh.LocalSession - at repast.simphony.batch.InstanceRunner.main(InstanceRunner.java:217) INFO [Thread-0] 14:11:21,871 repast.simphony.batch.ssh.LocalSession - ERROR [main] 14:11:21,869 repast.simphony.batch.InstanceRunner - Error while running model INFO [Thread-0] 14:11:21,871 repast.simphony.batch.ssh.LocalSession - java.lang.IndexOutOfBoundsException: Index -1 out of bounds for length 0 INFO [Thread-0] 14:11:21,871 repast.simphony.batch.ssh.LocalSession - at java.base/jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:64) INFO [Thread-0] 14:11:21,871 repast.simphony.batch.ssh.LocalSession - at java.base/jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Preconditions.java:70) INFO [Thread-0] 14:11:21,871 repast.simphony.batch.ssh.LocalSession - at java.base/jdk.internal.util.Preconditions.checkIndex(Preconditions.java:248) INFO [Thread-0] 14:11:21,871 repast.simphony.batch.ssh.LocalSession - at java.base/java.util.Objects.checkIndex(Objects.java:372) INFO [Thread-0] 14:11:21,871 repast.simphony.batch.ssh.LocalSession - at java.base/java.util.ArrayList.get(ArrayList.java:458) INFO [Thread-0] 14:11:21,871 repast.simphony.batch.ssh.LocalSession - at hub_Unload.Initialization_Builder.build(Initialization_Builder.java:308) INFO [Thread-0] 14:11:21,871 repast.simphony.batch.ssh.LocalSession - at repast.simphony.dataLoader.engine.ClassNameContextBuilder.build(ClassNameContextBuilder.java:41) INFO [Thread-0] 14:11:21,872 repast.simphony.batch.ssh.LocalSession - at repast.simphony.dataLoader.engine.DataLoaderControllerAction.runInitialize(DataLoaderControllerAction.java:48) INFO [Thread-0] 14:11:21,872 repast.simphony.batch.ssh.LocalSession - at repast.simphony.engine.controller.DefaultController$2.visit(DefaultController.java:214) INFO [Thread-0] 14:11:21,872 repast.simphony.batch.ssh.LocalSession - at repast.simphony.engine.controller.DefaultController$2.visit(DefaultController.java:1) INFO [Thread-0] 14:11:21,872 repast.simphony.batch.ssh.LocalSession - at repast.simphony.util.collections.NaryTree.preOrderTraverals(NaryTree.java:292) INFO [Thread-0] 14:11:21,872 repast.simphony.batch.ssh.LocalSession - at repast.simphony.util.collections.NaryTree.preOrderTraverals(NaryTree.java:295) INFO [Thread-0] 14:11:21,872 repast.simphony.batch.ssh.LocalSession - at repast.simphony.util.collections.NaryTree.preOrderTraverals(NaryTree.java:295) INFO [Thread-0] 14:11:21,872 repast.simphony.batch.ssh.LocalSession - at repast.simphony.util.collections.NaryTree.preOrderTraversal(NaryTree.java:288) INFO [Thread-0] 14:11:21,872 repast.simphony.batch.ssh.LocalSession - at repast.simphony.engine.controller.DefaultController.runInitialize(DefaultController.java:212) INFO [Thread-0] 14:11:21,872 repast.simphony.batch.ssh.LocalSession - at repast.simphony.engine.controller.DefaultController.runInitialize(DefaultController.java:383) INFO [Thread-0] 14:11:21,872 repast.simphony.batch.ssh.LocalSession - at repast.simphony.batch.OneRunBatchRunner.run(OneRunBatchRunner.java:101) INFO [Thread-0] 14:11:21,872 repast.simphony.batch.ssh.LocalSession - at repast.simphony.batch.InstanceRunner.run(InstanceRunner.java:195) INFO [Thread-0] 14:11:21,872 repast.simphony.batch.ssh.LocalSession - at repast.simphony.batch.InstanceRunner.main(InstanceRunner.java:217)
...ANSWER
Answered 2020-Jul-22 at 12:46If you catch the exception and call RunEnvironment.getInstance().endRun()
that may be enough to exit gracefully. You may end up with empty output though.
If this happens during initialization, you can catch the error and schedule the run to end at some very small number before any model behavior occurs.
QUESTION
I'm attempting to conduct a batch run of a model through the Simphony GUI. I have text sink with relative path "./Test_Data_FileSink" created in my scenario tree. This file is created and saved with single runs through the GUI. However, when I conduct a batch run, no file is created within the localhost instance. When I navigate to the instance, I see a debug.log, FAILURE_null, instance.log, and param_input.txt, but no Test_Data_FileSink file. The batch process attempts to compile the data across instances and returns an empty batch_param_map.txt and Test_Data_FileSink.txt within the designated output location.
Warning message is displayed through Batch Run Configuration Window below:
'WARN [SwingWorker-pool-2-thread-1] 12:15:28,906 repast.simphony.batch.ssh.OutputFinder - No model output found matching glob:{**\,}Test_Data_FileSink_ModelOutput*.txt in C:\Users\user\AppData\Local\Temp\simphony_model_1582046063159\instance_1'
There is an additional error in the batch run console log where the model might be looking for the UI.
repast.simphony.batch.InstanceRunner - Error while running model java.lang.NoClassDefFoundError: repast/simphony/ui/RSApplication
The GUI UI does allow for parameter input, but I can't see where the model depends on it to run if the parameters are already set. I've attempted to insert some conditional statements around setting the UI
...ANSWER
Answered 2020-Feb-20 at 17:18The SpecialEffects class in the GeoZombies model references the RSApplication class which isn't available in the batch classpath, and it's not needed in batch anyway since all it does is provide some visual and sound effects, it can be removed from the model.
- Delete the SpecialEffects class
- In ContextCreator delete the static call to SpecialEffects.setUIEffects();
- In Human agent, delete the call to SpecialEffects.getInstance().playEnragedZombies();
- In Zombie agent, delete calls to SpecialEffects.getInstance()...
QUESTION
I am following the instruction to test calling my simulation model from another java program.
...ANSWER
Answered 2020-Jan-06 at 14:38Parts of the batch run mechanism for Simphony can probably be used for this. For some context on headless command line batch runs, see:
https://repast.github.io/docs/RepastBatchRunsGettingStarted.pdf
That doesn't align exactly with what you are trying to do, given that you are embedding the simulation run in other java code, but should help as background.
Ultimately, though the batch run code calls an InstanceRunner:
The InstanceRunner either iterates over a list of parameters sets in a file or parameter set strings passed to it directly and then performs a simulation run for each of those parameter sets. If you passed it a single parameter set, it would run once which I think is what you want to do. So, I would suggest looking at the InstanceRunner code to get a sense of how it works, and mimic InstanceRunner.main() in your code that calls the simulation.
As for the remote execution, Simphony cancopy a simulation to a remote resource, run it and copy the results back. That's integrated with the Simphony GUI and so is not callable from other code without some work on your part. All the relevant code is in:
The SSHSession class has code for executing commands on a remote resource over SSH, methods for copying files and so on. So, perhaps that might be useful to you.
QUESTION
I am experiencing an error that prevents repast simphony from running when prompted from Eclipse. Instead of running a model when prompted, the window disappears and an error message appears within Eclipse.
The steps I've followed to this point on my Mac (for repast simphony setup) are:
1) Download a Java 8 JDK from Adopt Open JDK (since I need Java 8 to use repast 3D later). Copy the package to /Library/Java/JavaVirtualMachines.
2) Download Eclipse IDE for Eclipse Committers 2019-06 and put in Applications folder.
3) Install Groovy Eclipse 3.4.0 from the update site (https://dist.springsource.org/release/GRECLIPSE/3.4.0/e4.12), and install the Eclipse Groovy development tools and the Groovy compiler 2.4 from this link in Eclipse.
4) Install repast simphony 2.7.0 from https://repocafe.cels.anl.gov/repos/repast in Eclipse.
5) Set Groovy compiler to 2.4.17 in Eclipse.
6) Import repast examples
7) Select a demonstration model (e.g., GeoZombies) and try to run.
Once I complete step 7 above, I get several console warning messages:
WARNING: An illegal reflective access operation has occurred WARNING: Illegal reflective access by com.thoughtworks.xstream.core.util.Fields (file:/Applications/Eclipse.app/Contents/Eclipse/plugins/repast.simphony.runtime_2.7.0/lib/xstream-1.4.7.jar) to field java.util.TreeMap.comparator WARNING: Please consider reporting this to the maintainers of com.thoughtworks.xstream.core.util.Fields WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations WARNING: All illegal access operations will be denied in a future release
The Java window for repast simphony opens even though this error has appeared in the Eclipse console. However, when I click the button to "Start Run" in the Java window for GeoZombies, the Java window shuts with no warning, and the Eclipse console produces the following error:
2019-12-03 11:03:46.637 java[63571:533520] * Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'NSWindow drag regions should only be invalidated on the Main Thread!' * First throw call stack: ( 0 CoreFoundation 0x00007fff3bab6acd __exceptionPreprocess + 256 1 libobjc.A.dylib 0x00007fff66193a17 objc_exception_throw + 48 2 CoreFoundation 0x00007fff3bad0629 -[NSException raise] + 9 3 AppKit 0x00007fff390765ca -[NSWindow(NSWindow_Theme) _postWindowNeedsToResetDragMarginsUnlessPostingDisabled] + 317 4 AppKit 0x00007fff390739f7 -[NSWindow _initContent:styleMask:backing:defer:contentView:] + 1479 5 AppKit 0x00007fff3907342a -[NSWindow initWithContentRect:styleMask:backing:defer:] + 45 6 libnativewindow_macosx.jnilib 0x0000000136bfdf9e Java_jogamp_nativewindow_macosx_OSXUtil_CreateNSWindow0 + 398 7 ??? 0x000000011e0f5c90 0x0 + 4799290512 ) libc++abi.dylib: terminating with uncaught exception of type NSException
I would appreciate any assistance someone can provide about how to resolve this error and get repast simphony working. Thank you.
...ANSWER
Answered 2019-Dec-04 at 17:16This appeared to be an issue with letting Eclipse know which JRE to use. Navigating to Preferences -> Java -> Installed JREs, should show which JRE Eclipse is using and you can adjust to the appropriate version there. Currently Java 8 and Java 11 can be used. For more information on software requirements for Repast Simphony, see this page: https://repast.github.io/requirements.html
QUESTION
I dont know why I get NullPointerException:
...ANSWER
Answered 2019-Nov-07 at 14:29What's actually null there? Without that its hard to tell if this is a repast question or just fixing a null pointer error. If its the latter, it should be easy enough to determine what variable is null, and then why it is so.
That said, you probably don't need this line
if you are calling it in the ContextBuilder -- just pass in the context to load_data(). That would at least avoid the context being null.Context context = ContextUtils.getContext(this);
QUESTION
Issue 1:
Below is the error I received but I have no idea where is wrong.
...ANSWER
Answered 2019-Oct-24 at 12:51You can get this error if you haven't specified a style for that agent type. For example, if you introduced a new agent type to the model and instantiated agents of that type, but hadn't specified a style for that type in the display wizard.
QUESTION
I have two types edges in my supply chain model: demand_links and supply_links. the default color is gray for all links. But I want to change the color of demand_links to red each time the attribute of the demand_link is changed (Note:the edge is the custom edge agent through edge creator). How to do this?
Below is my codes for simple test and it didn't work.
...ANSWER
Answered 2019-Sep-21 at 16:24For styling links in this way, you should follow the example in the zombies.style.LinkStyle class within the Zombies_Demo model. Here's what the relevant parts of that class look like:
QUESTION
I am previously working with Netlogo for years and I am very much getting used to developing the agent-based model based on a set of procedures. An example of supply chain simulation model structure looks like below:
...ANSWER
Answered 2019-Sep-03 at 14:42You can use priorities in your @ScheduledMethod annotations, e.g.,
QUESTION
I have a model with a lot of edges (links) between different sorts of other agents (objects). I would like to model these edges as agents where I could add attributes and schedule actions. It is helpful to see a simple example of how to do this job?
update: I followed your instructions and get an error when running the model:
...ANSWER
Answered 2019-Aug-23 at 02:20Here's an example based on the JZombies_Demo model.
First create a CustomEdge class.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install repast.simphony
You can use repast.simphony like any standard Java library. Please include the the jar files in your classpath. You can also use any IDE and you can run and debug the repast.simphony component as you would do with any other Java program. Best practice is to use a build tool that supports dependency management such as Maven or Gradle. For Maven installation, please refer maven.apache.org. For Gradle installation, please refer gradle.org .
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page