Exemple #1
0
    def __create_src_map(self, commodity, from_secs, from_amount, mob_limit):
        """ init source sectors dictionary """
        result = {}
        for sect in from_secs.values():
            coords = empSector.to_coord(sect)
            if empSector.is_movable_from(sect, commodity):

                mob = empSector.value(sect, "mob") - mob_limit
                amount = empSector.value(sect, commodity) - from_amount

                if mob > 0 and amount > 0:
                    weight = 1.0
                    result[coords] = (amount, mob, weight)
                    ## print "src += " + coords.str() + " " + `amount` + " ",
                    ## print `mob` + " " + `weight`
        return result
Exemple #2
0
    def __create_src_map( self, commodity, from_secs, from_amount, mob_limit ):
        """ create  source sectors dictionary """
        result = {}
        for sect in from_secs.values() :
            coords  = empSector.to_coord( sect )
            if empSector.is_movable_from( sect, commodity ) :

                mob    = empSector.value( sect, 'mob' ) - mob_limit;
                amount = empSector.value( sect, commodity  ) - from_amount

                if  mob > 0 and amount > 0  :
                    weight = empSector.move_weight( sect, commodity )
                    result[ coords ] = ( amount , mob , weight)

                    ## print "src += " + coords.str() + " " + `amount` + " ",
                    ## print `mob` + " " + `weight`
        return result
Exemple #3
0
 def __create_dst_map( self, commodity, to_secs, to_amount ):
     """ create  destination sectors dictionary """
     result =  {}
     for sect in to_secs.values() :
         coords = empSector.to_coord( sect )
         if empSector.is_movable_into( sect, commodity )  :
             amount = to_amount - empSector.value( sect, commodity )
             if  amount > 0  :
                 result[ coords ] = amount
                 ## print "dst += " + coords.str() + " " + `amount`
     return result
Exemple #4
0
 def __create_dst_map(self, commodity, to_secs, to_amount):
     """ create  destination sectors dictionary """
     result = {}
     for sect in to_secs.values():
         coords = empSector.to_coord(sect)
         if empSector.is_movable_into(sect, commodity):
             amount = to_amount - empSector.value(sect, commodity)
             if amount > 0:
                 result[coords] = amount
                 ## print "dst += " + coords.str() + " " + `amount`
     return result