This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ticket := &pb.Ticket{ | |
SearchFields: &pb.SearchFields{ | |
DoubleArgs: map[string]float64{ | |
"skill": generateSkill(), | |
}, | |
}, | |
} | |
func generateSkill() float64 { | |
skill := rand.NormFloat64()*1.5 + 3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ticket := &pb.Ticket{ | |
SearchFields: &pb.SearchFields{ | |
DoubleArgs: map[string]float64{ | |
"skill": generateSkill(), | |
}, | |
}, | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func makeMatches(p *pb.MatchProfile, poolTickets map[string][]*pb.Ticket) ([]*pb.Match, error) { | |
// Create a collection to hold match proposals | |
var matches []*pb.Match | |
count := 0 | |
for { | |
insufficientTickets := false | |
// Create a collection to hold tickets selected for a match | |
matchTickets := []*pb.Ticket{} | |
for pool, tickets := range poolTickets { | |
// Set flag if there are not enough tickets to create a match |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var profiles []*pb.MatchProfile | |
for i := 0; i <= 3; i++ { | |
p = append(p, &pb.MatchProfile{ | |
Name: fmt.Sprintf("Profile_%v-%v", i, i+2), | |
Pools: []*pb.Pool{ | |
{ | |
Name: poolName, | |
DoubleRangeFilters: []*pb.DoubleRangeFilter{ | |
{ | |
DoubleArg: "skill", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func makeMatches(p *pb.MatchProfile, poolTickets map[string][]*pb.Ticket) ([]*pb.Match, error) { | |
// Create a colletion to hold match proposals | |
var matches []*pb.Match | |
count := 0 | |
for { | |
insufficientTickets := false | |
// Create a collection to hold tickets selected for a match | |
matchTickets := []*pb.Ticket{} | |
for pool, tickets := range poolTickets { | |
// Set flag if there are not enough tickets to create a match |