Just thought I'd make a comment on how my algorithm differs from Laxpower.com's. Basically, I am solving a least squares problem in linear algebra for those who know what that is. Essentially, I use a similar strategy to Laxpower, in that I am attempting to make
P(i) - P(j) = D(i,j)
where P(i) and P(j) are the power ratings for teams i and j, and D(i,j) is the goal differential for those two teams for when they played each other head to head. I have not implemented a home field advantage, but it would be reasonably easy to do.
I implement this by setting up and solving the equation
M*A*P=D
where P is the list of power rankings for all the teams (which is unknown), and D is the list of goal differentials for all the games. A is simply a matrix which maps the correct power ranking with the correct goal differential. M is a masking matrix which simply eliminates the entries of A that represent games that haven't happened or never will. Then I use a linear equation solver to find P in a least squares sense (I use MATLAB's \ operator).
Friday, February 19, 2010
MCLA D1 Power Rankings
I delved into the world of power rankings today. Here are my MCLA D1 power rankings early in the season. I'll update periodically. Compare to laxpower.com:
| 1 | 'Indiana' | 28.75 |
| 2 | 'Simon Fraser' | 28.07059 |
| 3 | 'Georgia' | 27.32143 |
| 4 | 'Georgia Tech' | 24.32143 |
| 5 | 'Florida State' | 24 |
| 6 | 'Minnesota - Duluth' | 24 |
| 7 | 'Vanderbilt' | 23.32143 |
| 8 | 'Mississippi' | 23.32143 |
| 9 | 'Oregon' | 22.97059 |
| 10 | 'SMU' | 21.75 |
| 11 | 'Lindenwood' | 21 |
| 12 | 'Colorado State' | 21 |
| 13 | 'Chico State' | 21 |
| 14 | 'Central Michigan' | 21 |
| 15 | 'Florida' | 21 |
| 16 | 'Cal Poly - SLO' | 20.41176 |
| 17 | 'Arizona State' | 20.35294 |
| 18 | 'California' | 19.77059 |
| 19 | 'Chapman' | 19.11765 |
| 20 | 'Baylor' | 18.75 |
| 21 | 'Brigham Young' | 18.52941 |
| 22 | 'Texas State' | 18.25 |
| 23 | 'Western Washington' | 18.07059 |
| 24 | 'Miami (FL)' | 18 |
| 25 | 'Central Florida' | 18 |
| 26 | 'Alabama' | 17.89286 |
| 27 | 'Texas' | 17.5 |
| 28 | 'UC Santa Barbara' | 17.47059 |
| 29 | 'Minnesota St. Mankato' | 17 |
| 30 | 'Arizona' | 16.25 |
| 31 | 'St. John''s (MN)' | 16 |
| 32 | 'Hendrix (D-III)' | 16 |
| 33 | 'Rice' | 14.5 |
| 34 | 'Reinhardt' | 14.32143 |
| 35 | 'Middle Tennessee' | 14.17857 |
| 36 | 'South Florida' | 14 |
| 37 | 'Palm Beach Atlantic' | 14 |
| 38 | 'Loyola Marymount' | 13.64706 |
| 39 | 'Stanford' | 13.17059 |
| 40 | 'Washington' | 13.07059 |
| 41 | 'North Florida' | 13 |
| 42 | 'Missouri' | 13 |
| 43 | 'North Carolina State' | 12 |
| 44 | 'Grove City' | 12 |
| 45 | 'USC' | 11.97059 |
| 46 | 'Oregon State' | 11.87059 |
| 47 | 'Texas Tech' | 11.75 |
| 48 | 'Washington - St. Louis' | 11 |
| 49 | 'UC San Diego' | 11 |
| 50 | 'Toledo' | 11 |
| 51 | 'Texas A&M' | 11 |
| 52 | 'Tennessee' | 11 |
| 53 | 'St. Cloud State' | 11 |
| 54 | 'South Carolina' | 11 |
| 55 | 'San Diego State' | 11 |
| 56 | 'Portland State' | 11 |
| 57 | 'Pittsburgh' | 11 |
| 58 | 'Oklahoma' | 11 |
| 59 | 'Northern Colorado' | 11 |
| 60 | 'Nevada' | 11 |
| 61 | 'Nebraska' | 11 |
| 62 | 'Louisiana State' | 11 |
| 63 | 'Iowa' | 11 |
| 64 | 'Gonzaga' | 11 |
| 65 | 'Georgia Southern' | 11 |
| 66 | 'Ferris State' | 11 |
| 67 | 'Auburn' | 11 |
| 68 | 'Memphis' | 10.60714 |
| 69 | 'UCLA' | 10.35294 |
| 70 | 'Claremont' | 10.23529 |
| 71 | 'TCU' | 10 |
| 72 | 'Eastern Michigan' | 10 |
| 73 | 'Creighton' | 10 |
| 74 | 'Central Washington' | 10 |
| 75 | 'Santa Clara' | 9.823529 |
| 76 | 'San Diego' | 9.176471 |
| 77 | 'Southern Maine (D-III)' | 9.117647 |
| 78 | 'UC Davis' | 9 |
| 79 | 'Grand Canyon' | 8.294118 |
| 80 | 'UC Santa Cruz' | 8 |
| 81 | 'Clemson' | 7.666667 |
| 82 | 'UNLV' | 7.294118 |
| 83 | 'Southern Oregon' | 7 |
| 84 | 'Southwestern (D-III)' | 6.25 |
| 85 | 'Northern Arizona' | 6.25 |
| 86 | 'Cal State Fullerton' | 5.352941 |
| 87 | 'Kentucky' | 4.333333 |
| 88 | 'Carleton' | 4 |
| 89 | 'Willamette' | 1 |
| 90 | 'Stephen F. Austin' | 1 |
| 91 | 'Pacific Lutheran' | 1 |
| 92 | 'Marymount Coll. (CA)' | 1 |
| 93 | 'John Carroll' | 1 |
| 94 | 'Cornell College' | 1 |
| 95 | 'C. of Charleston' | 1 |
| 96 | 'Biola' | 0.235294 |
| 97 | 'Centenary (LA)' | 0 |
Friday, January 8, 2010
Capping Memory for a Windows Process
I ran into an issue while running some heat transfer simulations in COMSOL. The software would start off using an acceptable amount of memory, so I would leave it overnight. Midway through the night, the solver entered a different stage, and the memory started sky-rocketing. This meant that windows started letting COMSOL use the swap as well as regular ram. Unfortunately there is no way in windows (that I know of) to force a program to either just use normal ram, or to cap the amount of memory it is allowed to use. I looked long and hard for such a method. It is an issue because a linear solver like COMSOL using swap for ram will tank a hard drive quickly (my hard drive actually died as a result).
Fortunately there is a way to solve this problem. We have to run the problem program inside a wrapper which assigns it a maximum amount of memory. The wrapper uses windows Job Objects to limit the amount of memory any given job or program can use. Here's my source code in C++:
Fortunately there is a way to solve this problem. We have to run the problem program inside a wrapper which assigns it a maximum amount of memory. The wrapper uses windows Job Objects to limit the amount of memory any given job or program can use. Here's my source code in C++:
I compiled this with Visual C++ Express Edition with no problems. If you need this feel free to use it. It could be written so that the name of the program and the memory limits are not hard coded, but I was just seeking a quick fix and I don't anticipate using this for any other applications at this point. Eventually I might write a command line intepreter for it so you can specify the target application and maximum memory, etc.
// maxmem.cpp : Defines the entry point for the application.
//
#include
#include
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPTSTR lpCmdLine,
int nCmdShow)
{
SIZE_T MaxMemory = 7864320000;
HANDLE job = CreateJobObject(0,"ComsolWrapper");
if (job == NULL) {
MessageBox(NULL,"Unable to create job object.",
"CreateJobObject Error",
MB_OK|MB_ICONEXCLAMATION);
return 1;
}
STARTUPINFO startupinfo;
PROCESS_INFORMATION processinformation;
memset(&startupinfo,0,sizeof(STARTUPINFO));
memset(&processinformation,0,sizeof(PROCESS_INFORMATION));
if (0 == CreateProcess("c:\\COMSOL35a\\bin\\comsol64.exe",0,0,0,false,
CREATE_SUSPENDED,0,0,
&startupinfo,&processinformation)) {
MessageBox(NULL,"Unable to open Comsol.",
"CreateProcess Error",MB_OK|MB_ICONEXCLAMATION);
return 1;
}
if (0 == AssignProcessToJobObject(job,processinformation.hProcess)) {
char *buffer = new char[256];
sprintf_s(buffer,256,
"Unable to assign Comsol process to Job Object, Error %d",
GetLastError());
MessageBox(NULL,buffer,"AssignProcessToJobObject Error",
MB_OK|MB_ICONEXCLAMATION);
}
JOBOBJECT_EXTENDED_LIMIT_INFORMATION joeli;
joeli.BasicLimitInformation.LimitFlags = JOB_OBJECT_LIMIT_JOB_MEMORY;
joeli.BasicLimitInformation.MinimumWorkingSetSize = 0;
joeli.BasicLimitInformation.MaximumWorkingSetSize = 0;
joeli.BasicLimitInformation.ActiveProcessLimit = 0;
joeli.BasicLimitInformation.Affinity = 0;
joeli.BasicLimitInformation.PriorityClass = 0;
joeli.BasicLimitInformation.SchedulingClass = 0;
joeli.ProcessMemoryLimit = 0;
joeli.JobMemoryLimit = MaxMemory;
joeli.PeakJobMemoryUsed = 0;
joeli.PeakProcessMemoryUsed = 0;
if (0 == SetInformationJobObject(job,
JobObjectExtendedLimitInformation,
&joeli,
sizeof(joeli))) {
MessageBox(NULL,"Unable to set job object information.",
"SetInformationJobObject Error",
MB_OK|MB_ICONEXCLAMATION);
}
ResumeThread(processinformation.hThread);
WaitForSingleObject(processinformation.hProcess,INFINITE);
return 0;
}
Subscribe to:
Comments (Atom)