lunch-roulette icon indicating copy to clipboard operation
lunch-roulette copied to clipboard

LunchSet failed (ArgumentError)

Open JimMcKenzieSmith opened this issue 10 years ago • 10 comments

Hi Fred,

Will you help me understand why I am getting this error?

Here is my staff data, which is example.csv below: https://docs.google.com/spreadsheet/ccc?key=0AkcfyAeGuuGVdGhUS0tvSmJQN2VxeW1lSG80STd0MFE&usp=sharing

Here is the output:

jimsmith@it-sweng01:~/workspace/lunch-roulette$ ruby lib/lunch_roulette.rb -v data/example.csv 
Generating  sets...
Invalid Sets: 918
Valid Sets: 82
lib/lunch_roulette.rb:82:in `sort': comparison of LunchRoulette::LunchSet with LunchRoulette::LunchSet failed (ArgumentError)
    from lib/lunch_roulette.rb:82:in `spin!'
    from lib/lunch_roulette.rb:101:in `<main>'

JimMcKenzieSmith avatar Sep 25 '14 22:09 JimMcKenzieSmith

I'm seeing the same issue myself. Were you ever able to resolve this Jim?

dlio avatar Dec 04 '14 23:12 dlio

No, I do not yet have a resolution for this.

JimMcKenzieSmith avatar Dec 04 '14 23:12 JimMcKenzieSmith

I've tried a few different ruby versions, so I don't think that's it. I came across this: https://bugs.ruby-lang.org/issues/4517 Poking around with irb now...

dlio avatar Dec 04 '14 23:12 dlio

testing with

    candidates.each do |candidate|
      ap candidate.score
      ap candidate
      sleep 10
    end

inserted at line 83 of lunch_roulette.rb (with require 'ap' at the top)

looks like some scores are NaN (not a number). I'll dump all scores into their own array and to some type checking. I think the problem is with trying to sort across different object types.

dlio avatar Dec 04 '14 23:12 dlio

Hey guys sorry about the bug, and thanks for digging in. Could definitely be a Ruby version issue. Will try to take a look soon.

fredbenenson avatar Dec 04 '14 23:12 fredbenenson

No worries; thanks for the ping. I tried on 1.9.3 and 2.1.5 to no avail. I'll try some more once I compile them through rvm.

dlio avatar Dec 05 '14 00:12 dlio

I'm seeing the following when I do a run with 1000 sets and print the scores of all candidates:

Generating 1000 sets...
Invalid Sets: 985
Valid Sets: 15
[
    [ 0] NaN,
    [ 1] NaN,
    [ 2] NaN,
    [ 3] NaN,
    [ 4] NaN,
    [ 5] NaN,
    [ 6] NaN,
    [ 7] NaN,
    [ 8] NaN,
    [ 9] NaN,
    [10] NaN,
    [11] NaN,
    [12] NaN,
    [13] NaN,
    [14] NaN
]

So the issue might be upstream in the score calculation.

dlio avatar Dec 05 '14 00:12 dlio

I think this is great! I got this result after downloading the repo and running it with the supplied csv:

$ ruby lib/lunch_roulette.rb -v data/staff.csv
Generating  sets...
Invalid Sets: 1000
Valid Sets: 0
No valid sets generated, sorry.

Any ideas what i'm doing wrong? Thanks!

flex-tuan avatar Jan 13 '16 02:01 flex-tuan

Hey @flex-tuan, glad you like it! Sometimes it's possible for the weights and thresholds in mappings_and_weights.yml to be too strict for your particular set of people to afford a valid lunch set. If you're just using the supplied csv, then it's quite possible that that file is out of date compared with other changes that we've made to the algo. I'll look into it!

jeffjeffjeffrey avatar Jan 13 '16 15:01 jeffjeffjeffrey

Great idea, thanks for releasing it out to the community! PS - I am also getting "No valid sets generated, sorry." What are some of the factors that could be changed to avoir this message? I've tried to change our staff file with it's respective teams and specialties as close as possible to the one provided. My file has about 500 people in it. Any suggestions as per how many specialties and titles are required to make it work with that amount of ppl? Update: I've tweaked the logic for specialties as the ratios were not quite the same as those in the original sample.

ghost avatar Apr 05 '18 22:04 ghost