Expand macros generated by solver

This commit is contained in:
Asriel Camora
2023-07-14 23:45:34 +04:00
parent 23dd60bb34
commit 5ab53f56b9
2 changed files with 38 additions and 26 deletions
+25 -23
View File
@@ -54,20 +54,26 @@ internal static class Program
var sim = new SimulatorNoRandom(new(input)); var sim = new SimulatorNoRandom(new(input));
(_, var state) = sim.Execute(new(input), ActionType.MuscleMemory); (_, var state) = sim.Execute(new(input), ActionType.MuscleMemory);
(_, state) = sim.Execute(state, ActionType.PrudentTouch); (_, state) = sim.Execute(state, ActionType.PrudentTouch);
(_, state) = sim.Execute(state, ActionType.Manipulation); //(_, state) = sim.Execute(state, ActionType.Manipulation);
(_, state) = sim.Execute(state, ActionType.Veneration); //(_, state) = sim.Execute(state, ActionType.Veneration);
(_, state) = sim.Execute(state, ActionType.WasteNot); //(_, state) = sim.Execute(state, ActionType.WasteNot);
(_, state) = sim.Execute(state, ActionType.Groundwork); //(_, state) = sim.Execute(state, ActionType.Groundwork);
(_, state) = sim.Execute(state, ActionType.Groundwork); //(_, state) = sim.Execute(state, ActionType.Groundwork);
(_, state) = sim.Execute(state, ActionType.Groundwork); //(_, state) = sim.Execute(state, ActionType.Groundwork);
(_, state) = sim.Execute(state, ActionType.Innovation); //(_, state) = sim.Execute(state, ActionType.Innovation);
(_, state) = sim.Execute(state, ActionType.PrudentTouch); //(_, state) = sim.Execute(state, ActionType.PrudentTouch);
(_, state) = sim.Execute(state, ActionType.AdvancedTouchCombo); //(_, state) = sim.Execute(state, ActionType.AdvancedTouchCombo);
(_, state) = sim.Execute(state, ActionType.Manipulation); //(_, state) = sim.Execute(state, ActionType.Manipulation);
(_, state) = sim.Execute(state, ActionType.Innovation); //(_, state) = sim.Execute(state, ActionType.Innovation);
(_, state) = sim.Execute(state, ActionType.PrudentTouch); //(_, state) = sim.Execute(state, ActionType.PrudentTouch);
(_, state) = sim.Execute(state, ActionType.AdvancedTouchCombo); //(_, state) = sim.Execute(state, ActionType.AdvancedTouchCombo);
(_, state) = sim.Execute(state, ActionType.GreatStrides); //(_, state) = sim.Execute(state, ActionType.GreatStrides);
//(_, state) = sim.Execute(state, ActionType.Innovation);
//(_, state) = sim.Execute(state, ActionType.FocusedTouchCombo);
//(_, state) = sim.Execute(state, ActionType.GreatStrides);
//(_, state) = sim.Execute(state, ActionType.ByregotsBlessing);
//(_, state) = sim.Execute(state, ActionType.CarefulSynthesis);
//(_, state) = sim.Execute(state, ActionType.CarefulSynthesis);
Console.WriteLine($"{state.Quality} {state.CP} {state.Progress} {state.Durability}"); Console.WriteLine($"{state.Quality} {state.CP} {state.Progress} {state.Durability}");
//return; //return;
@@ -75,21 +81,17 @@ internal static class Program
Console.WriteLine($"Qual: {s.Quality}/{s.Input.Recipe.MaxQuality}"); Console.WriteLine($"Qual: {s.Quality}/{s.Input.Recipe.MaxQuality}");
return; return;
for (var i = 0; i < 7; ++i) Solver.Crafty.Solver.SearchStepwiseFurcated(config, input);
{ //Benchmark(() => );
Console.WriteLine($"{i + 1}");
var c = config with { FurcatedActionCount = i + 1 };
Benchmark(() => Solver.Crafty.Solver.SearchStepwiseFurcated(c, input).State);
}
} }
private static void Benchmark(Func<SimulationState> search) private static void Benchmark(Func<SolverSolution> search)
{ {
var s = Stopwatch.StartNew(); var s = Stopwatch.StartNew();
List<int> q = new(); List<int> q = new();
for (var i = 0; i < 60; ++i) for (var i = 0; i < 15; ++i)
{ {
var state = search(); var state = search().State;
//Console.WriteLine($"Qual: {state.Quality}/{state.Input.Recipe.MaxQuality}"); //Console.WriteLine($"Qual: {state.Quality}/{state.Input.Recipe.MaxQuality}");
q.Add(state.Quality); q.Add(state.Quality);
+11 -1
View File
@@ -1,3 +1,4 @@
using Craftimizer.Simulator;
using Craftimizer.Simulator.Actions; using Craftimizer.Simulator.Actions;
using Dalamud.Interface.Windowing; using Dalamud.Interface.Windowing;
using System; using System;
@@ -15,10 +16,19 @@ public sealed partial class SimulatorWindow : Window, IDisposable
private void AppendGeneratedAction(ActionType action) private void AppendGeneratedAction(ActionType action)
{ {
var tooltip = action.Base().GetTooltip(Simulator, false); var actionBase = action.Base();
if (actionBase is BaseComboAction comboActionBase)
{
AppendGeneratedAction(comboActionBase.ActionTypeA);
AppendGeneratedAction(comboActionBase.ActionTypeB);
}
else
{
var tooltip = actionBase.GetTooltip(Simulator, false);
var (response, state) = Simulator.Execute(LatestState, action); var (response, state) = Simulator.Execute(LatestState, action);
Actions.Add((action, tooltip, response, state)); Actions.Add((action, tooltip, response, state));
} }
}
private void RemoveAction(int actionIndex) private void RemoveAction(int actionIndex)
{ {