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; }
private User[] generateUsers() { User[] u = new User[userCount]; for (int n = 0; n < userCount; n++) { u[n]=new User(n); } return u; }
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; }
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; }
public void basicAllocate(User u,int m) { u.setAllocated(m); }
public SpecAllocate(int count, User[] u) { userCount = count; users = u; conflicts = new Conflicts(userCount); }
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); }