示例#1
0
 public List<User> unconfilictUsersFor(User u)
 {
     int j = 0;
     List<User> f=new List<User>();
     for (int i = 0; i < userCount; i++)
     {
         if (0==conflicts.getConflicts()[u.index,i])
         {
             f.Add(users[i]);
         }
     }
     return f;
 }
示例#2
0
 private User[] generateUsers()
 {
     User[] u = new User[userCount];
     for (int n = 0; n < userCount; n++)
     {
         u[n]=new User(n);
     }
     return u;
 }
示例#3
0
 public User getMaxBenUser(User[] users)
 {
     User max = users[0];
     for (int i = 1; i < userCount; i++)
     {
         if (users[i].maxBenifit()>max.maxBenifit())
         {
             max = users[i];
         }
     }
     return max;
 }
示例#4
0
 public List<User> findConflictUsersFor(User u)
 {
     List<User> c=new List<User>();
     for (int i = 0; i < userCount; i++)
     {
         if (1==conflicts.getConflicts()[u.index,i])
         {
             c.Add(users[i]);
         }
     }
     return c;
 }
示例#5
0
 public void basicAllocate(User u,int m)
 {
     u.setAllocated(m);
 }
示例#6
0
 public SpecAllocate(int count, User[] u)
 {
     userCount = count;
     users = u;
     conflicts = new Conflicts(userCount);
 }
示例#7
0
 private void subConfilcts(int resource, User user)
 {
     List<User> conflictUsers = sa.findConflictUsersFor(user);
     List<User> cu = new List<User>();
     foreach (var u in F)
     {
         if (conflictUsers.Contains(u))
         {
             cu.Add(u);
         }
     }
     if (0 != cu.Count)
     {
         cu.Add(user);
         conflictList.Add(cu);
     }
     else
         sa.basicAllocate(user, resource);
 }