Skip to content

Commit

Permalink
Adapted to new google forms
Browse files Browse the repository at this point in the history
  • Loading branch information
Droppel committed Aug 26, 2023
1 parent c27c9f4 commit 960020e
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 18 deletions.
19 changes: 11 additions & 8 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@ const (
randSeed = true
seed = 42

threads = 1
episodes = 1000000
inputname = "input.csv"
slotname = "slots.csv"
threads = 6
episodes = 100000
inputname = "input.csv"
slotname = "slots.csv"
thresholdForSave = -100
)

var (
Expand Down Expand Up @@ -95,13 +96,15 @@ func calcSeed(threadId int, groupsInput genome.GroupList, optionsInput []genome.
}
solutionString := bestSolution.ToString(bestScore, seed)

fmt.Print(solutionString)
if bestScore >= -20 {
// fmt.Print(solutionString)
if bestScore >= thresholdForSave {
os.WriteFile(fmt.Sprintf("scores/Score%d-%d.txt", bestScore, seed), []byte(solutionString), os.ModeAppend)
}
fmt.Println(bestScore)
output := fmt.Sprintf("Thread %d: Running with seed %d finished:\n", threadId, seed)
output += fmt.Sprintf("%v\n", bestScore)
_, resultSpread := calcScore(bestSolution)
fmt.Printf("First: %d, Second: %d, Third: %d, None: %d\n", resultSpread[0], resultSpread[1], resultSpread[2], resultSpread[3])
output += fmt.Sprintf("First: %d, Second: %d, Third: %d, None: %d\n", resultSpread[0], resultSpread[1], resultSpread[2], resultSpread[3])
fmt.Println(output)
}
}

Expand Down
6 changes: 3 additions & 3 deletions parser/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,16 +60,16 @@ func ParseChoices(filename string) (genome.GroupList, error) {

groups := make([]genome.Group, 0)
for id, groupSettings := range records[1:] {
size, _ := strconv.Atoi(groupSettings[1])
size, _ := strconv.Atoi(groupSettings[2])
group := genome.Group{
Id: id,
Members: groupSettings[2],
Members: groupSettings[3],
Size: size,
CurrentSelection: -1,
}

choices := make([]int, 3)
for i, column := range groupSettings[3:] {
for i, column := range groupSettings[4:] {
if column == dontCareWord {
choices[i] = -1
} else {
Expand Down
15 changes: 8 additions & 7 deletions slots.csv
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
0,6
0,5
0,5
0,6
0,6
0,6
1,6
1,5
1,6
1,6
1,6
2,6
2,6
2,2
2,6
2,6
3,6
3,6
3,6
3,6
4,6
4,6
4,5
4,6
4,6
5,6
Expand All @@ -25,7 +25,8 @@
6,6
6,6
6,6
7,2
7,6
6,6
7,5
7,5
7,6
7,6

0 comments on commit 960020e

Please sign in to comment.