function actions = simple_velocity_lane_actions(world_state, id, goal_state, P)
% Generate feasible actions for a given world_state
%
% We consider these macro-actions (actions)
%
% -------------------------------------------------
% Name        |  Function           |      Parameters
%--------------------------------------------------
% LaneChange  | lane-changing       | lane = {left_lane, right_lane}
% Acc         | velocity tracking   | goal_state with x=inf, v = {0, v_current, v_nominal}

state = world_state.car_states(id);
road = P.roads(state.road_id);
lane = road.lanes(state.lane_id);

car = P.cars(id);

% 1) AccPolicy(current_velocity): coasting action
desired_state = set_to_center(state, P);
desired_state.x = inf;
actions(1) = init_action(P.kSpeed.Coast, @(world_state, P)acc_policy(world_state, id, desired_state, P));

% 2) AccPolicy(0): stopping Action 
if state.v > P.v_tol
  % create a goal state with zero velocity
  desired_state = set_to_center(state, P);
  desired_state.v = 0;
  desired_state.x = inf;
  actions(end+1) = init_action(P.kSpeed.Zero, @(world_state, P)acc_policy(world_state, id, desired_state, P));
end

% 3) AccPolicy(nominal_velocity)
if state.v < P.cars(id).v_nominal - P.v_tol
  % create a goal state with desired nominal velocity
  desired_state = set_to_center(state, P);
  desired_state.v = P.cars(id).v_nominal;
  desired_state.x = inf;
  actions(end+1) = init_action(P.kSpeed.Nominal, @(world_state, P)acc_policy(world_state, id, desired_state, P));
end


% 2) LangeChange(right)
% if there is room to move toward first lane
if state.lane_id > 1
  lane_id = state.lane_id - 1;
  actions(end+1) = init_action(P.kLane.Right, @(world_state, P)lane_change_policy(world_state, id, lane_id, P), ...
                               @(world_state, P)lane_change_termination(world_state, id, lane_id, P));
end   

% 3) LangeChange(left)
% if there is room to move toward last lane
if state.lane_id < length(road.lanes)
  lane_id = state.lane_id + 1;
  actions(end+1) = init_action(P.kLane.Left, @(world_state, P)lane_change_policy(world_state, id, lane_id, P), ...
                               @(world_state, P)lane_change_termination(world_state, id, lane_id, P));
end