|
@@ -136,7 +136,6 @@ func max(a, b int) int {
|
136
|
136
|
}
|
137
|
137
|
|
138
|
138
|
var bestTotalScore int
|
139
|
|
-var movingFromDepth int
|
140
|
139
|
|
141
|
140
|
func save() {
|
142
|
141
|
if bestTotalScore < 10900000 {
|
|
@@ -217,8 +216,6 @@ func (c *Car) pickRandomRide() *Ride {
|
217
|
216
|
return nil
|
218
|
217
|
}
|
219
|
218
|
|
220
|
|
-var shots int
|
221
|
|
-
|
222
|
219
|
// invariant : when entering and leaving function,
|
223
|
220
|
// Sched has the "same" heap. Same means successive
|
224
|
221
|
// popped values will be the same (but the internal
|
|
@@ -232,27 +229,13 @@ func Choose(cumulativeScore int, depth int, fromDepth int) (int, bool) {
|
232
|
229
|
c := Sched.Pop()
|
233
|
230
|
if c == nil {
|
234
|
231
|
// At this point we have a complete configuration
|
|
232
|
+ fmt.Printf("score obtained: %d depth: %d\n", cumulativeScore, depth)
|
235
|
233
|
if cumulativeScore >= bestTotalScore {
|
236
|
|
- if cumulativeScore != bestTotalScore {
|
237
|
|
- save()
|
238
|
|
- bestTotalScore = cumulativeScore
|
239
|
|
- // movingFromDepth = fromDepth
|
240
|
|
- shots = 0
|
241
|
|
- movingFromDepth += 1
|
242
|
|
- }
|
243
|
|
- shots += 1
|
244
|
|
- if shots-1 == 1 {
|
245
|
|
- shots = 0
|
246
|
|
- movingFromDepth += 1
|
247
|
|
- }
|
|
234
|
+ bestTotalScore = cumulativeScore
|
248
|
235
|
// Go back to random depth and make a new change
|
249
|
|
- // rnd := rand.Intn(depth-movingFromDepth-1) + 1 + movingFromDepth
|
250
|
|
- rnd := movingFromDepth
|
251
|
|
- fmt.Printf("best score! %d depth: %d fromDepth: %d movingFromDepth: %d rnd: %d\n", cumulativeScore, depth, fromDepth, movingFromDepth, rnd)
|
252
|
|
- return rnd, false
|
|
236
|
+ return rand.Intn(depth), false
|
253
|
237
|
} else {
|
254
|
238
|
// Go back to fix change that lowered our score
|
255
|
|
- fmt.Printf("lesser score: %d depth: %d fromDepth: %d movingFromDepth: %d\n", cumulativeScore, depth, fromDepth, movingFromDepth)
|
256
|
239
|
return fromDepth, true
|
257
|
240
|
}
|
258
|
241
|
}
|
|
@@ -285,7 +268,7 @@ func Choose(cumulativeScore int, depth int, fromDepth int) (int, bool) {
|
285
|
268
|
}
|
286
|
269
|
|
287
|
270
|
func solve() {
|
288
|
|
- rand.Seed(100000)
|
|
271
|
+ rand.Seed(1)
|
289
|
272
|
|
290
|
273
|
sort.Sort(ByEndtime(Rides))
|
291
|
274
|
|