gama-platform / gama.old

Main repository for developing the 1.x versions of GAMA
GNU General Public License v3.0
304 stars 99 forks source link

Urbanization and Traffic Comodel : NPE at launch #2359

Closed benoitgaudou closed 6 years ago

benoitgaudou commented 6 years ago

Steps to reproduce

  1. Launch the model: Library models / Toy Models / Comodels / Urbanization and Traffic Comodel

  2. A NPE appears (even before the first step)

Expected behavior

No NPE

Actual behavior

The following NPE appears:

mars 17, 2018 10:54:13 PM org.geotools.gce.arcgrid.ArcGridReader <init>
AVERTISSEMENT: Using default coordinate reference system 
mars 17, 2018 10:54:28 PM org.geotools.gce.arcgrid.ArcGridReader <init>
AVERTISSEMENT: Using default coordinate reference system 
java.lang.NullPointerException
    at msi.gama.metamodel.shape.GamaProxyGeometry.euclidianDistanceTo(GamaProxyGeometry.java:310)
    at msi.gama.metamodel.agent.AbstractAgent.euclidianDistanceTo(AbstractAgent.java:131)
    at msi.gama.metamodel.topology.continuous.ContinuousTopology.distanceBetween(ContinuousTopology.java:122)
    at msi.gaml.operators.Spatial$Relations.distance_to(Spatial.java:2901)
    at gaml.additions.GamlAdditions$670.run(GamlAdditions.java:733)
    at gaml.additions.GamlAdditions$670.run(GamlAdditions.java:1)
    at msi.gaml.expressions.BinaryOperator.value(BinaryOperator.java:77)
    at msi.gaml.operators.Spatial$Common.using(Spatial.java:144)
    at gaml.additions.GamlAdditions$810.run(GamlAdditions.java:873)
    at msi.gaml.expressions.BinaryOperator.value(BinaryOperator.java:77)
    at msi.gaml.statements.SetStatement.privateExecuteIn(SetStatement.java:118)
    at msi.gaml.statements.AbstractStatement.executeOn(AbstractStatement.java:41)
    at msi.gaml.statements.AbstractStatementSequence.privateExecuteIn(AbstractStatementSequence.java:57)
    at msi.gaml.statements.AbstractStatementSequenceWithArgs.privateExecuteIn(AbstractStatementSequenceWithArgs.java:57)
    at msi.gaml.statements.AbstractStatement.executeOn(AbstractStatement.java:41)
    at msi.gaml.statements.AbstractStatementSequence.executeOn(AbstractStatementSequence.java:43)
    at msi.gaml.statements.DoStatement.privateExecuteIn(DoStatement.java:249)
    at msi.gaml.statements.AbstractStatement.executeOn(AbstractStatement.java:41)
    at msi.gaml.statements.AbstractStatementSequence.executeOn(AbstractStatementSequence.java:43)
    at msi.gaml.statements.AbstractStatementSequence.privateExecuteIn(AbstractStatementSequence.java:57)
    at msi.gaml.statements.RemoteSequence.privateExecuteIn(RemoteSequence.java:45)
    at msi.gaml.statements.AbstractStatement.executeOn(AbstractStatement.java:41)
    at msi.gaml.statements.AbstractStatementSequence.executeOn(AbstractStatementSequence.java:43)
    at msi.gama.runtime.ExecutionScope.execute(ExecutionScope.java:380)
    at msi.gama.runtime.concurrent.GamaExecutorService.execute(GamaExecutorService.java:201)
    at msi.gama.runtime.concurrent.GamaExecutorService.execute(GamaExecutorService.java:216)
    at msi.gaml.statements.AskStatement.privateExecuteIn(AskStatement.java:126)
    at msi.gaml.statements.AbstractStatement.executeOn(AbstractStatement.java:41)
    at msi.gaml.statements.AbstractStatementSequence.executeOn(AbstractStatementSequence.java:43)
    at msi.gaml.statements.AbstractStatementSequence.privateExecuteIn(AbstractStatementSequence.java:57)
    at msi.gaml.architecture.reflex.ReflexStatement.privateExecuteIn(ReflexStatement.java:80)
    at msi.gaml.statements.AbstractStatement.executeOn(AbstractStatement.java:41)
    at msi.gaml.statements.AbstractStatementSequence.executeOn(AbstractStatementSequence.java:43)
    at msi.gaml.architecture.reflex.ReflexArchitecture.init(ReflexArchitecture.java:112)
    at msi.gama.metamodel.agent.AbstractAgent.init(AbstractAgent.java:238)
    at msi.gama.metamodel.agent.MinimalAgent._init_(MinimalAgent.java:242)
    at msi.gama.kernel.simulation.SimulationAgent._init_(SimulationAgent.java:293)
    at msi.gaml.statements.CreateStatement.createAgents(CreateStatement.java:485)
    at msi.gaml.statements.CreateStatement.privateExecuteIn(CreateStatement.java:434)
    at msi.gaml.statements.CreateStatement.privateExecuteIn(CreateStatement.java:1)
    at msi.gaml.statements.AbstractStatement.executeOn(AbstractStatement.java:41)
    at msi.gaml.statements.AbstractStatementSequence.executeOn(AbstractStatementSequence.java:43)
    at msi.gaml.statements.AbstractStatementSequence.privateExecuteIn(AbstractStatementSequence.java:57)
    at msi.gaml.architecture.reflex.ReflexStatement.privateExecuteIn(ReflexStatement.java:80)
    at msi.gaml.statements.AbstractStatement.executeOn(AbstractStatement.java:41)
    at msi.gaml.statements.AbstractStatementSequence.executeOn(AbstractStatementSequence.java:43)
    at msi.gaml.architecture.reflex.ReflexArchitecture.init(ReflexArchitecture.java:112)
    at msi.gama.metamodel.agent.AbstractAgent.init(AbstractAgent.java:238)
    at msi.gama.metamodel.agent.MinimalAgent._init_(MinimalAgent.java:242)
    at msi.gama.kernel.simulation.SimulationAgent._init_(SimulationAgent.java:293)
    at msi.gama.metamodel.agent.MinimalAgent.init(MinimalAgent.java:206)
    at msi.gama.runtime.ExecutionScope.lambda$3(ExecutionScope.java:435)
    at msi.gama.runtime.ExecutionScope.runAndCatch(ExecutionScope.java:459)
    at msi.gama.runtime.ExecutionScope.pushRunAndCatch(ExecutionScope.java:450)
    at msi.gama.runtime.ExecutionScope.init(ExecutionScope.java:435)
    at msi.gama.metamodel.agent.AbstractAgent.schedule(AbstractAgent.java:357)
    at msi.gama.kernel.simulation.SimulationAgent.schedule(SimulationAgent.java:270)
    at msi.gama.kernel.simulation.SimulationPopulation.initSimulation(SimulationPopulation.java:112)
    at msi.gama.kernel.simulation.SimulationPopulation.createAgents(SimulationPopulation.java:92)
    at msi.gama.kernel.experiment.ExperimentAgent.createSimulation(ExperimentAgent.java:286)
    at msi.gama.kernel.experiment.ExperimentAgent._init_(ExperimentAgent.java:241)
    at msi.gama.metamodel.agent.MinimalAgent.init(MinimalAgent.java:206)
    at msi.gama.kernel.experiment.ExperimentAgent.init(ExperimentAgent.java:253)
    at msi.gama.runtime.ExecutionScope.lambda$3(ExecutionScope.java:435)
    at msi.gama.runtime.ExecutionScope.runAndCatch(ExecutionScope.java:459)
    at msi.gama.runtime.ExecutionScope.pushRunAndCatch(ExecutionScope.java:450)
    at msi.gama.runtime.ExecutionScope.init(ExecutionScope.java:435)
    at msi.gama.kernel.experiment.ExperimentScheduler.schedule(ExperimentScheduler.java:161)
    at msi.gama.kernel.experiment.ExperimentAgent.schedule(ExperimentAgent.java:306)
    at msi.gama.kernel.experiment.ExperimentPlan.open(ExperimentPlan.java:476)
    at msi.gama.kernel.experiment.ExperimentController.lambda$0(ExperimentController.java:90)
    at java.lang.Thread.run(Thread.java:748)

System and version

MACOSX, GAMA Git MArs & preRelease

benoitgaudou commented 6 years ago

After digging a little bit, it seems related to the fix of the issue #2324 . It was itself related to the fix of issue #2239.

Any idea on how to kill these 3 issues with one stone ?

hqnghi88 commented 6 years ago

I have big big impression on the comment of Alexis about 2 different size environment "the results are unexpected when the sizes of the different environments (i.e. the shapes in which the topologies are defined) are different. To be frank, I havent tested it yet, and I wonder what would happen if you merge a micro-model in a 1000x1000 environment into a macro-model with a 10x10 environment..." In this comodel, urban and traffic have different size environement

hqnghi88 commented 6 years ago

This issue have the same phenomenon with the case that raster.gaml dont have right projection, i.e temove the prj of asc file. So it make me feel the current comodeling works but there is a case did not take into account. I try with some projection/topology now.

benoitgaudou commented 6 years ago

Note that I also tried to change the file setting the shape of the main model (I use the road shapefile of the other imported model). In this case, I do not have the exception anymore...

hqnghi88 commented 6 years ago

To conclude, i have commit the workaround for this NPE in this model. It still have the problem of scaling environment of different size (in fact, the grid topology did not work, for continuous topology can be manipulate in init, but the grid did not have that mechanism, once simulation is initialized).