When working on #323 , I've found another issue...
Problem
In theory, it is possible to add new constrains simply y adding an appropriately coded and decorated function and then indicating in the toml file to use it:
@register_constraint
def new_constraint(...):
...
And then, in the relevant subsector of the toml file, add:
However, these settings are ignored unless the agent is of type Agent; retrofit and newcapa agents, the only ones we use as far as I can tell, are InvestingAgents and they DO NOT use this setting but use instead a hardcoded list of constraints - all of them.
Solution
To enable customisation of the InvestmingAgents constraints, the agents_factory needs to be enabled to use that and pass the appropriate parameter to the function call in the subsectors factory. These constraints settings might need to be propagated down to the appropriate level to ensure they are used by the agents.
When working on #323 , I've found another issue...
Problem
In theory, it is possible to add new constrains simply y adding an appropriately coded and decorated function and then indicating in the
toml
file to use it:And then, in the relevant subsector of the
toml
file, add:However, these settings are ignored unless the agent is of type
Agent
;retrofit
andnewcapa
agents, the only ones we use as far as I can tell, areInvestingAgents
and they DO NOT use this setting but use instead a hardcoded list of constraints - all of them.Solution
To enable customisation of the
InvestmingAgents
constraints, theagents_factory
needs to be enabled to use that and pass the appropriate parameter to the function call in the subsectors factory. These constraints settings might need to be propagated down to the appropriate level to ensure they are used by the agents.