To solve this optimization problem, we need to define the decision variables, objective function, and constraints based on the given information.

Let's denote:
- $x$ as the number of first-class seats.
- $y$ as the number of regular seats.

The objective is to maximize profit. The profit made from each first-class seat is $1200, and from each regular seat is $700. Thus, the total profit $P$ can be represented by the equation:
\[ P = 1200x + 700y \]

Given constraints are:
1. The total number of seats (first-class and regular) cannot exceed 300.
\[ x + y \leq 300 \]
2. At least 50 seats must be first-class.
\[ x \geq 50 \]
3. At least three times as many people prefer regular seats to first-class seats.
\[ y \geq 3x \]

To find the optimal number of tickets for each type that maximizes profit, we'll use these equations and constraints in a linear programming model implemented with Gurobi in Python.

```python
from gurobipy import *

# Create a new model
m = Model("Train_Seat_Allocation")

# Define variables
x = m.addVar(lb=0, vtype=GRB.INTEGER, name="first_class_seats")
y = m.addVar(lb=0, vtype=GRB.INTEGER, name="regular_seats")

# Objective function: Maximize profit
m.setObjective(1200*x + 700*y, GRB.MAXIMIZE)

# Constraints
m.addConstr(x + y <= 300, "total_seats")
m.addConstr(x >= 50, "first_class_minimum")
m.addConstr(y >= 3*x, "regular_to_first_class_ratio")

# Optimize model
m.optimize()

# Print solution
if m.status == GRB.OPTIMAL:
    print("Optimal solution found:")
    print(f"First-class seats: {x.x}")
    print(f"Regular seats: {y.x}")
    print(f"Total profit: ${1200*x.x + 700*y.x}")
else:
    print("No optimal solution found")
```