Skip to content

Commit

Permalink
Fast no-blocking score
Browse files Browse the repository at this point in the history
  • Loading branch information
foxtran committed Jul 8, 2023
1 parent 94a92ff commit ab8ebb1
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions Icfpc2023/Scoring.fs
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,24 @@ let private CalculateAttendeeScore (musicians: Musician[]) (attendee: Attendee):
else CalculateAttendeeMusicianScore attendee musician
)

let private CalculateAttendeeNoBlockingScore (musicians: Musician[]) (attendee: Attendee): Score =
Seq.indexed musicians
|> Seq.sumBy(fun (i, musician) ->
CalculateAttendeeMusicianScore attendee musician
)

let CalculateScore(problem: Problem) (solution: Solution): Score =
let musicians =
problem.Musicians
|> Seq.zip solution.Placements
|> Seq.map(fun(p, i) -> { Instrument = i; Location = p })
|> Seq.toArray
problem.Attendees |> Array.sumBy(CalculateAttendeeScore musicians)

let CalculateNoBlockingScore(problem: Problem) (solution: Solution): Score =
let musicians =
problem.Musicians
|> Seq.zip solution.Placements
|> Seq.map(fun(p, i) -> { Instrument = i; Location = p })
|> Seq.toArray
problem.Attendees |> Array.sumBy(CalculateAttendeeNoBlokingScore musicians)

Check failure on line 49 in Icfpc2023/Scoring.fs

View workflow job for this annotation

GitHub Actions / main.macos

The value or constructor 'CalculateAttendeeNoBlokingScore' is not defined. Maybe you want one of the following:� CalculateAttendeeNoBlockingScore� CalculateAttendeeScore� CalculateAttendeeMusicianScore

Check failure on line 49 in Icfpc2023/Scoring.fs

View workflow job for this annotation

GitHub Actions / main.macos

The value or constructor 'CalculateAttendeeNoBlokingScore' is not defined. Maybe you want one of the following:� CalculateAttendeeNoBlockingScore� CalculateAttendeeScore� CalculateAttendeeMusicianScore

Check failure on line 49 in Icfpc2023/Scoring.fs

View workflow job for this annotation

GitHub Actions / main.linux

The value or constructor 'CalculateAttendeeNoBlokingScore' is not defined. Maybe you want one of the following:� CalculateAttendeeNoBlockingScore� CalculateAttendeeScore� CalculateAttendeeMusicianScore

Check failure on line 49 in Icfpc2023/Scoring.fs

View workflow job for this annotation

GitHub Actions / main.linux

The value or constructor 'CalculateAttendeeNoBlokingScore' is not defined. Maybe you want one of the following:� CalculateAttendeeNoBlockingScore� CalculateAttendeeScore� CalculateAttendeeMusicianScore

Check failure on line 49 in Icfpc2023/Scoring.fs

View workflow job for this annotation

GitHub Actions / main.windows

The value or constructor 'CalculateAttendeeNoBlokingScore' is not defined. Maybe you want one of the following:� CalculateAttendeeNoBlockingScore� CalculateAttendeeScore� CalculateAttendeeMusicianScore

Check failure on line 49 in Icfpc2023/Scoring.fs

View workflow job for this annotation

GitHub Actions / main.windows

The value or constructor 'CalculateAttendeeNoBlokingScore' is not defined. Maybe you want one of the following:� CalculateAttendeeNoBlockingScore� CalculateAttendeeScore� CalculateAttendeeMusicianScore

0 comments on commit ab8ebb1

Please sign in to comment.