Remove redundant initial state in sims
This commit is contained in:
+2
-2
@@ -20,7 +20,7 @@ public sealed class MCTS
|
||||
public MCTS(in MCTSConfig config, in SimulationState state)
|
||||
{
|
||||
this.config = config;
|
||||
var sim = new Simulator(state, config.MaxStepCount);
|
||||
var sim = new Simulator(config.MaxStepCount);
|
||||
rootNode = new(new(
|
||||
state,
|
||||
null,
|
||||
@@ -280,7 +280,7 @@ public sealed class MCTS
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void Search(int iterations, CancellationToken token)
|
||||
{
|
||||
Simulator simulator = new(rootNode.State.State, config.MaxStepCount);
|
||||
Simulator simulator = new(config.MaxStepCount);
|
||||
var random = rootNode.State.State.Input.Random;
|
||||
var n = 0;
|
||||
for (var i = 0; i < iterations || MaxScore == 0; i++)
|
||||
|
||||
+1
-1
@@ -20,7 +20,7 @@ internal sealed class Simulator : SimulatorNoRandom
|
||||
}
|
||||
}
|
||||
|
||||
public Simulator(in SimulationState state, int maxStepCount) : base(state)
|
||||
public Simulator(int maxStepCount)
|
||||
{
|
||||
this.maxStepCount = maxStepCount;
|
||||
}
|
||||
|
||||
+3
-3
@@ -116,7 +116,7 @@ public sealed class Solver : IDisposable
|
||||
var bestSims = new List<(float Score, SolverSolution Result)>();
|
||||
|
||||
var state = State;
|
||||
var sim = new Simulator(state, Config.MaxStepCount);
|
||||
var sim = new Simulator(Config.MaxStepCount);
|
||||
|
||||
var activeStates = new List<SolverSolution>() { new(Array.Empty<ActionType>(), state) };
|
||||
|
||||
@@ -240,7 +240,7 @@ public sealed class Solver : IDisposable
|
||||
{
|
||||
var actions = new List<ActionType>();
|
||||
var state = State;
|
||||
var sim = new Simulator(state, Config.MaxStepCount);
|
||||
var sim = new Simulator(Config.MaxStepCount);
|
||||
while (true)
|
||||
{
|
||||
Token.ThrowIfCancellationRequested();
|
||||
@@ -303,7 +303,7 @@ public sealed class Solver : IDisposable
|
||||
{
|
||||
var actions = new List<ActionType>();
|
||||
var state = State;
|
||||
var sim = new Simulator(state, Config.MaxStepCount);
|
||||
var sim = new Simulator(Config.MaxStepCount);
|
||||
while (true)
|
||||
{
|
||||
Token.ThrowIfCancellationRequested();
|
||||
|
||||
Reference in New Issue
Block a user