Optimization functions
This page documents all constraint and objective functions that form the mathematical core of the transport component model.
Overview
The optimization functions are organized into several categories:
- Model Definition: Functions for creating the optimization model and defining decision variables
- Constraints: Mathematical constraints that ensure feasible and realistic solutions, covering demand coverage, vehicle sizing, infrastructure limitations, and policy restrictions
- Objective Function: The cost minimization function that drives the optimization
- Workflow Runners: High-level functions that combine constraints and objectives for specific modeling scenarios
Each constraint function adds specific mathematical relationships to the optimization model, allowing users to build models of varying complexity depending on their analysis needs. The workflow runners provide pre-configured combinations of constraints for common use cases, from simple demand coverage to complex multi-modal infrastructure planning.
Model definition
TransComp.create_model
— Functioncreate_model(data_structures, case_name::String, optimizer)
Definition of JuMP.model and adding of variables.
Arguments
data_structures
: dictionary with the input data and parsing of the input parameterscase_name::String
: name of the caseoptimizer
: optimizer to use for the model
Returns
model::JuMP.Model
: JuMP model with the variables addeddata_structures::Dict
: dictionary with the input data
TransComp.base_define_variables
— Functionbase_define_variables(model::Model, data_structures::Dict)
Defines the variables for the model.
Arguments
- model::Model: JuMP model
- data_structures::Dict: dictionary with the input data
Constraints
TransComp.constraint_demand_coverage
— Functionconstraint_demand_coverage(model::JuMP.Model, data_structures::Dict)
Creates constraint for demand coverage.
Arguments
- model::JuMP.Model: JuMP model
- data_structures::Dict: dictionary with the input data
TransComp.constraint_vehicle_sizing
— Functionconstraint_vehicle_sizing(model::JuMP.Model, data_structures::Dict)
Creates constraint for vehicle sizing.
Arguments
- model::JuMP.Model: JuMP model
- data_structures::Dict: dictionary with the input data
TransComp.constraint_vehicle_aging
— Functionconstraint_vehicle_aging(model::JuMP.Model, data_structures::Dict)
Creates constraints for vehicle aging.
Arguments
- model::JuMP.Model: JuMP model
- data_structures::Dict: dictionary with the input data
Returns
- model::JuMP.Model: JuMP model with the constraints added
TransComp.constraint_monetary_budget
— Functionconstraint_vehicle_purchase(model::JuMP.Model, data_structures::Dict)
Creates constraints for monetary budget for vehicle purchase by route.
Arguments
- model::JuMP.Model: JuMP model
- data_structures::Dict: dictionary with the input data
TransComp.constraint_fueling_infrastructure
— Functionconstraint_vehicle_purchase(model::JuMP.Model, data_structures::Dict)
Constraints for the sizing of fueling infrastructure at nodes and edges.
Arguments
- model::JuMP.Model: JuMP model
- data_structures::Dict: dictionary with the input data
TransComp.constraint_supply_infrastructure
— Functionconstraint_supply_infrastructure(model::JuMP.Model, data_structures::Dict)
Constraints for sizing of supply infrastructure at nodes and edges.
Arguments
- model::JuMP.Model: JuMP model
- data_structures::Dict: dictionary with the input data
TransComp.constraint_mode_infrastructure
— Functionconstraintmodeinfrastructure(model::JuMP.Model, data_structures::Dict)
Constraints for sizing of mode infrastructure at nodes and edges.
Arguments
- model::JuMP.Model: JuMP model
- data_structures::Dict: dictionary with the input data
TransComp.constraint_fueling_demand
— Functionconstraint_fueling_demand(model::JuMP.Model, data_structures::Dict)
Constraints for fueling demand at nodes and edges.
Arguments
- model::JuMP.Model: JuMP model
- data_structures::Dict: dictionary with the input data
TransComp.constraint_vehicle_stock_shift
— Functionconstraint_vehicle_stock_shift(model::JuMP.Model, data_structures::Dict)
Constraints for vehicle stock turnover.
Arguments
- model::JuMP.Model: JuMP model
- data_structures::Dict: dictionary with the input data
TransComp.constraint_mode_shift
— Functionconstraint_mode_shift(model::JuMP.Model, data_structures::Dict)
Constraints for the rate of the mode shfit.
Arguments
- model::JuMP.Model: JuMP model
- data_structures::Dict: dictionary with the input data
TransComp.constraint_mode_share
— Functionconstraint_mode_share(model::JuMP.Model, data_structures::Dict)
If share are given for specific modes, this function will create constraints for the share of the modes. When this constraint is active, it can be a source of infeasibility for the model as it may be not possible to reach certain mode shares due to restrictions in the shift of modes (see parametrization of parameters alphaf and betaf). Especially also when constraints for minimum/maximum mode shares are active.
Arguments
- model::JuMP.Model: JuMP model
- data_structures::Dict: dictionary with the input data
TransComp.constraint_max_mode_share
— Functionconstraint_max_mode_share(model::JuMP.Model, data_structures::Dict)
If share are given for specific modes, this function will create constraints for the share of the modes. When this constraint is active, it can be a source of infeasibility for the model as it may be not possible to reach certain mode shares due to restrictions in the shift of modes (see parametrization of parameters alphaf and betaf). Or when multiple constraints for the mode share are active.
Arguments
- model::JuMP.Model: JuMP model
- data_structures::Dict: dictionary with the input data
TransComp.constraint_min_mode_share
— Functionconstraint_min_mode_share(model::JuMP.Model, data_structures::Dict)
If share are given for specific modes, this function will create constraints for the share of the modes. When this constraint is active, it can be a source of infeasibility for the model as it may be not possible to reach certain mode shares due to restrictions in the shift of modes (see parametrization of parameters alphaf and betaf). Or when multiple constraints for the mode share are active.
Arguments
- model::JuMP.Model: JuMP model
- data_structures::Dict: dictionary with the input data
TransComp.constraint_market_share
— Functionconstraint_market_share(model::JuMP.Model, data_structures::Dict)
If share are given for specific vehicle types, this function will create constraints for the newly bought vehicle share of vehicles the modes.
Arguments
- model::JuMP.Model: JuMP model
- data_structures::Dict: dictionary with the input data
TransComp.constraint_emissions_by_mode
— Functionconstraint_emissions_by_mode(model::JuMP.Model, data_structures::Dict)
Emissions given per mode for a specific year. Attention: This constraint may be a source for infeasibility if mode or technology shift cannot be achieved due to restrictions in the shift of modes (see parametrization of parameters alphaf and betaf), or due to the lifetimes of technologies as well as the lack of available low emission or zero emission technologies.
Arguments
- model::JuMP.Model: JuMP model
- data_structures::Dict: dictionary with the input data
Objective
TransComp.objective
— Functionobjective(model::Model, data_structures::Dict)
Definition of the objective function for the optimization model.
Arguments
- model::Model: JuMP model
- data_structures::Dict: dictionary with the input data
Workflow Runners
TransComp.run_minimum_viable_case
— Functionrun_minimum_viable_case(data_structures::Dict, optimizer)
Runs the minimum viable case: creates the model, applies demand coverage constraint, and sets the objective.
Arguments
- data_structures::Dict: dictionary with the input data
- optimizer: JuMP optimizer
Returns
- model::JuMP.Model: JuMP model with constraints and objective set
- data_structures::Dict: dictionary with the input data
TransComp.run_vehicle_stock_sizing
— Functionrun_vehicle_stock_sizing(data_structures::Dict, optimizer)
Creates model, applies demand coverage and vehicle sizing constraints, and sets the objective. Output: Cost-optimal coverage of travel demand with sizing of required vehicle stock.
TransComp.run_vehicle_stock_aging
— Functionrun_vehicle_stock_aging(data_structures::Dict, optimizer)
Creates model, applies demand coverage, vehicle sizing, and vehicle aging constraints, and sets the objective. Output: Cost-optimal coverage of travel demand with sizing of required vehicle stock under the consideration of the age structure of the vehicles.
TransComp.run_constrained_technology_shift
— Functionrun_constrained_technology_shift(data_structures::Dict, optimizer)
Creates model, applies demand coverage, vehicle sizing, vehicle aging, and vehicle stock shift constraints, and sets the objective. Output: Cost-optimal coverage of travel demand with sizing of required vehicle stock under the consideration of the age structure of the vehicles and limitations on the speed of vehicle stock shift.
TransComp.run_fueling_infrastructure_sizing
— Functionrun_fueling_infrastructure_sizing(data_structures::Dict, optimizer)
Creates model, applies demand coverage, vehicle sizing, fueling demand constraints, and sets the objective. Output: Cost-optimal coverage of travel demand with sizing of required vehicle stock and expansion of fueling infrastructure.
TransComp.run_constrained_mode_shift
— Functionrun_constrained_mode_shift(data_structures::Dict, optimizer)
Creates model, applies demand coverage, vehicle sizing, mode shift constraints, and sets the objective. Output: Cost-optimal coverage of travel demand with sizing of required vehicle stock and constrained mode shift.
TransComp.run_mode_infrastructure_sizing
— Functionrun_mode_infrastructure_sizing(data_structures::Dict, optimizer)
Creates model, applies demand coverage, mode shift constraints, and sets the objective. Output: Cost-optimal coverage of travel demand under limitation of speed of shift.