PsyNeuLink icon indicating copy to clipboard operation
PsyNeuLink copied to clipboard

TransferWithCosts: Intensity cost is `[1]` even when intensity cost is disabled

Open jvesely opened this issue 2 years ago • 1 comments

$ 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.]

jvesely avatar Jun 30 '23 19:06 jvesely

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.

jvesely avatar Jun 30 '23 20:06 jvesely