Reference 〉 Function


Sets self.utility to the value returned from self.calculate(). The agent.stocks dict can be passed directly to this function.


  • quantities dict{str:num}, required

    The quantities of the goods to be consumed. If the utility function was registered with the same set of goods as the model (see Goods.add()), agent.stocks can be passed straight into this function.

Return Value num

The utility gained from consuming the quantities in question.

Notes and Examples

  1. Contribute a Note

    Your email address will not be published. Required fields are marked *

    You may use limited HTML for formatting. Please embed blocks of code in <pre><code> </code></pre> tags.