public Preference(Schedule.Dispatch dispatch, bool followed, int resultingOptMakespan, int rank) { Dispatch = dispatch; Followed = followed; ResultingOptMakespan = resultingOptMakespan; Rank = rank; }
private void Read() { List<string> header; List<string[]> content = CSV.Read(FileInfo, out header); if (content == null || content.Count == 0) return; int iPID = header.FindIndex(x => x.Equals("PID")); int iStep = header.FindIndex(x => x.Equals("Step")); int iDispatch = header.FindIndex(x => x.Equals("Dispatch")); int iFollowed = header.FindIndex(x => x.Equals("Followed")); int iResultingOptMakespan = header.FindIndex(x => x.Equals("ResultingOptMakespan")); int iRank = header.FindIndex(x => x.Equals("Rank")); int minStep = Convert.ToInt32(content[0][iStep]); int pid, step; for (pid = 1; pid <= AlreadySavedPID; pid++) for (step = 0; step < NumDimension; step++) Preferences[pid - 1, step] = new List<Preference>(); foreach (var line in content) { pid = Convert.ToInt32(line[iPID]); if (pid > AlreadySavedPID) return; step = Convert.ToInt32(line[iStep]); bool followed = Convert.ToInt32(line[iFollowed]) == 1; int resultingOptMakespan = Convert.ToInt32(line[iResultingOptMakespan]); if (line.Length <= iRank) iRank = -1; int rank = iRank >= 0 ? Convert.ToInt32(line[iRank]) : 0; Schedule.Dispatch dispatch = new Schedule.Dispatch(line[iDispatch]); Preferences[pid - 1, step - minStep].Add(new Preference(dispatch, followed, resultingOptMakespan, rank)); } if (iRank >= 0) return; for (pid = 1; pid < AlreadySavedPID; pid++) RankPreferences(pid); }
public Preference(Schedule.Dispatch dispatch, Features features) { Dispatch = dispatch; Feature = features; }