@@ -295,16 +295,18 @@ type internal AISearcher(oracle: Oracle, aiAgentTrainingMode: Option<AIAgentTrai
295295
296296 OrtValue.CreateTensorValueFromMemory( attributes, shape)
297297
298- let states , numOfParentOfEdges , numOfHistoryEdges =
298+ let states , numOfParentOfEdges , numOfPathConditionEdges , numOfHistoryEdges =
299299 let mutable numOfParentOfEdges = 0
300+ let mutable numOfPathConditionEdges = 0
300301 let mutable numOfHistoryEdges = 0
301302 let shape = [| int64 gameState.States.Length; numOfStateAttributes |]
302303 let attributes = Array.zeroCreate ( gameState.States.Length * numOfStateAttributes)
303304
304305 for i in 0 .. gameState.States.Length - 1 do
305306 let v = gameState.States.[ i]
306- numOfHistoryEdges <- numOfHistoryEdges + v.History.Length
307307 numOfParentOfEdges <- numOfParentOfEdges + v.Children.Length
308+ numOfPathConditionEdges <- numOfPathConditionEdges + v.PathCondition.Length
309+ numOfHistoryEdges <- numOfHistoryEdges + v.History.Length
308310 stateIds.Add( v.Id, i)
309311 let j = i * numOfStateAttributes
310312 attributes.[ j] <- float32 v.Position
@@ -314,7 +316,7 @@ type internal AISearcher(oracle: Oracle, aiAgentTrainingMode: Option<AIAgentTrai
314316 attributes.[ j + 4 ] <- float32 v.StepWhenMovedLastTime
315317 attributes.[ j + 5 ] <- float32 v.InstructionsVisitedInCurrentBlock
316318
317- OrtValue.CreateTensorValueFromMemory( attributes, shape), numOfParentOfEdges, numOfHistoryEdges
319+ OrtValue.CreateTensorValueFromMemory( attributes, shape), numOfParentOfEdges, numOfPathConditionEdges , numOfHistoryEdges
318320
319321 let pcToPcEdgeIndex =
320322 let shapeOfIndex = [| 2 L; numOfPcToPcEdges |]
@@ -361,8 +363,8 @@ type internal AISearcher(oracle: Oracle, aiAgentTrainingMode: Option<AIAgentTrai
361363 let parentOf = Array.zeroCreate ( 2 * numOfParentOfEdges)
362364 let shapeOfHistory = [| 2 L; numOfHistoryEdges |]
363365 let historyIndex_vertexToState = Array.zeroCreate ( 2 * numOfHistoryEdges)
364- let shapeOfPcToState = [| 2 L; gameState.States.Length |]
365- let index_pcToState = Array.zeroCreate ( 2 * gameState.States.Length )
366+ let shapeOfPcToState = [| 2 L; numOfPathConditionEdges |]
367+ let index_pcToState = Array.zeroCreate ( 2 * numOfPathConditionEdges )
366368
367369 let shapeOfHistoryAttributes =
368370 [| int64 numOfHistoryEdges; int64 numOfHistoryEdgeAttributes |]
@@ -383,13 +385,13 @@ type internal AISearcher(oracle: Oracle, aiAgentTrainingMode: Option<AIAgentTrai
383385
384386 firstFreePositionInParentsOf <- firstFreePositionInParentsOf + state.Children.Length
385387
386- index _ pcToState .[ firstFreePositionInPcToState ] <-
387- int64 pathConditionVerticesIds [ state.PathCondition.Id ]
388-
389- index _ pcToState .[ firstFreePositionInPcToState + gameState.States.Length ] <-
390- int64 stateIds[ state.Id]
391-
392- firstFreePositionInPcToState <- firstFreePositionInPcToState + 1
388+ state.PathCondition
389+ |> Array.iteri ( fun i pcId ->
390+ let j = firstFreePositionInPcToState + i
391+ index _ pcToState [ j ] <- int64 pathConditionVerticesIds [ pcId ]
392+ index _ pcToState [ numOfPathConditionEdges + j ] <- int64 stateIds[ state.Id])
393+
394+ firstFreePositionInPcToState <- firstFreePositionInPcToState + state.PathCondition.Length
393395
394396 state.History
395397 |> Array.iteri ( fun i historyElem ->
0 commit comments