The rail freight carload service segment enables the distribution of freight volumes down to the unit of single rail cars, and stand as an important alternative to road transportation. However, this service segment is often associated with significant uncertainties and variations in daily freight volumes. Such uncertainties are challenging to manage since operating plans generally are established long in advance of operations. Flexibility can instead be found in the way trip plans are generated. Previous research has shown that a commonly used trip plan generation policy does not exploit the available flexibility to the full extent. In this paper, we therefore suggest an optimization-based freight routing and scheduling (OFRS) policy to address the rail freight trip plan generation problem. This OFRSpolicy generates trip plans for rail cars while still restricted by the customer commitments. The policy involves a MIP formulation with a continuous time representation and is solved by commercial software. We apply the OFRS-policy on a case built on real data provided by the Swedish rail freight operator, Green Cargo, and assess the performance of the policy comparing the current industry practice. The results show that by using the OFRS policy, we can achieve a reduction in the total transportation times, number of shunting activities and potentially also a reduction in the service frequency given the considered transport demand. *Corresponding author (lars.backaker@liu.se, +46 (0) 11363481) Keywords: Rail freight planning, trip plan generation, routing and scheduling, dynamic assignmentIn this paper, we therefore suggest an optimization-based freight routing and scheduling (OFRS) policy to deal with the rail freight trip plan generation problem. The OFRS-policy routes and schedules rail cars onto available train services freely while still restricted by the customer commitments (e.g. agreed delivery time frames) and service characteristics (e.g. departure times and capacity limits). The policy involves a Mixed Integer Linear Programming (MILP) formulation which is solved by commercial optimization software. In contrast to previous models, our MILP-formulation has a continuous time representation which enables a more detailed representation of the service network and reduces the number of required binary variables. We apply the OFRS-policy on a case built on real data provided by the Swedish rail freight operator, Green Cargo. We also assess the performance of the OFRS-policy in a benchmark with the industry practice currently used by Green Cargo for the trip plan generation.The structure of the paper is as follows; in Section 2 we provide an introduction to the rail freight planning and distribution process, and existing rail car priority principles. In Section 3, we provide an overview and discussion of related work followed by Section 4, which presents our proposed optimization-based dynamic trip plan generation policy (OFRS). In Section 5, we outline our experiments and the results are presented and discussed i...