# OPR Formula

This is going to sound extremely stupid, but what is the formula for OPR?

That is not a stupid question.

OPR is actually a system of simultaneous equations. The difficulty lies in solving that many simultaneous equations.

For instance. In a standard district event in Michigan, there might be 80 matches.

Each match has equations that lay out like this:
Robot_1_score+Robot_2_score+Robot_3_score=Red_Score
Robot_4_score+Robot_5_score+Robot_6_score=Blue_Score

So, in the end youâ€™ll have a system with 160 equations, and 40 variables (each robot is one variable, as shown in the equations above). The trick is solving those equations. Until just recently, excel didnâ€™t have the firepower to do it unless you used macros. However, with the newer versions, the Matrix formulas are powerful enough to do it. Keep in mind this isnâ€™t like algebra - the computer has to iterate to find an answer.

This is not a simple process. It is fairly complicated. Look up â€śsolving simultaneous equations using matricesâ€ť in excel, and you should be able to find some examples. That is how we wrote our OPR. It requires pretty in-depth knowledge of excel though. Youâ€™ll have to understand named arrays, matrix math functions, and array formulas.

2834 the Bionic Barons put out an awesome OPR sheet that handles the calculations through some open-source macro code. It is far more complex (to me) than using matrix formulae, because I have never used macros and vb programming in excel.

Of course, programs like matlab have more advanced equation solvers and you may be able to easily write a program to perform the calculations.

Tom,

Iâ€™ve done a fair amount of work with large overdetermined systems of equations (20,000 equations in 6,000 variables).

Iâ€™d like to play around with some of this data. Maybe I could write and post a small app. Do you know where I could get a couple of CSV, or whitespace-delimited, or fixed-field text files from 2011?

Thanks.
*
*

I believe you can copy and paste from the old scores on the FIRST website. For instance, here:

http://www2.usfirst.org/2011comp/events/GL/matchresults.html

That is how I developed ours. Iâ€™ve never tried to do the whole web-scrape or download the scores automatically as they are posted by FIRST. If, however, someone could explain how thatâ€™s done it would be absolutely wonderful!

In newer versions of Excel, go to the Data tab, and then click (under Get External Data - left most panel) â€śFrom Webâ€ť. Then, you can put the URL of the results page into the little browser window that pops up and then select the table with match results. To refresh, click â€śRefresh Allâ€ť in the Connections pane (still on the data tab).

1 Like

Also, the FIRST FMS system uploads its data in twitter posts under @frcfms so you could scrape a lot more data from that since it tells of penalties point total for instance.

Is there a CSV or whitespace-delimited or fixed-field text file somewhere that has all the scores from all the matches around the country (world) in one file for 2011?
*
*

1 Like

Howâ€™s this? I just threw it together by scraping all the competitions and putting them in one big file.

Also, some fun facts I found:

• there were 5,258 FRC matches played in 2011
• There were 357,981 points scored total
• The average individual alliance score was 34.04 points
• The average total number of points per match was 68.08311145 points
• The highest alliance score was 147 points

2011 matches.xlsx (253 KB)

2011 matches.xlsx (253 KB)

Many thanks for all the info. Can I assume the same basic principles hold true with DPR as well?

I was not aware of this. Would someone be able to tap this data during the tournament to feed it into a scouting program? How much information is available there?

Also, I know OPR means offensive power rating, but what does this actually mean?

IIRC, OPR is the expected points contribution of any given robot to an alliance.

DPRâ€¦ I donâ€™t think anybodyâ€™s ever come up with a good way to calculate that. First you have to find a way to calculate a defensive scoreâ€¦

Couldnâ€™t you do it the same way Tom said he did the OPR, with the following twist?

Set up the equations like so:

red1+red2+red3 = blue_alliance_score

â€¦ then solve the system.

The lower the number, the better the DPR. Like golf.

http://www.chiefdelphi.com/media/papers/2174

I will post an updated 2012 version of the presentation file shortly.

Possibly. The hardest part about DPR is that a low blue_alliance_score could come from two possible sources. It could be that one or more red robots are playing really good defense. But, it could be that the blue alliance has a very low combined OPR (read: needs better offense even without defense being played). Without having an OPR-to-score comparison built in, there is no real way to determine whether red is playing good defense or blue is playing bad offense.

You might be able to do it with

red1+red2+red3 = blue_alliance_OPR - blue_alliance_score

and the higher the score the better (due to the OPR-score) but that involves knowing the blue allianceâ€™s combined OPR.

Numerically, DPR = OPR - CCWM (calculated contribution to winning margin). A team will have high DPR if their CCWM is low or negative comparing to OPR. Low DPR means a team is good in defense. Basically it means they do not allow their opponents to score much.
I do not agree with low DPR is a result of opposing allianceâ€™s inability to score. Over a number of matches, those teams with low OPRs will also cause other teams to experience the same thing. A teamâ€™s DPR will only be higher or lower based on how they perform on average comparing to other teams. Remember OPR, DPR and CCWM are all calculations of that teamâ€™s calculated contribution.

Phil, can you explain how you got the info from twitter?

The problem with DPR is that when teams do not play defence, DPR can be unpredictable. While it will take into account offensive hoarding by the team (if applicable), this is not always significant compared to mostly-random fluctuations, including schedule.

Occasionally, DPR will take into account non-random factors other than the teamâ€™s robot, though. In 2011, a teamâ€™s human player could play a significant role in determining opponents score. A human playerâ€™s output (# of tubes thrown) and accuracy (% of tubes picked up by own alliance) definitely affect opponent score, for example. A human player who threw many tubes or wasnâ€™t very accurate could result in a team having a high DPR.

In 2012, human players arenâ€™t a factor, but hoarding as an alliance strategy certainly is (note that an alliance could control 15 of the 18 balls at a time). A low DPR by a team not playing defence would probably be indicative of such a strategy.

I didnâ€™t get it from twitter. I got it from the web based results (with a URL like this: http://www2.usfirst.org/2011comp/events/CT/matchresults.html) by just going through all the event codes and putting it as a parameter in an excel query that would get the data from http://www2.usfirst.org/2011comp/events/event_code/matchresults.htm. Then, I just put them all in the table I posted.

To get this data from twitter, youâ€™d have to use the API, and Iâ€™m not sure to go about that. Maybe you could fetch tweets using JSON?

Hey guys,

I took what all of you have contributed (great post by the way, very helpful) and constructed an excel file to do RUSHâ€™s post-competition analysis, or other competition scouting for states and nationals. So i wrote a macro (not very efficient at those, sorry) and it creates webquery files, obtains the data, and organizes it for however many teams are in the tournament. The only problem I am having is the OPR calculations. Can someone look at my macro and see what they can do about adding an OPR calculation formula or something? Or give me some feedback on how i can improve it cause I really am not too good at these. Thanks.

Regional Template.xls (540 KB)

Regional Template.xls (540 KB)

Thatâ€™s along the same lines I was thinking. If you could calculate the opposing score, then you would have your DPR.