44 lines
1.8 KiB
Plaintext
44 lines
1.8 KiB
Plaintext
Base controller path: /home/judson/Neural-Networks-in-GNC/inverted_pendulum/training/controller_base.pth
|
|
Time Span: 0 to 10, Points: 1000
|
|
Learning Rate: 0.1
|
|
Weight Decay: 0.0001
|
|
|
|
Loss Function:
|
|
def loss_fn(state_traj, t_span):
|
|
theta = state_traj[:, :, 0] # Size: [batch_size, t_points]
|
|
desired_theta = state_traj[:, :, 3] # Size: [batch_size, t_points]
|
|
weights = weight_fn(t_span) # Initially Size: [t_points]
|
|
|
|
# Reshape or expand weights to match theta dimensions
|
|
weights = weights.view(-1, 1) # Now Size: [batch_size, t_points]
|
|
|
|
# Calculate the weighted loss
|
|
return torch.mean(weights * (theta - desired_theta) ** 2)
|
|
|
|
Weight Description: Inverse cubed weight: Weights decrease inversely cubed, normalized by the average weight
|
|
|
|
Training Cases:
|
|
[theta0, omega0, alpha0, desired_theta]
|
|
[0.5235987901687622, 0.0, 0.0, 0.0]
|
|
[-0.5235987901687622, 0.0, 0.0, 0.0]
|
|
[2.094395160675049, 0.0, 0.0, 0.0]
|
|
[-2.094395160675049, 0.0, 0.0, 0.0]
|
|
[0.0, 1.0471975803375244, 0.0, 0.0]
|
|
[0.0, -1.0471975803375244, 0.0, 0.0]
|
|
[0.0, 6.2831854820251465, 0.0, 0.0]
|
|
[0.0, -6.2831854820251465, 0.0, 0.0]
|
|
[0.0, 0.0, 0.0, 6.2831854820251465]
|
|
[0.0, 0.0, 0.0, -6.2831854820251465]
|
|
[0.0, 0.0, 0.0, 1.5707963705062866]
|
|
[0.0, 0.0, 0.0, -1.5707963705062866]
|
|
[0.0, 0.0, 0.0, 1.0471975803375244]
|
|
[0.0, 0.0, 0.0, -1.0471975803375244]
|
|
[0.7853981852531433, 3.1415927410125732, 0.0, 0.0]
|
|
[-0.7853981852531433, -3.1415927410125732, 0.0, 0.0]
|
|
[1.5707963705062866, -3.1415927410125732, 0.0, 1.0471975803375244]
|
|
[-1.5707963705062866, 3.1415927410125732, 0.0, -1.0471975803375244]
|
|
[0.7853981852531433, 3.1415927410125732, 0.0, 6.2831854820251465]
|
|
[-0.7853981852531433, -3.1415927410125732, 0.0, 6.2831854820251465]
|
|
[1.5707963705062866, -3.1415927410125732, 0.0, 12.566370964050293]
|
|
[-1.5707963705062866, 3.1415927410125732, 0.0, -12.566370964050293]
|