Go to Post I don't resent or envy them for being strong teams; I hope we can continue to learn from them and someday join their ranks. - dsmoker [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rating: Thread Rating: 83 votes, 5.00 average. Display Modes
  #1   Spotlight this post!  
Unread 11-10-2014, 11:10
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,125
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
OPR Programming Challenge


Given the dataset Michael Hill posted here, calculate OPR, DPR, and CCWM; and create a report sorted by team number.

The goal is to see who can go from raw input data to finished output report the fastest.

@ Michael Hill: please refrain since you and I have discussed this.


  #2   Spotlight this post!  
Unread 11-10-2014, 11:30
Arhowk's Avatar
Arhowk Arhowk is offline
FiM CSA
AKA: Jake Niman
FRC #1684 (The Chimeras) (5460 Mentor)
 
Join Date: Jan 2013
Rookie Year: 2013
Location: Lapeer
Posts: 544
Arhowk is a splendid one to beholdArhowk is a splendid one to beholdArhowk is a splendid one to beholdArhowk is a splendid one to beholdArhowk is a splendid one to beholdArhowk is a splendid one to behold
Re: OPR Programming Challenge

by "fastest" do you mean the first response or fastest operational efficiency?
  #3   Spotlight this post!  
Unread 11-10-2014, 19:14
Nathan Streeter's Avatar
Nathan Streeter Nathan Streeter is offline
FIRST Fan(atic)
FRC #1519 (Mechanical MAYHEM)
Team Role: Mentor
 
Join Date: Feb 2008
Rookie Year: 2006
Location: Merrimack, NH
Posts: 676
Nathan Streeter has a reputation beyond reputeNathan Streeter has a reputation beyond reputeNathan Streeter has a reputation beyond reputeNathan Streeter has a reputation beyond reputeNathan Streeter has a reputation beyond reputeNathan Streeter has a reputation beyond reputeNathan Streeter has a reputation beyond reputeNathan Streeter has a reputation beyond reputeNathan Streeter has a reputation beyond reputeNathan Streeter has a reputation beyond reputeNathan Streeter has a reputation beyond repute
Re: OPR Programming Challenge

I believe operational efficiency is the goal; however, Ether can speak for himself on that...
__________________
"If you want to build a ship, don't drum up men to gather wood, divide the work, or give orders. Instead, teach them to yearn for the vast and endless sea." - Antoine de Saint-Exupery
"The fight is won or lost far away from witnesses - behind the lines, in the gym, and out there on the road, long before I dance under those lights." - Muhammad Ali
"Simplicity is the ultimate sophistication." - Leonardo da Vinci


Student: 2006-2010 (#1519)
Mentor: 2011-Present (#1519)


  #4   Spotlight this post!  
Unread 11-10-2014, 19:44
Michael Hill's Avatar
Michael Hill Michael Hill is offline
Registered User
FRC #3138 (Innovators Robotics)
Team Role: Mentor
 
Join Date: Jul 2004
Rookie Year: 2003
Location: Dayton, OH
Posts: 1,580
Michael Hill has a reputation beyond reputeMichael Hill has a reputation beyond reputeMichael Hill has a reputation beyond reputeMichael Hill has a reputation beyond reputeMichael Hill has a reputation beyond reputeMichael Hill has a reputation beyond reputeMichael Hill has a reputation beyond reputeMichael Hill has a reputation beyond reputeMichael Hill has a reputation beyond reputeMichael Hill has a reputation beyond reputeMichael Hill has a reputation beyond repute
Re: OPR Programming Challenge

*Actively Refraining* ...if that's possible
  #5   Spotlight this post!  
Unread 05-12-2014, 01:40
saikiranra's Avatar
saikiranra saikiranra is offline
UCI
AKA: Saikiran Ramanan
FRC #3476 (Code Orange)
Team Role: Mentor
 
Join Date: Oct 2012
Rookie Year: 2011
Location: Irvine, CA
Posts: 201
saikiranra has a reputation beyond reputesaikiranra has a reputation beyond reputesaikiranra has a reputation beyond reputesaikiranra has a reputation beyond reputesaikiranra has a reputation beyond reputesaikiranra has a reputation beyond reputesaikiranra has a reputation beyond reputesaikiranra has a reputation beyond reputesaikiranra has a reputation beyond reputesaikiranra has a reputation beyond reputesaikiranra has a reputation beyond repute
Re: OPR Programming Challenge

I'm about 2 months late, but I think I have generated an accurate report. Some of the OPR and CCWM values are identical to the 1114/2834 databases, while others are a few values off. I don't know whether this is an input error, matrix inversion error, or general code bug.
Attached Files
File Type: txt output.txt (126.4 KB, 79 views)
__________________
2014 - Current: Team 3476 Electronics, Programming, and Scouting Mentor
2011 - 2014: Team 696 Student and Drive Coach
  #6   Spotlight this post!  
Unread 05-12-2014, 09:34
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,125
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: OPR Programming Challenge

Quote:
Originally Posted by saikiranra View Post
I'm about 2 months late, but I think I have generated an accurate report.
Thanks for posting. Maybe this will revive interest in the thread.

Did you time how long it took the computer to go from raw input data to finished output report ? That's the challenge.


Quote:
Some of the OPR and CCWM values are identical to the 1114/2834 databases, while others are a few values off. I don't know whether this is an input error, matrix inversion error, or general code bug.
http://www.chiefdelphi.com/forums/sh...29&postcount=7


  #7   Spotlight this post!  
Unread 05-12-2014, 20:59
saikiranra's Avatar
saikiranra saikiranra is offline
UCI
AKA: Saikiran Ramanan
FRC #3476 (Code Orange)
Team Role: Mentor
 
Join Date: Oct 2012
Rookie Year: 2011
Location: Irvine, CA
Posts: 201
saikiranra has a reputation beyond reputesaikiranra has a reputation beyond reputesaikiranra has a reputation beyond reputesaikiranra has a reputation beyond reputesaikiranra has a reputation beyond reputesaikiranra has a reputation beyond reputesaikiranra has a reputation beyond reputesaikiranra has a reputation beyond reputesaikiranra has a reputation beyond reputesaikiranra has a reputation beyond reputesaikiranra has a reputation beyond repute
Re: OPR Programming Challenge

Quote:
Originally Posted by Ether View Post

Did you time how long it took the computer to go from raw input data to finished output report ? That's the challenge.

http://www.chiefdelphi.com/forums/sh...29&postcount=7


Oops, sorry for not posting it. Over 10 runs, it averaged 0.823266 seconds to generate the output.

As for the matrix inversion, I didn't realize that the Cholesky solving library I used didn't find the inverse, rather it found Cholesky factorization of the matrix.
__________________
2014 - Current: Team 3476 Electronics, Programming, and Scouting Mentor
2011 - 2014: Team 696 Student and Drive Coach
  #8   Spotlight this post!  
Unread 05-12-2014, 21:23
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,125
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: OPR Programming Challenge

Quote:
Originally Posted by saikiranra View Post
Over 10 runs, it averaged 0.823266 seconds to generate the output.
That's pretty good.

The challenge includes the total time to do all these steps*:
  1. - read Michael's 8-column fixed-width data file
  2. - convert that data into a set of linear equations
  3. - compute the solution vectors OPR, DPR, & CCWM
  4. - sort the solution vector elements in ascending order by team number
  5. - write the output report to a disk file.

Please report the times for each of the above steps.

What hardware did you run this on? What software did you use?

*if you used different steps, please explain and provide timings

Last edited by Ether : 05-12-2014 at 21:48.
  #9   Spotlight this post!  
Unread 05-12-2014, 23:56
saikiranra's Avatar
saikiranra saikiranra is offline
UCI
AKA: Saikiran Ramanan
FRC #3476 (Code Orange)
Team Role: Mentor
 
Join Date: Oct 2012
Rookie Year: 2011
Location: Irvine, CA
Posts: 201
saikiranra has a reputation beyond reputesaikiranra has a reputation beyond reputesaikiranra has a reputation beyond reputesaikiranra has a reputation beyond reputesaikiranra has a reputation beyond reputesaikiranra has a reputation beyond reputesaikiranra has a reputation beyond reputesaikiranra has a reputation beyond reputesaikiranra has a reputation beyond reputesaikiranra has a reputation beyond reputesaikiranra has a reputation beyond repute
Re: OPR Programming Challenge

Out of 50 runs, these are the average times to:

1. Read from file to create data structures: 0.3636 seconds
2. Make sorted team lists and Bs in Ax=B: 0.0019 seconds
3. Make matrix A in Ax=B: 0.0675 seconds
4. Create Cholesky factorization and find OPR and CCWM values (DPR = OPR - CCWM): 0.2793 seconds
5. Write to file: 0.0242 seconds
(Record these times: 0.0128 seconds)

Total: 0.7494 seconds

I wrote this in Python using the numpy and scipy libraries to manipulate matrices. The software is running on a Windows 8 machine with an Intel i7-4700MQ running at 2.4 GHz, with 12 GB of RAM.
__________________
2014 - Current: Team 3476 Electronics, Programming, and Scouting Mentor
2011 - 2014: Team 696 Student and Drive Coach
  #10   Spotlight this post!  
Unread 06-12-2014, 12:21
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,125
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: OPR Programming Challenge

Quote:
Originally Posted by saikiranra View Post
Out of 50 runs, these are the average times to:

1. Read from file to create data structures: 0.3636 seconds
2. Make sorted team lists and Bs in Ax=B: 0.0019 seconds
3. Make matrix A in Ax=B: 0.0675 seconds
4. Create Cholesky factorization and find OPR and CCWM values (DPR = OPR - CCWM): 0.2793 seconds
5. Write to file: 0.0242 seconds
(Record these times: 0.0128 seconds)

Total: 0.7494 seconds

I wrote this in Python using the numpy and scipy libraries to manipulate matrices. The software is running on a Windows 8 machine with an Intel i7-4700MQ running at 2.4 GHz, with 12 GB of RAM.
Nice work.

For those of you reading along, the timing above is for a dataset containing 2696 teams, 8921 matches, 17842 alliance scores.

@ Michael Hill: feel free to jump in here now if you want :-)





  #11   Spotlight this post!  
Unread 06-12-2014, 16:35
Michael Hill's Avatar
Michael Hill Michael Hill is offline
Registered User
FRC #3138 (Innovators Robotics)
Team Role: Mentor
 
Join Date: Jul 2004
Rookie Year: 2003
Location: Dayton, OH
Posts: 1,580
Michael Hill has a reputation beyond reputeMichael Hill has a reputation beyond reputeMichael Hill has a reputation beyond reputeMichael Hill has a reputation beyond reputeMichael Hill has a reputation beyond reputeMichael Hill has a reputation beyond reputeMichael Hill has a reputation beyond reputeMichael Hill has a reputation beyond reputeMichael Hill has a reputation beyond reputeMichael Hill has a reputation beyond reputeMichael Hill has a reputation beyond repute
Re: OPR Programming Challenge

Quote:
Originally Posted by Ether View Post
Nice work.

For those of you reading along, the timing above is for a dataset containing 2696 teams, 8921 matches, 17842 alliance scores.

@ Michael Hill: feel free to jump in here now if you want :-)
Fair enough. It's been a while since I've messed around with this, but I dug up my MATLAB script I originally did this with. I got it down to 0.518726 seconds (average over 10 runs.)

There are some optimizations that are done with this. For example, using sparse matrices lets MATLAB do a much quicker job of left divides (which is not the same as inverting the matrix). MATLAB is actually fairly smart and decides which form of factorization to use based on the data that's inputted, so it (generally) will choose the fastest method. Sparse is very fast.

Code:
tic
alldata = dlmread('C:\Users\Michael Hill\Documents\Projects\OPR\scores.dat');
teams = [alldata(:,1:3); alldata(:,4:6)];
reddiff = [alldata(:,7)-alldata(:,8)];
bluediff = [alldata(:,8)-alldata(:,7)];
scores = [alldata(:,7); alldata(:,8)];
diffscores = [reddiff; bluediff];
a = size(teams);
A = zeros(max(max(teams)));
B = zeros(max(max(teams)),2);
for i = 1:a(1)
    A(teams(i,1),teams(i,1)) = A(teams(i,1),teams(i,1)) + 1;
    A(teams(i,1),teams(i,2)) = A(teams(i,1),teams(i,2)) + 1;
    A(teams(i,1),teams(i,3)) = A(teams(i,1),teams(i,3)) + 1;
    A(teams(i,2),teams(i,1)) = A(teams(i,2),teams(i,1)) + 1;
    A(teams(i,2),teams(i,2)) = A(teams(i,2),teams(i,2)) + 1;
    A(teams(i,2),teams(i,3)) = A(teams(i,2),teams(i,3)) + 1;
    A(teams(i,3),teams(i,1)) = A(teams(i,3),teams(i,1)) + 1;
    A(teams(i,3),teams(i,2)) = A(teams(i,3),teams(i,2)) + 1;
    A(teams(i,3),teams(i,3)) = A(teams(i,3),teams(i,3)) + 1;
    B(teams(i,1),1) = B(teams(i,1),1) + scores(i);
    B(teams(i,2),1) = B(teams(i,2),1) + scores(i);
    B(teams(i,3),1) = B(teams(i,3),1) + scores(i);
    B(teams(i,1),2) = B(teams(i,1),2) + diffscores(i);
    B(teams(i,2),2) = B(teams(i,2),2) + diffscores(i);
    B(teams(i,3),2) = B(teams(i,3),2) + diffscores(i);
end

%gpuA = gpuArray(A);
%gpuB = gpuArray(B);
A = sparse(A);
B = sparse(B);
A(~any(A,2), :) = [];
A(:, ~any(A,1)) = [];
B(~any(B,2), :) = [];
X = A\B(:,1);
Y = A\B(:,2);
D = X-Y;

tdupe = sort([teams(:,1);teams(:,2);teams(:,3)]);
[junk, index] = unique(tdupe,'first');
teamList = tdupe(sort(index));
numTeams = size(teamList);
out = zeros(numTeams(1),4);
for i = 1:size(teamList)
    out(i,1) = teamList(i);
    out(i,2) = gather(X(i));
    out(i,3) = gather(Y(i));
    out(i,4) = gather(D(i));
end

% expectedRed = zeros(a(1)/2,1);
% expectedBlue = zeros(a(1)/2,1);
% for i=1:a(1)/2
%     index1 = find(out(:,1)==alldata(i,1));
%     index2 = find(out(:,1)==alldata(i,2));
%     index3 = find(out(:,1)==alldata(i,3));
%     index4 = find(out(:,1)==alldata(i,4));
%     index5 = find(out(:,1)==alldata(i,5));
%     index6 = find(out(:,1)==alldata(i,6));
%     opr1 = out(index1,2);
%     opr2 = out(index2,2);
%     opr3 = out(index3,2);
%     opr4 = out(index4,2);
%     opr5 = out(index5,2);
%     opr6 = out(index6,2);
%     expectedRed(i) = opr1+opr2+opr3;
%     expectedBlue(i) = opr4+opr5+opr6;
% end
% 
% diffExpRed = expectedRed - alldata(:,7);
% diffExpBlue = expectedBlue - alldata(:,8);
% 
% diffExp = [diffExpBlue; diffExpRed];
% 
% C = zeros(gather(max(max(teams))));
% for i = 1:a(1)
%     C(teams(i,1)) = C(teams(i,1)) + diffExp(i);
%     C(teams(i,2)) = C(teams(i,2)) + diffExp(i);
%     C(teams(i,3)) = C(teams(i,3)) + diffExp(i);
% end
% gpuC = gpuArray(C);
% gpuC(~any(gpuC,2), :) = [];
% Z = gpuA\gpuC(:,1);
% for i = 1:size(teamList)
%     out(i,5) = gather(Z(i));
% end
disp(out);
toc
There are some remnants in the comments of me messing with gpuArrays on MATLAB, and I'm too lazy to get rid of them. I have a Quadro K1100M Graphics card in my laptop, so I was messing around with using CUDA cores. It turns out that MATLAB has not implemented sparse matrices with CUDA processing, so they have to be full matrices, which actually slows it down (fairly significantly) over using sparse matrices with calculation on the CPU. For the record, my CPU is an Intel i7-4702HQ @ 2.2 GHz with 16 GB of RAM (My Computer is a Dell Precision M3800).

EDIT: I actually just realized there was some code that slows it down in there. the "gather"s in developing the "out" matrix are more remnants of GPU computing that I didn't take out. They are used for getting the variables out of GPU memory to my RAM. After removing them, It took total computation time to about 0.48 seconds.

Last edited by Michael Hill : 06-12-2014 at 16:40.
  #12   Spotlight this post!  
Unread 06-12-2014, 16:44
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,125
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: OPR Programming Challenge

Quote:
Originally Posted by Michael Hill View Post
EDIT: I actually just realized there was some code that slows it down in there. the "gather"s in developing the "out" matrix are more remnants of GPU computing that I didn't take out. They are used for getting the variables out of GPU memory to my RAM. After removing them, It took total computation time to about 0.48 seconds.
Here's another optimization you can try. Replace this code:

X = A\B(:,1);
Y = A\B(:,2);

... with this:

XY = A\B

... then you'll have only one left-divide, and the XY vector will be a 2-column vector containing X and Y.


  #13   Spotlight this post!  
Unread 06-12-2014, 19:13
Michael Hill's Avatar
Michael Hill Michael Hill is offline
Registered User
FRC #3138 (Innovators Robotics)
Team Role: Mentor
 
Join Date: Jul 2004
Rookie Year: 2003
Location: Dayton, OH
Posts: 1,580
Michael Hill has a reputation beyond reputeMichael Hill has a reputation beyond reputeMichael Hill has a reputation beyond reputeMichael Hill has a reputation beyond reputeMichael Hill has a reputation beyond reputeMichael Hill has a reputation beyond reputeMichael Hill has a reputation beyond reputeMichael Hill has a reputation beyond reputeMichael Hill has a reputation beyond reputeMichael Hill has a reputation beyond reputeMichael Hill has a reputation beyond repute
Re: OPR Programming Challenge

Quote:
Originally Posted by Ether View Post
Here's another optimization you can try. Replace this code:

X = A\B(:,1);
Y = A\B(:,2);

... with this:

XY = A\B

... then you'll have only one left-divide, and the XY vector will be a 2-column vector containing X and Y.


Made it a bit faster (0.02 seconds). I expected it to be a lot more, but surprisingly, reading the file into MATLAB is the longest operation at 0.31 seconds (That's reading in the file and creating my A and B matrices). It surprises me it takes that long with a the SSD I have.
  #14   Spotlight this post!  
Unread 09-12-2014, 11:40
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,125
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: OPR Programming Challenge

Quote:
Originally Posted by Michael Hill View Post
reading the file into MATLAB is the longest operation at 0.31 seconds (That's reading in the file and creating my A and B matrices)
Could I talk you into putting separate tic/toc statements around

Code:
alldata = dlmread('C:\Users\Michael Hill\Documents\Projects\OPR\scores.dat');
and

Code:
for i = 1:a(1)
    A(teams(i,1),teams(i,1)) = A(teams(i,1),teams(i,1)) + 1;
    A(teams(i,1),teams(i,2)) = A(teams(i,1),teams(i,2)) + 1;
    A(teams(i,1),teams(i,3)) = A(teams(i,1),teams(i,3)) + 1;
    A(teams(i,2),teams(i,1)) = A(teams(i,2),teams(i,1)) + 1;
    A(teams(i,2),teams(i,2)) = A(teams(i,2),teams(i,2)) + 1;
    A(teams(i,2),teams(i,3)) = A(teams(i,2),teams(i,3)) + 1;
    A(teams(i,3),teams(i,1)) = A(teams(i,3),teams(i,1)) + 1;
    A(teams(i,3),teams(i,2)) = A(teams(i,3),teams(i,2)) + 1;
    A(teams(i,3),teams(i,3)) = A(teams(i,3),teams(i,3)) + 1;
    B(teams(i,1),1) = B(teams(i,1),1) + scores(i);
    B(teams(i,2),1) = B(teams(i,2),1) + scores(i);
    B(teams(i,3),1) = B(teams(i,3),1) + scores(i);
    B(teams(i,1),2) = B(teams(i,1),2) + diffscores(i);
    B(teams(i,2),2) = B(teams(i,2),2) + diffscores(i);
    B(teams(i,3),2) = B(teams(i,3),2) + diffscores(i);
end



  #15   Spotlight this post!  
Unread 11-12-2014, 17:15
Michael Hill's Avatar
Michael Hill Michael Hill is offline
Registered User
FRC #3138 (Innovators Robotics)
Team Role: Mentor
 
Join Date: Jul 2004
Rookie Year: 2003
Location: Dayton, OH
Posts: 1,580
Michael Hill has a reputation beyond reputeMichael Hill has a reputation beyond reputeMichael Hill has a reputation beyond reputeMichael Hill has a reputation beyond reputeMichael Hill has a reputation beyond reputeMichael Hill has a reputation beyond reputeMichael Hill has a reputation beyond reputeMichael Hill has a reputation beyond reputeMichael Hill has a reputation beyond reputeMichael Hill has a reputation beyond reputeMichael Hill has a reputation beyond repute
Re: OPR Programming Challenge

Quote:
Originally Posted by Ether View Post
Could I talk you into putting separate tic/toc statements around

Code:
alldata = dlmread('C:\Users\Michael Hill\Documents\Projects\OPR\scores.dat');
and

Code:
for i = 1:a(1)
    A(teams(i,1),teams(i,1)) = A(teams(i,1),teams(i,1)) + 1;
    A(teams(i,1),teams(i,2)) = A(teams(i,1),teams(i,2)) + 1;
    A(teams(i,1),teams(i,3)) = A(teams(i,1),teams(i,3)) + 1;
    A(teams(i,2),teams(i,1)) = A(teams(i,2),teams(i,1)) + 1;
    A(teams(i,2),teams(i,2)) = A(teams(i,2),teams(i,2)) + 1;
    A(teams(i,2),teams(i,3)) = A(teams(i,2),teams(i,3)) + 1;
    A(teams(i,3),teams(i,1)) = A(teams(i,3),teams(i,1)) + 1;
    A(teams(i,3),teams(i,2)) = A(teams(i,3),teams(i,2)) + 1;
    A(teams(i,3),teams(i,3)) = A(teams(i,3),teams(i,3)) + 1;
    B(teams(i,1),1) = B(teams(i,1),1) + scores(i);
    B(teams(i,2),1) = B(teams(i,2),1) + scores(i);
    B(teams(i,3),1) = B(teams(i,3),1) + scores(i);
    B(teams(i,1),2) = B(teams(i,1),2) + diffscores(i);
    B(teams(i,2),2) = B(teams(i,2),2) + diffscores(i);
    B(teams(i,3),2) = B(teams(i,3),2) + diffscores(i);
end



Sorry it's taken so long, I've been somewhat busy the last few days at home.

The first one is ~0.025 sec and the second (around the for loop) is ~0.235 sec
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 02:59.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi