/*********************************************************************
 * This file is part of the PRAPI library.
 *
 * Copyright (C) 2001 Topi Mäenpää
 * All rights reserved.
 *
 * This program is free software. You can redistribute and/or modify
 * it under the terms of the free software licence found in the
 * accompanying file "COPYING". The licence terms must always be
 * redistributed with this source file. The above copyright notice
 * must be reproduced in all modified and unmodified copies of this
 * source file.
 *
 * $Revision: 1.1 $
 *********************************************************************/

#include "MultiClassifier.h"

using namespace util;

namespace prapi
{
	int RankCombiner::BordaCount::combineRanks(const util::List<util::List<int> >& rankings) const
	{
		List<int> counts(_iClassCount);
		counts.setLength(_iClassCount,0);
		for (int i=0;i<rankings.getLength();i++)
			for (int j=0;j<_iClassCount && j<rankings[i].getLength();j++)
				counts[j] += _iClassCount - rankings[i][j] - 1;

		int max = 0, winner = 0;
		for (int i=0;i<_iClassCount;i++)
			if (counts[i] > max)
				{
					max = counts[i];
					winner = i;
				}
		return winner;
	}	
}
