Skip to content
Snippets Groups Projects
utils.py 1.59 KiB
Newer Older
  • Learn to ignore specific revisions
  • # *****************************************************************************
    # *****************************************************************************
    
    from ...problems.esipp.network import Arcs
    
    # *****************************************************************************
    # *****************************************************************************
    
    class ArcInvestments(Arcs):
        """A class for defining arcs linked to investments."""
    
        # *************************************************************************
        # *************************************************************************
    
        def __init__(self, investments: tuple, **kwargs):
            # keep investment data
            self.investments = investments
            # initialise object
            Arcs.__init__(
                self,
                minimum_cost=tuple([inv.net_present_value() for inv in self.investments]),
                # validate=False,
                **kwargs
            )
    
        # *************************************************************************
        # *************************************************************************
    
        def update_minimum_cost(self):
            "Updates the minimum costs using the Investment objects."
            self.minimum_cost = tuple([inv.net_present_value() for inv in self.investments])
    
        # *************************************************************************
        # *************************************************************************
    
    # *****************************************************************************
    # *****************************************************************************