Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
jvesely opened this issue Jun 30, 2023 · 1 comment

Comments

@jvesely
Copy link
Collaborator

jvesely commented Jun 30, 2023

$ 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
Copy link
Collaborator Author

jvesely commented Jun 30, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant