Re: [UrbanSim-Users] San Francisco business model

From: Zuccarello Philippe <philippe.zuccarello_at_wanadoo.fr>
Date: Wed, 30 Jan 2008 10:44:47 -0000

Hi,

I continue to investigate to business and building models of sanfrancisco
project I take as sample...

** business models 'business_relocation_model' and
'business_location_choice_model'
In order to run this models I need to create the tables :
    business,
    annual_business_control_totals,
    annual_relocation_rates_for_business
    business_location_choice_model_specification
    business_location_choice_model_coefficients
I do this and the models run well.

and need to alter the buildings table to add attributes :
    non_residential_sqft, occupied_sqft, building_sqft, building_use_id

** building models 'building_transition_model' and
'building_location_choice_model'
For run this models I need to create the tables :
    parcels
    nonresidential_building_location_choice_model_coefficients
    nonresidential_building_location_choice_model_specification
    residential_building_location_choice_model_coefficients
    residential_building_location_choice_model_specification

Is it possible to have a database create statement of tables, You can use
the following MySql command to do this :

mysqldump --no-data --host=localhost --user=root --password={root password}
{database name} >describe_all_tables.sql

I will appreciate if table columns have comments for having a small
description. At least It can help me for main tables business, buildings and
parcels.

Like this for business table :

CREATE TABLE `business` (
  `business_id` int(32) default NULL COMMENT 'unique identifier of
business',
  `building_id` int(32) default NULL COMMENT 'Buiding ID',
  `sector_id` int(32) default NULL COMMENT 'Sector ID, linked with
employment_sectors or sectors table ?',
  `sqft` int(32) default NULL COMMENT 'surface for ... ?',
  `employment` int(32) default NULL COMMENT 'number of employement for
matching building/sector'
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

As sample, can I have a dump of annual_..., ..._model_coefficients,
..._model_specification tables (a mysqldump or csv data files could be
nice)
You can use the following MySql commands to do this :

mysqldump --host=localhost --user=root --password={root password} {database
name} annual_business_control_totals annual_relocation_rates_for_business
business_location_choice_model_specification
business_location_choice_model_coefficients >some_business_tables_data.sql

mysqldump --host=localhost --user=root --password={root password} {database
name} building_use building_use_classification
nonresidential_building_location_choice_model_coefficients
nonresidential_building_location_choice_model_specification
residential_building_location_choice_model_coefficients
residential_building_location_choice_model_specification
>some_buildings_tables_data.sql

Are the ProcessPipelineEvents, real_estate_price_model models are mandatory
to run the building model ?

Finaly the model building_location_choice_model stop with error :
Traceback (most recent call last):

File
"C:\Dev\_eclipse_workspace\Urbansim41\opus-4.1\urbansim\model_coordinators\m
odel_system.py", line 576, in <module>

s.run(resources)

File
"C:\Dev\_eclipse_workspace\Urbansim41\opus-4.1\urbansim\model_coordinators\m
odel_system.py", line 137, in run

write_datasets_to_cache_at_end_of_year=write_datasets_to_cache_at_end_of_yea
r)

File
"C:\Dev\_eclipse_workspace\Urbansim41\opus-4.1\urbansim\model_coordinators\m
odel_system.py", line 352, in _run_year

model = self.do_init(locals())

File
"C:\Dev\_eclipse_workspace\Urbansim41\opus-4.1\urbansim\model_coordinators\m
odel_system.py", line 403, in do_init

self.construct_arguments_from_config(init_config)))

File "<string>", line 1, in <module>

TypeError: __init__() takes at least 3 non-keyword arguments (1 given)

Running UrbanSim for year 1981 in new process: completed........12 min, 54.6
sec

Traceback (most recent call last):

File
"C:\Dev\_eclipse_workspace\Urbansim41\opus-4.1\opus_core\tools\start_run.py"
, line 75, in <module>

run_manager.run_run(config)

File
"C:\Dev\_eclipse_workspace\Urbansim41\opus-4.1\opus_core\services\run_server
\run_manager.py", line 160, in run_run

model_system.run_multiprocess(run_resources)

File
"C:\Dev\_eclipse_workspace\Urbansim41\opus-4.1\urbansim\model_coordinators\m
odel_system.py", line 484, in run_multiprocess

'urbansim.model_coordinators.model_system', resources)

File
"C:\Dev\_eclipse_workspace\Urbansim41\opus-4.1\opus_core\fork_process.py",
line 53, in fork_new_process

raise StandardError("Problem with %s" % module_name)

StandardError: Problem with urbansim.model_coordinators.model_system

The __init__ method fail for the class BuildingLocationChoiceModel of source
file models/building_location_choice_model.py.

Regards,
Philippe Zuccarello.

  -----Message d'origine-----
  De : Zuccarello Philippe [mailto:philippe.zuccarello_at_wanadoo.fr]
  Envoyé : mercredi 9 janvier 2008 12:00
  À : users_at_urbansim.org; Liming Wang
  Objet : RE: [UrbanSim-Users] San Francisco business model

  Hi,

  I progress since yesterday.

  The transition model run but not the location choice model.

  For the location choice model, Iinitialized the
annual_relocation_rates_for_business,
business_location_choice_model_coefficients and
business_location_choice_model_specification tables with dummy values, is it
possible to have a data dump of this ?.

  CREATE TABLE annual_relocation_rates_for_business
  (
  sector_id int(32) default NULL,
  business_relocation_probability double default NULL
  ) ENGINE=MyISAM DEFAULT CHARSET=utf8;

  CREATE TABLE business_location_choice_model_specification
  (
  sub_model_id int(32) default NULL,
  equation_id int(32) default NULL,
  coefficient_name text default NULL,
  variable_name text default NULL
  ) ENGINE=MyISAM DEFAULT CHARSET=utf8;

  CREATE TABLE business_location_choice_model_coefficients
  (
  t_statistic double default NULL,
  sub_model_id int(32) default NULL,
  estimate double default NULL,
  coefficient_name text default NULL,
  standard_error double default NULL
  ) ENGINE=MyISAM DEFAULT CHARSET=utf8;

  My last error is:
  File
"C:\Dev\_eclipse_workspace\Urbansim41\opus-4.1\urbansim\models\location_choi
ce_model.py", line 135, in run_chunk

  self.capacity = ma.filled(self.determine_units_capacity(agent_set,
agents_index), 0.0)

  File
"C:\Dev\_eclipse_workspace\Urbansim41\opus-4.1\urbansim\models\location_choi
ce_model.py", line 204, in determine_units_capacity

  capacity = self.choice_set.compute_variables(self.capacity_string,
dataset_pool=self.dataset_pool, resources=resources)

  File
"C:\Dev\_eclipse_workspace\Urbansim41\opus-4.1\opus_core\datasets\abstract_d
ataset.py", line 336, in compute_variables

  (versions, value) =
self.compute_variables_return_versions_and_final_value(names, dataset_pool,
resources, quiet)

  File
"C:\Dev\_eclipse_workspace\Urbansim41\opus-4.1\opus_core\datasets\abstract_d
ataset.py", line 363, in compute_variables_return_versions_and_final_value

  resources=resources, quiet=quiet, version=version))

  File
"C:\Dev\_eclipse_workspace\Urbansim41\opus-4.1\opus_core\datasets\abstract_d
ataset.py", line 1169, in _compute_if_needed

  return self._compute_one_variable(variable_name, dataset_pool,
resources=resources, quiet=quiet)

  File
"C:\Dev\_eclipse_workspace\Urbansim41\opus-4.1\opus_core\datasets\abstract_d
ataset.py", line 1102, in _compute_one_variable

  index_name=id_name)

  File
"C:\Dev\_eclipse_workspace\Urbansim41\opus-4.1\opus_core\variables\variable_
factory.py", line 65, in get_variable

  % (dataset_name, short_name))

  LookupError: Incomplete variable specification for
'building.non_residential_sqft' (missing package name).

  Running UrbanSim for year 1981 in new process:
completed................23.0 sec

  Traceback (most recent call last):

  File
"C:\Dev\_eclipse_workspace\Urbansim41\opus-4.1\opus_core\tools\start_run.py"
, line 75, in <module>

  run_manager.run_run(config)

  Thanks in advance for your Help.

  Philippe ZUCCARELLO

    -----Message d'origine-----
    De : Philippe ZUCCARELLO [mailto:philippe.zuccarello_at_wanadoo.fr]
    Envoyé : vendredi 2 février 2007 10:35
    À : users_at_urbansim.org; Liming Wang
    Objet : Re: [UrbanSim-Users] San Francisco business model

    Liming,

    Thanks a lot for your help. I understand the confidentiality reason for
SanFrancisco data.

    ** Data model
    That about the other tables ?

    Table business:
    business_id int(32) default NULL,
    building_id int(32) default NULL,
    sector_id int(32) default NULL, -- link with employment_sectors or
sectors table ?
    sqft int(32) default NULL,
    employment int(32) default NULL

    Table annual_business_control_totals:
        year int(32) default NULL,
        sector_id int(32) default NULL,
        total_number_of_businesses int(32) default NULL

    Table parcels:
        parcel_id int(32) default NULL,
        zone_id int(32) default NULL

    Table sectors : is if usefull ? (It seams that Py script use directly
sector_id of business table to do agregation)

    Table business_for_estimation : not initialized at this time.

    Table persons : not initialized at this time.

    Table business_location_choice_model_coefficients : not initialized at
this time.

    Table business_location_choice_model_specification : not initialized at
this time.

    Do I need to use SQL script located in sanfrancisco\sql directory ?
(update buildings ...)

    ** Project Python scripts

    I can progress adding the "datasets_to_preload" settings in my
baseline.py file.

    Now I have an other error :
    ...
     File
"C:\Dev\_eclipse_workspace\Urbansim41\lyonprototype41\models\business_transi
tion_model.py", line 56, in run
        resources = compute_resources)
      File
"C:\Dev\_eclipse_workspace\Urbansim41\opus-4.1\opus_core\datasets\abstract_d
ataset.py", line 336, in compute_variables
        (versions, value) =
self.compute_variables_return_versions_and_final_value(names, dataset_pool,
resources, quiet)
      File
"C:\Dev\_eclipse_workspace\Urbansim41\opus-4.1\opus_core\datasets\abstract_d
ataset.py", line 363, in compute_variables_return_versions_and_final_value
        resources=resources, quiet=quiet, version=version))
      File
"C:\Dev\_eclipse_workspace\Urbansim41\opus-4.1\opus_core\datasets\abstract_d
ataset.py", line 1169, in _compute_if_needed
        return self._compute_one_variable(variable_name, dataset_pool,
resources=resources, quiet=quiet)
      File
"C:\Dev\_eclipse_workspace\Urbansim41\opus-4.1\opus_core\datasets\abstract_d
ataset.py", line 1102, in _compute_one_variable
        index_name=id_name)
      File
"C:\Dev\_eclipse_workspace\Urbansim41\opus-4.1\opus_core\variables\variable_
factory.py", line 83, in get_variable
        (true_short_name, directory_path, time))
    NameError: Opus variable 'is_of_sector_DDD' does not exist for dataset
'lyonprototype41.business' in year 1981
    Running UrbanSim for year 1981 in new process:
completed.................2.8 sec
    Traceback (most recent call last):
    ...

    Note the script business\is_of_sector_DDD.py is installed in my Project.
I think the reason is other, data perhaps.

    Regards,
    Philippe.

      ----- Original Message -----
      From: Liming Wang
      To: users_at_urbansim.org
      Sent: Tuesday, January 08, 2008 9:41 AM
      Subject: Re: [UrbanSim-Users] San Francisco business model

      Zuccarello,

      You encountered the error because business table hasn't been loaded
into the memory at the point of running business transition model. To fix
this problem, add this line

      'business':{'package_name':'sanfrancisco'},

      to the "datasets_to_preload" dictionary in your configuration file.
You can refer to baseline.py in sanfrancisco/configs.

      Unfortunately, the Sanfrancisco business table is confidential thus we
cannot provide it. But its main columns are as below:

      business_id, int(11)
      building_id, int(11)
      sector_id, int(11)
      sqft, double
      employment, int(11)

      where the business_id is its id field.

      Liming.

      On Jan 7, 2008 11:17 PM, Zuccarello Philippe <
philippe.zuccarello_at_wanadoo.fr> wrote:

        Hi All,

        First have a happy new Year 2008 !

        For this begin of Year, I try to implement the "business" model
existing in
        sanfrancisco project in SVN (opus_trunk\sanfrancisco\models).
        I start to initiate some of the necessary tables data (business,
        annual_business_control_totals, parcels,sectors ...) but not all,
for this
        my alone solution it to look the Python code because I don't find
Sql script
        in the project sql directoy for create them.

        At this time, I block with the following error for the
        business_transition_model :

        ...
        Traceback (most recent call last):
         File
        "C:\Dev\_eclipse_workspace\Urbansim41\opus-4.1\urbansim\model_coordi
nators\m
        odel_system.py", line 572, in <module>
           s.run(resources)
         File
        "C:\Dev\_eclipse_workspace\Urbansim41\opus-4.1\urbansim\model_coordi
nators\m
        odel_system.py", line 137, in run
           write_datasets_to_cache_at_end_of_year=write_datasets_to_cache_at
_end_of
        _year)
         File
        "C:\Dev\_eclipse_workspace\Urbansim41\opus-4.1\urbansim\model_coordi
nators\m
        odel_system.py", line 363, in _run_year
           self.vardict[outputvar] = self.do_process(locals())
         File
        "C:\Dev\_eclipse_workspace\Urbansim41\opus-4.1\urbansim\model_coordi
nators\m
        odel_system.py", line 441, in do_process
           return eval(ev)
         File "<string>", line 1, in <module>
        NameError: name 'business' is not defined
        ...

        Probably reason of my small input data that are not sufficient for
run the
        simulation correctly.

        It should be very helpfull for me, if I can have a description of
the
        "business" data model or a sample of San Francisco baseyear_cache
directory
        data like the eugene_1980_baseyear_cache_version_4_1_2.zip we can
download
        from the http://www.urbansim.org/download/ page.

        Regards and thanks in advance for your Help,

        Philippe ZUCCARELLO.
        PS: I work for Fabrice Marchal Team.

        _______________________________________________
        Users mailing list
        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 Wed Jan 30 2008 - 01:47:02 PST

This archive was generated by hypermail 2.2.0 : Wed Jan 30 2008 - 07:58:40 PST