PsyNeuLink
PsyNeuLink copied to clipboard
TransferWithCosts: Intensity cost is `[1]` even when intensity cost is disabled
$ python3 -c 'import psyneulink as pnl; f = pnl.TransferWithCosts(enabled_cost_functions=pnl.CostFunctions.ADJUSTMENT); f(10); print(f.intensity_cost, f.adjustment_cost, f.duration_cost, f.combined_costs)'
[1.] [10.] None [10.]
I've tracked this to the following code in TransferWithCost:
# Initialize intensity attributes
if self.enabled_cost_functions:
# Default cost params
if self.owner:
if self.owner.context.initialization_status != ContextFlags.DEFERRED_INIT:
self.intensity_cost = self.intensity_cost_fct(self.owner.defaults.variable)
else:
self.intensity_cost = self.intensity_cost_fct(self.owner.class_defaults.variable)
else:
self.intensity_cost = self.intensity_cost_fct(self.defaults.variable)
self.defaults.intensity_cost = self.intensity_cost
the code is run if any cost function si enabled and always sets up the intensity cost parameters.