def __init__(
     self,
     location_set,
     nested_structure=None,
     stratum=None,
     model_name=None,
     short_name=None,
     sampler="opus_core.samplers.stratified_sampler",
     utilities="opus_core.hierarchical_linear_utilities",
     probabilities="opus_core.nl_probabilities",
     **kwargs
 ):
     AgentLocationChoiceModel.__init__(
         self,
         location_set=location_set,
         model_name=model_name,
         short_name=short_name,
         sampler=sampler,
         utilities=utilities,
         probabilities=probabilities,
         **kwargs
     )
     HierarchicalChoiceModel.create_nested_and_tree_structure(self, nested_structure, stratum, **kwargs)
     self.model_interaction = ModelInteractionHierLCM(
         self, kwargs.get("interaction_pkg", "urbansim"), self.choice_set
     )
    def __init__(self, location_set,
            sampler = "opus_core.samplers.weighted_sampler", 
            utilities = "opus_core.linear_utilities", 
            choices = "opus_core.random_choices", 
            probabilities = "opus_core.mnl_probabilities",
            estimation = "opus_core.bhhh_mnl_estimation",
            capacity_string = "vacant_residential_units",
            estimation_weight_string = "residential_units", 
            simulation_weight_string = None, # if this is None, weights are proportional to the capacity 
            number_of_agents_string = "number_of_households",
            number_of_units_string = "residential_units",            
            sample_proportion_locations = None, 
            sample_size_locations = 30, 
            estimation_size_agents = 1.0, 
            compute_capacity_flag = True, 
            filter=None,
            submodel_string = None, location_id_string = None,
            demand_string = None, # if not None, the aggregate demand for locations will be stored in this attribute
            run_config = None, estimate_config=None, debuglevel=0, dataset_pool=None,
            variable_package="urbansim",
            model_name=None,
            model_short_name=None,
            **kwargs):
        run_config = merge_resources_if_not_None(run_config, [ 
                    ("sample_proportion_locations", sample_proportion_locations), 
                    ("sample_size_locations", sample_size_locations), 
                    ("compute_capacity_flag", compute_capacity_flag),
                    ("capacity_string", capacity_string),
                    ("number_of_agents_string", number_of_agents_string),
                    ("number_of_units_string", number_of_units_string),
                    ("weights_for_simulation_string", simulation_weight_string),
                    ("demand_string", demand_string)                                                          
                                          ])
        estimate_config = merge_resources_if_not_None(estimate_config, [ 
                    ("estimation", estimation), 
                    ("sample_proportion_locations", sample_proportion_locations), 
                    ("sample_size_locations", sample_size_locations), 
                    ("estimation_size_agents", estimation_size_agents),
                    ("weights_for_estimation_string", estimation_weight_string)])         

        if model_name is not None:
            self.model_name = model_name
        if model_short_name is not None:
            self.model_short_name = model_short_name

        AgentLocationChoiceModel.__init__(self, location_set,
                                        model_name=self.model_name, 
                                        short_name=self.model_short_name, 
                                        sampler=sampler, 
                                        utilities=utilities, 
                                        probabilities=probabilities, 
                                        choices=choices, 
                                        filter=filter, 
                                        submodel_string=submodel_string,  
                                        location_id_string=location_id_string,
                                        run_config=run_config, 
                                        estimate_config=estimate_config, 
                                        debuglevel=debuglevel, dataset_pool=dataset_pool,
                                        variable_package=variable_package,
                                        **kwargs)
 def __init__(self, location_set, nested_structure=None, stratum=None, model_name=None, short_name=None,
                     sampler="opus_core.samplers.stratified_sampler", 
                     utilities="opus_core.hierarchical_linear_utilities",
                     probabilities="opus_core.nl_probabilities", **kwargs):
     AgentLocationChoiceModel.__init__(self, location_set=location_set, model_name=model_name, 
                                       short_name=short_name, sampler=sampler, utilities=utilities,
                                       probabilities=probabilities, **kwargs)
     HierarchicalChoiceModel.create_nested_and_tree_structure(self, nested_structure, stratum, **kwargs)
     self.model_interaction = ModelInteractionHierLCM(self, kwargs.get('interaction_pkg',"urbansim"), self.choice_set)
    def __init__(self, group_member, location_set, agents_grouping_attribute, model_name, short_name, **kwargs):
        """ 'group_member' is of type ModelGroupMember. 'agents_grouping_attribute' is attribute of the agent_set
        (passed to the 'run' and 'estimate' method) that is used for grouping.
        """
        self.group_member = group_member
        group_member_name = group_member.get_member_name()
        self.group_member.set_agents_grouping_attribute(agents_grouping_attribute)

        AgentLocationChoiceModel.__init__(
            self,
            location_set,
            model_name="%s %s" % (group_member_name.capitalize(), model_name),
            short_name="%s %s" % (group_member_name.capitalize(), short_name),
            **kwargs
        )
    def __init__(self, group_member, location_set, agents_grouping_attribute,
                 model_name, short_name, **kwargs):
        """ 'group_member' is of type ModelGroupMember. 'agents_grouping_attribute' is attribute of the agent_set
        (passed to the 'run' and 'estimate' method) that is used for grouping.
        """
        self.group_member = group_member
        group_member_name = group_member.get_member_name()
        self.group_member.set_agents_grouping_attribute(
            agents_grouping_attribute)

        AgentLocationChoiceModel.__init__(
            self,
            location_set,
            model_name="%s %s" % (group_member_name.capitalize(), model_name),
            short_name="%s %s" % (group_member_name.capitalize(), short_name),
            **kwargs)
    def __init__(
            self,
            location_set,
            sampler="opus_core.samplers.weighted_sampler",
            utilities="opus_core.linear_utilities",
            choices="opus_core.random_choices",
            probabilities="opus_core.mnl_probabilities",
            estimation="opus_core.bhhh_mnl_estimation",
            capacity_string="vacant_residential_units",
            estimation_weight_string="residential_units",
            simulation_weight_string=None,  # if this is None, weights are proportional to the capacity 
            number_of_agents_string="number_of_households",
            number_of_units_string="residential_units",
            sample_proportion_locations=None,
            sample_size_locations=30,
            estimation_size_agents=1.0,
            compute_capacity_flag=True,
            filter=None,
            submodel_string=None,
            location_id_string=None,
            demand_string=None,  # if not None, the aggregate demand for locations will be stored in this attribute
            run_config=None,
            estimate_config=None,
            debuglevel=0,
            dataset_pool=None,
            variable_package="urbansim"):
        run_config = merge_resources_if_not_None(
            run_config,
            [("sample_proportion_locations", sample_proportion_locations),
             ("sample_size_locations", sample_size_locations),
             ("compute_capacity_flag", compute_capacity_flag),
             ("capacity_string", capacity_string),
             ("number_of_agents_string", number_of_agents_string),
             ("number_of_units_string", number_of_units_string),
             ("weights_for_simulation_string", simulation_weight_string),
             ("demand_string", demand_string)])
        estimate_config = merge_resources_if_not_None(
            estimate_config,
            [("estimation", estimation),
             ("sample_proportion_locations", sample_proportion_locations),
             ("sample_size_locations", sample_size_locations),
             ("estimation_size_agents", estimation_size_agents),
             ("weights_for_estimation_string", estimation_weight_string)])

        AgentLocationChoiceModel.__init__(
            self,
            location_set,
            model_name=self.model_name,
            short_name=self.model_short_name,
            sampler=sampler,
            utilities=utilities,
            probabilities=probabilities,
            choices=choices,
            filter=filter,
            submodel_string=submodel_string,
            location_id_string=location_id_string,
            run_config=run_config,
            estimate_config=estimate_config,
            debuglevel=debuglevel,
            dataset_pool=dataset_pool,
            variable_package=variable_package)
Beispiel #7
0
    def __init__(self, location_set,
            sampler = "opus_core.samplers.weighted_sampler", 
            utilities = "opus_core.linear_utilities", 
            choices = "opus_core.random_choices", 
            probabilities = "opus_core.mnl_probabilities",
            estimation = "opus_core.bhhh_mnl_estimation",
            capacity_string = "clip_to_zero((parcel.parcel_acres*parcel.max_du_acre*(1-parcel.pct_undevelopable)) - (parcel.aggregate(building.non_residential_sqft)/1500.0) - parcel.aggregate(building.residential_units))",
            estimation_weight_string = "parcel_acres", 
            simulation_weight_string = None, # if this is None, weights are proportional to the capacity 
            ###number_of_agents_string = "building.residential_units",
            #number_of_units_string = "clip_to_zero((parcel.parcel_acres*parcel.max_du_acre*(1-parcel.pct_undevelopable)) - (parcel.aggregate(building.non_residential_sqft)/1500.0) - parcel.aggregate(building.residential_units))",    
            agent_units_string = "building.residential_units",            
            sample_proportion_locations = None, 
            sample_size_locations = 250, 
            estimation_size_agents = 1.0, 
            compute_capacity_flag = True, 
            filter=None,
            submodel_string = None, location_id_string = None,
            demand_string = None, # if not None, the aggregate demand for locations will be stored in this attribute
            run_config = None, estimate_config=None, debuglevel=0, dataset_pool=None,
            variable_package="urbansim",
            model_name=None,
            model_short_name=None,
            **kwargs):
        run_config = merge_resources_if_not_None(run_config, [ 
                    ("sample_proportion_locations", sample_proportion_locations), 
                    ("sample_size_locations", sample_size_locations), 
                    ("compute_capacity_flag", compute_capacity_flag),
                    ("capacity_string", capacity_string),
                    ###("number_of_agents_string", number_of_agents_string),
                    ###("number_of_units_string", number_of_units_string),
                    ("agent_units_string", agent_units_string),
                    ("weights_for_simulation_string", simulation_weight_string),
                    ("demand_string", demand_string),
                    ("lottery_max_iterations", 20)
                                          ])
        estimate_config = merge_resources_if_not_None(estimate_config, [ 
                    ("estimation", estimation), 
                    ("sample_proportion_locations", sample_proportion_locations), 
                    ("sample_size_locations", sample_size_locations), 
                    ("estimation_size_agents", estimation_size_agents),
                    ("weights_for_estimation_string", estimation_weight_string)])         

        if model_name is not None:
            self.model_name = model_name
        if model_short_name is not None:
            self.model_short_name = model_short_name

        AgentLocationChoiceModel.__init__(self, location_set,
                                        model_name=self.model_name, 
                                        short_name=self.model_short_name, 
                                        sampler=sampler, 
                                        utilities=utilities, 
                                        probabilities=probabilities, 
                                        choices=choices, 
                                        filter=filter, 
                                        submodel_string=submodel_string,  
                                        location_id_string=location_id_string,
                                        run_config=run_config, 
                                        estimate_config=estimate_config, 
                                        debuglevel=debuglevel, dataset_pool=dataset_pool,
                                        variable_package=variable_package,
                                        **kwargs)