Skip to content

stage two  #2

Description

@transposition

求sigma 的时候,是不是应该要按allocation order (dj/Sj)降序分配

 def stage_two(self):
        self.s_i = {}
        for i in self.supply.get_all_i():
            self.s_i[i] = self.supply.get_supply(i)
            self.update_beta(i)
        print('stage two beta --->', sorted(self.beta_i.items(), key=lambda d: d[0]))
        sigma = {}
        # for j in self.demand.get_all_j():
        for (j,theta_ij_j) in sorted(self.theta_ij.items(),key=lambda x: x[1],reverse=True):

还有分配的时候

  def allocation(self, i):
        s = 1.0
        x_ij = {}
        if i not in self.beta_i:
            self.update_beta(i)

        # for j in self.supply.get_satisfy_demand(i): 
        for (j, theta_ij_j) in sorted(self.theta_ij.items(), key=lambda x: x[1], reverse=True):
            if j in self.supply.get_satisfy_demand(i):
                g = max(0.0, self.theta_ij[j] * (1.0 + (self.sigma_j[j] - self.beta_i[i]) / self.demand.get_v(j)))
                x_ij[j] = min(s, g)
                s -= x_ij[j]

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions