I'm stuck at something that seemed easy but became a headache pretty fast:
Here is a class that represent a structure I'm using:
public class LocumJobDistanceDifferenceObject {
public LocumJobDistanceDifferenceObject(Int64 ALocumID, Int64 AJobID, Decimal ADistanceMiles, Int32 ARateDifference, Boolean AIsDistanceUnderMax) {
LocumID = ALocumID;
JobID = AJobID;
DistanceMiles = ADistanceMiles;
RateDifference = ARateDifference;
IsDistanceUnderMax = AIsDistanceUnderMax;
}
public Int64 LocumID {
get;
set;
}
public Int64 JobID {
get;
set;
}
public Decimal DistanceMiles {
get;
set;
}
public Int32 RateDifference {
get;
set;
}
public Boolean IsDistanceUnderMax {
get;
set;
}
}
I create a List to store a matrix of information. Locum is a worker and he needs to be placed at a Job. Lest say I have 50 Jobs and 75 Locums. I build my matrix by running a Locums x Jobs algo that stores LocumID + JobID + Detrmine DistanceMiles between Locum and Job + Determine Rate that Job pays/hour and Locum wants/hour + If dostance to Job exceeds Locum's max distance he/she willing to travel
So, basically, since it's a Locums (75) x Jobs (50) number of rows in the Matrix.
Now, I need to run a loop (ForEach) on my Matrix (I call it MindMapTier01) as follows:
foreach (LocumJobDistanceDifferenceObject LocumJobDistanceDifferenceItem in MindMapTier01.OrderBy(order=>order.JobID)) {
/**
* Build a list (KeyValuePair<JobID, LocumID>) such that for each unique JobID,
* I can assign the Locum closest to that Job. I need to keep in mind that
* once a job is assigned, I dont want that JobID or LocumID for the next iteration
**/
}
I hope I explained myself. I need to get over this within an hour or two. Please help.
Regards.