Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LunchSet failed (ArgumentError) #2

Open
JimMcKenzieSmith opened this issue Sep 25, 2014 · 10 comments
Open

LunchSet failed (ArgumentError) #2

JimMcKenzieSmith opened this issue Sep 25, 2014 · 10 comments

Comments

@JimMcKenzieSmith
Copy link

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>'
@dlio
Copy link

dlio commented Dec 4, 2014

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

@JimMcKenzieSmith
Copy link
Author

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

@dlio
Copy link

dlio commented Dec 4, 2014

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
Copy link

dlio commented Dec 4, 2014

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.

@fredbenenson
Copy link
Owner

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.

@dlio
Copy link

dlio commented Dec 5, 2014

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
Copy link

dlio commented Dec 5, 2014

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.

@flex-tuan
Copy link

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!

@jeffjeffjeffrey
Copy link
Collaborator

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!

@ghost
Copy link

ghost commented Apr 5, 2018

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants