Skip to content

Commit d10332f

Browse files
committed
Update solver
1 parent b9da027 commit d10332f

5 files changed

Lines changed: 26 additions & 64 deletions

File tree

Craftimizer/Windows/Settings.cs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -667,15 +667,8 @@ ref isDirty
667667
v => config = config with { Adversarial = v },
668668
ref isDirty
669669
);
670-
DrawOption(
671-
"Minimize Steps",
672-
"Minimizes the number of crafting steps.",
673-
config.MinimizeSteps,
674-
v => config = config with { MinimizeSteps = v },
675-
ref isDirty
676-
);
677670

678-
if (config.MinimizeSteps && config.Adversarial)
671+
if (config.Adversarial)
679672
{
680673
ImGui.SameLine();
681674
using (var color = ImRaii.PushColor(ImGuiCol.Text, ImGuiColors.DalamudOrange))
@@ -684,7 +677,7 @@ ref isDirty
684677
ImGui.TextUnformatted(FontAwesomeIcon.ExclamationCircle.ToIconString());
685678
}
686679
if (ImGui.IsItemHovered())
687-
ImGuiUtils.TooltipWrapped("Combining \"Minimize Steps\" and \"Ensure Reliability\" will significantly increase solve times.");
680+
ImGuiUtils.TooltipWrapped("\"Ensure Reliability\" uses a lot more memory and can significantly increase solve times.");
688681
}
689682
}
690683
}

Craftimizer/packages.lock.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@
3636
},
3737
"Raphael.Net": {
3838
"type": "Transitive",
39-
"resolved": "2.1.1",
40-
"contentHash": "4+7HyDa7lVokXObqv8ADeTgi74Cz7W99N07DYtzuOXEt6tJtMlJt8RxLGoPtakVf1mURDMuD5kDKw0oz3EaoDA=="
39+
"resolved": "3.0.0",
40+
"contentHash": "9yY+jR2gddw52HtShBL/JikQ4gZa8lxFYSUIi2y510HLsaK86iqtuRgrv8/akrHR66QRWEPtmHXyehW1hrmP9Q=="
4141
},
4242
"System.IO.Hashing": {
4343
"type": "Transitive",
@@ -52,15 +52,15 @@
5252
"dependencies": {
5353
"Craftimizer.Simulator": "[1.0.0, )",
5454
"DotNext": "[5.21.0, )",
55-
"Raphael.Net": "[2.1.1, )"
55+
"Raphael.Net": "[3.0.0, )"
5656
}
5757
}
5858
},
5959
"net9.0-windows7.0/win-x64": {
6060
"Raphael.Net": {
6161
"type": "Transitive",
62-
"resolved": "2.1.1",
63-
"contentHash": "4+7HyDa7lVokXObqv8ADeTgi74Cz7W99N07DYtzuOXEt6tJtMlJt8RxLGoPtakVf1mURDMuD5kDKw0oz3EaoDA=="
62+
"resolved": "3.0.0",
63+
"contentHash": "9yY+jR2gddw52HtShBL/JikQ4gZa8lxFYSUIi2y510HLsaK86iqtuRgrv8/akrHR66QRWEPtmHXyehW1hrmP9Q=="
6464
}
6565
}
6666
}

Solver/Craftimizer.Solver.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<PrivateAssets>all</PrivateAssets>
1616
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
1717
</PackageReference>
18-
<PackageReference Include="Raphael.Net" Version="2.1.1" />
18+
<PackageReference Include="Raphael.Net" Version="3.0.0" />
1919
</ItemGroup>
2020

2121
<ItemGroup>

Solver/Solver.cs

Lines changed: 18 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -205,56 +205,26 @@ void OnProgress(nuint p)
205205
void Log(string s) =>
206206
OnLog?.Invoke(s);
207207

208-
if (!Config.MinimizeSteps)
208+
Raphael.SolverConfig config = new()
209209
{
210-
Raphael.SolverConfig config = new()
211-
{
212-
Adversarial = Config.Adversarial,
213-
BackloadProgress = true,
214-
UnsoundBranchPruning = true,
215-
LogLevel = Raphael.LevelFilter.Debug,
216-
ThreadCount = (ushort)Config.MaxThreadCount,
217-
};
218-
219-
using var solver = new Raphael.Solver(in config, in input, pool);
220-
221-
solver.OnFinish += OnFinish;
222-
solver.OnSuggestSolution += OnSuggestSolution;
223-
solver.OnProgress += OnProgress;
224-
solver.OnLog += Log;
225-
226-
progressStage = 0;
227-
progress = 0;
228-
await using var registration = Token.Register(solver.Cancel).ConfigureAwait(true);
229-
await Task.Run(solver.Solve, Token).ConfigureAwait(true);
230-
Token.ThrowIfCancellationRequested();
231-
}
210+
Adversarial = Config.Adversarial,
211+
BackloadProgress = Config.BackloadProgress,
212+
LogLevel = Raphael.LevelFilter.Debug,
213+
ThreadCount = (ushort)Config.MaxThreadCount,
214+
};
232215

233-
var state = solution != null ? (SimulationState?)ExecuteActions(solution) : null;
234-
if (solution == null || state?.Quality != state?.Input.Recipe.MaxQuality)
235-
{
236-
Raphael.SolverConfig config = new()
237-
{
238-
Adversarial = Config.Adversarial,
239-
BackloadProgress = Config.BackloadProgress,
240-
UnsoundBranchPruning = false,
241-
LogLevel = Raphael.LevelFilter.Debug,
242-
ThreadCount = (ushort)Config.MaxThreadCount,
243-
};
244-
245-
using var solver = new Raphael.Solver(in config, in input, pool);
246-
247-
solver.OnFinish += OnFinish;
248-
solver.OnSuggestSolution += OnSuggestSolution;
249-
solver.OnProgress += OnProgress;
250-
solver.OnLog += Log;
251-
252-
progressStage = 0;
253-
progress = 0;
254-
await using var registration = Token.Register(solver.Cancel).ConfigureAwait(true);
255-
await Task.Run(solver.Solve, Token).ConfigureAwait(true);
256-
Token.ThrowIfCancellationRequested();
257-
}
216+
using var solver = new Raphael.Solver(in config, in input, pool);
217+
218+
solver.OnFinish += OnFinish;
219+
solver.OnSuggestSolution += OnSuggestSolution;
220+
solver.OnProgress += OnProgress;
221+
solver.OnLog += Log;
222+
223+
progressStage = 0;
224+
progress = 0;
225+
await using var registration = Token.Register(solver.Cancel).ConfigureAwait(true);
226+
await Task.Run(solver.Solve, Token).ConfigureAwait(true);
227+
Token.ThrowIfCancellationRequested();
258228

259229
if (solution == null)
260230
return new([], State);

Solver/SolverConfig.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ public readonly record struct SolverConfig
3838
// Raphael/A* configuration
3939
public bool Adversarial { get; init; }
4040
public bool BackloadProgress { get; init; }
41-
public bool MinimizeSteps { get; init; }
4241

4342
public int MaxThreadCount { get; init; }
4443
public ActionType[] ActionPool { get; init; }

0 commit comments

Comments
 (0)