Re: [UrbanSim-Users] HLCM, use sample with replacement

From: brian voigt <brian.voigt_at_uvm.edu>
Date: Thu, 06 Mar 2008 16:11:29 -0500

thanks Liming. Can you tell me where I can change from the existing
sampling method to the sample with replacement? Does sample with
replacement mean that if a unit is not selected by a household that it
is then returned to the pool of potential choices (and therefore
available to another household via their choice set)?
brian

Liming Wang wrote:
> Brian,
> This is likely caused by running out vacant residential units. Because
> HLCM samples gridcells weighted by vacant_residential_units, this will
> create a zero-division when the weight is zero. Either because of
> strict development constraints or sudden increase of households, the
> developer model is not building enough residential units for
> households for the simulation year.
>
> Liming.
>
> On Thu, Mar 6, 2008 at 10:11 AM, Brian Miles <Brian.Miles_at_uvm.edu
> <mailto:Brian.Miles_at_uvm.edu>> wrote:
>
>
> Hello,
>
> We're seeing the following error in the seventh iteration of our HLCM:
>
> HLCM chunk 4 out of 12.: started on Thu Mar 06 08:07:45 2008
> Number of agents in this chunk: 56
> urbansim.gridcell.vacant_residential_units
>
> urbansim.gridcell.number_of_households...........0.0 sec
> urbansim.gridcell.vacant_residential_units:
> completed...0.0 sec
> Available capacity: 0 units.
> Sampling locations ...
> WARNING: weight_array sums to 0 or less
> WARNING: weight array dosen't have enough non-zero
> counts, use sample with replacement
> WARNING: prob_array doesn't sum up to 1, and is
> normalized. Sum: 0.0
> HLCM chunk 4 out of 12.:
> completed.......................0.0 sec
>
> (full stack trace is below)
>
> We were able to get our simulation past this error and to run beyond
> the seventh year, all the way to the 10th, by adding five residential
> units to all gridcells with non-zero residential units.
>
> But we don't know what the error "weight array dosen't have enough
> non-
> zero counts, use sample with replacement"--thrown by
> opus_core.samplers.weighted_sampler--means. It seems to be telling us
> to try setting some option, but I'm not sure.
>
> How should we interpret this error?
>
> Thanks,
>
> Brian
>
>
> Number of unplaced agents: 45 (in 2 iterations)
> HLCM chunk 3 out of 12.:
> completed.......................0.6 sec
> HLCM chunk 4 out of 12.: started on Thu Mar 06
> 08:07:45 2008
> Number of agents in this chunk: 56
> urbansim.gridcell.vacant_residential_units
>
> urbansim.gridcell.number_of_households...........0.0 sec
> urbansim.gridcell.vacant_residential_units:
> completed...0.0 sec
> Available capacity: 0 units.
> Sampling locations ...
> WARNING: weight_array sums to 0 or less
> WARNING: weight array dosen't have enough non-zero
> counts, use sample with replacement
> WARNING: prob_array doesn't sum up to 1, and is
> normalized. Sum: 0.0
> HLCM chunk 4 out of 12.:
> completed.......................0.0 sec
> Running Household Location Choice Model (from
> urbansim.models.household_location_choice_model): completed...18.8 sec
> Simulate year 1997: completed.............................1
> min, 3.7 sec
> Closing log file: C://urbansim_cache
> \run_63.2008_03_06_07_59\year_1997_log.txt
> Starting simulation for year 1997: completed..................1
> min, 3.7 sec
> Start simulation run: completed...................................1
> min, 3.7 sec
> Closing log file: C://urbansim_cache
> \run_63.2008_03_06_07_59\run_multiprocess.log
> Traceback (most recent call last):
> File "C:\opusworkspace-svn\urbansim\model_coordinators
> \model_system.py", line 532, in <module>
> s.run(resources)
> File "C:\opusworkspace-svn\urbansim\model_coordinators
> \model_system.py", line 135, in run
>
> write_datasets_to_cache_at_end_of_year
> =write_datasets_to_cache_at_end_of_year)
> File "C:\opusworkspace-svn\urbansim\model_coordinators
> \model_system.py", line 299, in _run_year
> self.vardict[outputvar] = self.do_process(locals())
> File "C:\opusworkspace-svn\urbansim\model_coordinators
> \model_system.py", line 377, in do_process
> return eval(ev)
> File "<string>", line 1, in <module>
> File "C:\opusworkspace-svn\opus_core\model.py", line 48, in
> logged_run_method
> results = run_method(*req_args, **opt_args)
> File "C:\opusworkspace-svn\opus_core\configurable.py", line 38, in
> config_run_method
> results = run_method(*req_args, **opt_args)
> File "C:\opusworkspace-svn\urbansim\models
> \agent_location_choice_model.py", line 88, in run
> agents_index[unplaced], chunk_specification, debuglevel=debuglevel)
> File "C:\opusworkspace-svn\urbansim\models
> \location_choice_model.py", line 123, in run
> debuglevel=debuglevel)
> File "C:\opusworkspace-svn\opus_core\choice_model.py", line 142, in
> run
> specification=specification, coefficients=coefficients)
> File "C:\opusworkspace-svn\opus_core\chunk_model.py", line 72, in run
> dataset, **kwargs).astype(result_array_type)
> File "C:\opusworkspace-svn\urbansim\models
> \agent_location_choice_model.py", line 101, in run_chunk
> result = LocationChoiceModel.run_chunk(self, agents_index,
> agent_set, specification, coefficients)
> File "C:\opusworkspace-svn\urbansim\models
> \location_choice_model.py", line 144, in run_chunk
> choices = ChoiceModel.run_chunk(self,agents_index, agent_set,
> specification, coefficients)
> File "C:\opusworkspace-svn\opus_core\choice_model.py", line 152, in
> run_chunk
> index = self.get_choice_index(agent_set, agents_index, agentsubset)
> File "C:\opusworkspace-svn\urbansim\models
> \location_choice_model.py", line 270, in get_choice_index
> weight=self.weights, resources=self.run_config)
> File "C:\opusworkspace-svn\opus_core\configurable.py", line 38, in
> config_run_method
> results = run_method(*req_args, **opt_args)
> File "C:\opusworkspace-svn\opus_core\samplers\weighted_sampler.py",
> line 103, in run
> replace=replace, return_indices=True )
> File "C:\opusworkspace-svn\opus_core\sampling_toolbox.py", line 284,
> in prob2dsample
> cum_prob = ncumsum(p_array)
> File "C:\opusworkspace-svn\opus_core\misc.py", line 515, in ncumsum
> str(prob_array.sum(axis=axis, dtype=dtype))
> ValueError: The probability array must sum up to 1. It is -1.#IND
> Running UrbanSim for year 1997 in new process: completed..........1
> min, 5.5 sec
> Traceback (most recent call last):
> File "start_run.py", line 84, in <module>
> run_manager.run_run(config, run_as_multiprocess =
> run_as_multiprocess)
> File "C:\opusworkspace-svn\opus_core\services\run_server
> \run_manager.py", line 183, in run_run
> raise SimulationRunError
> opus_core.services.run_server.run_manager.SimulationRunError
> _______________________________________________
> Users mailing list
> Users_at_urbansim.org <mailto:Users_at_urbansim.org>
> http://www.urbansim.org/mailman/listinfo/users
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Users mailing list
> Users_at_urbansim.org
> http://www.urbansim.org/mailman/listinfo/users
>
Received on Thu Mar 06 2008 - 13:11:40 PST

This archive was generated by hypermail 2.2.0 : Thu Mar 06 2008 - 13:11:41 PST