Skip to content

Commit 3a81820

Browse files
committed
replaced numOfPathConditionEdjes
1 parent 48570e5 commit 3a81820

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

VSharp.Explorer/AISearcher.fs

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -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, numOfPathConditionEdjes, numOfHistoryEdges =
299299
let mutable numOfParentOfEdges = 0
300+
let mutable numOfPathConditionEdjes = 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+
numOfPathConditionEdjes <- numOfPathConditionEdjes + 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, numOfPathConditionEdjes, numOfHistoryEdges
318320

319321
let pcToPcEdgeIndex =
320322
let shapeOfIndex = [| 2L; numOfPcToPcEdges |]
@@ -361,12 +363,8 @@ type internal AISearcher(oracle: Oracle, aiAgentTrainingMode: Option<AIAgentTrai
361363
let parentOf = Array.zeroCreate (2 * numOfParentOfEdges)
362364
let shapeOfHistory = [| 2L; numOfHistoryEdges |]
363365
let historyIndex_vertexToState = Array.zeroCreate (2 * numOfHistoryEdges)
364-
365-
let pathConditionNum =
366-
gameState.States
367-
|> Array.sumBy(fun s -> s.PathCondition.Length)
368-
let shapeOfPcToState = [| 2L; pathConditionNum |]
369-
let index_pcToState = Array.zeroCreate (2 * pathConditionNum)
366+
let shapeOfPcToState = [| 2L; numOfPathConditionEdjes |]
367+
let index_pcToState = Array.zeroCreate (2 * numOfPathConditionEdjes)
370368

371369
let shapeOfHistoryAttributes =
372370
[| int64 numOfHistoryEdges; int64 numOfHistoryEdgeAttributes |]
@@ -391,7 +389,7 @@ type internal AISearcher(oracle: Oracle, aiAgentTrainingMode: Option<AIAgentTrai
391389
|> Array.iteri (fun i pcId ->
392390
let j = firstFreePositionInPcToState + i
393391
index_pcToState[j] <- int64 pathConditionVerticesIds[pcId]
394-
index_pcToState[pathConditionNum + j] <- int64 stateIds[state.Id])
392+
index_pcToState[numOfPathConditionEdjes + j] <- int64 stateIds[state.Id])
395393

396394
firstFreePositionInPcToState <- firstFreePositionInPcToState + state.PathCondition.Length
397395

0 commit comments

Comments
 (0)