File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed
neurolib/control/optimal_control Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -92,6 +92,10 @@ def accuracy_cost(self, output):
92
92
accuracy_cost += self .weights ["w_p" ] * 0.5 * self .model .params .dt * jnp .sum ((output - self .target ) ** 2 )
93
93
if self .weights ["w_cc" ] != 0.0 :
94
94
accuracy_cost += self .weights ["w_cc" ] * self .compute_cc_cost (output )
95
+ if self .weights ["w_var" ] != 0.0 :
96
+ accuracy_cost += self .weights ["w_var" ] * self .compute_var_cost (output )
97
+ if self .weights ["w_f_osc" ] != 0.0 :
98
+ accuracy_cost += self .weights ["w_f_osc" ] * self .compute_osc_fourier_cost (output )
95
99
return accuracy_cost
96
100
97
101
def control_strength_cost (self , control ):
@@ -118,6 +122,11 @@ def compute_cc_cost(self, output):
118
122
cost *= - 2.0 / (self .model .params .N * (self .model .params .N - 1 ) * self .T * self .model .params .dt )
119
123
return cost
120
124
125
+ def compute_var_cost (self , output ):
126
+ return jnp .var (output , axis = (0 , 1 )).mean ()
127
+
128
+ def compute_osc_fourier_cost (self , output ):
129
+
121
130
def optimize_deterministic (self , n_max_iterations , output_every_nth = None ):
122
131
"""Compute the optimal control signal for noise averaging method 0.
123
132
You can’t perform that action at this time.
0 commit comments