You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have currently written code as follows. However I am still stuck at writing the correct syntax for writing gp into the equation. I would really appreciate some help with this.
At the moment you can set the dynamical equations as gp_model.set_dynamical_equations(['0', '0']) and then gp_model += [gp1, gp2] should do the trick. Now you can set up the model.
@jpohlodek Thank you for your response. I had referred to the example you pointed out and that was how I had setup initially. But the results I get from simulating the model don't seem to be correct. Because when I predict using:
But when I formulate a model using GPs as you've shown and simulate the model as shown below, the results are different and not consistent with what the gaussian processes should have predicted with the same time step.
sorry for the late reply. Looking over your code, I found one problem where you generate your features and labels. You create the labels by downsampling the state solution and applying the shift afterwards. Hence, you train the features of one time step (t) with the labels from 50 time steps (t+50) later. In other words you are predicting with a step size of 50, but in the prediction you want a step size of 1.
In order to run it in a closed loop with the same sampling time as the original system, you need the labels from the next time (t+1) step. So it's better to create the labels first by shifting the state solution and then downsample to the desired size of the training data set.
@brunomorampc I am trying to use a GP Model in an MPC setting where I am trying to write the state-space equations as
x1(t+1) = gp1(x(t), u(t))
x2(t+1) = gp2(x(t),u(t)),
where x = [x1;x2], u = [u1;u2]
I have currently written code as follows. However I am still stuck at writing the correct syntax for writing gp into the equation. I would really appreciate some help with this.
Thank you in advance!
Create GP Prediction Model
gp_model = Model(plot_backend='bokeh', name='GP_Model', discrete=True)
Set states and inputs
s = gp_model.set_dynamical_states(['x1','x2'])
u = gp_model.set_inputs(['u1','u2'])
gp_model.set_measurement_equations([s[0], s[1]])
x1 = s[0]
x2 = s[1]
u1 = u[0]
u2 = u[1]
x_next = gp1.predict([x1,x2,u1,u2])
y_next = gp2.predict([x1,x2,u1,u2])
gp_model.set_dynamical_equations(['x1', 'x2' ])
Set up the model
gp_model.setup(dt=0.01)
Set initial conditions
x0_GP = [1, 1]
gp_model.set_initial_conditions(x0=x0_GP)
The text was updated successfully, but these errors were encountered: