[Cs5500] Fwd: Questions
Karl Lieberherr
lieber at ccs.neu.edu
Tue Nov 1 17:42:02 EDT 2011
Hi Sandeep:
Thank you for double checking. So our playground will be good.
-- Karl
On Tue, Nov 1, 2011 at 5:25 PM, Sandeep Upendra Kamath <
kamath.s at husky.neu.edu> wrote:
>
> Dear Sir,
>
> The HSR playground has built in checks for both the cases.
> For the first case when a solution with cycles is given to the admin it
> will be declared invalid.
> Let me point to function that does that:
>
> private boolean lessThanEqualKBranches(HSRSolution s, int jarsBroken)
>
> {
>
> ----------> if*(jarsBroken > k*)
>
> {
>
> return false;
>
> }
>
> Since the first condition being checked in the underlined code is a
> terminating condition which checks that jars broken should not exceed "k"
> it will terminate when the condition is not satisfied returning false to
> the valid function. Hence a solution with cycles will be detected.
>
> For the second case let me point to the function in "HSRDomain.beh" file
> that checks for null pointers.
>
> private boolean areNodesValid(HSRSolution s)
> {
> java.util.List<Integer> internalNodes = buildIntList(getN());
> internalNodes.remove(0);
> java.util.List<Integer> leaves = buildIntList(getN());
> --------->return nodesValid(s, internalNodes, leaves) &&*internalNodes.isEmpty() && leaves.isEmpty();
> *
> }
>
> The last line in the code checks for leaves node and internal node being
> empty. If any of them are found to have null values it returns false
> resulting in the valid function returning false which means that the avatar
> who proposed an invalid solution is then kicked out by the admin.
>
> Kindly let us know if you need anything else from us.
>
> Regards,
> Team Navi
>
>
-------------- next part --------------
HTML attachment scrubbed and removed
More information about the Cs5500
mailing list