Skip to content

Commit

Permalink
Remove tracing
Browse files Browse the repository at this point in the history
  • Loading branch information
WorkingRobot committed Nov 5, 2023
1 parent 3167b0d commit e07617f
Show file tree
Hide file tree
Showing 10 changed files with 10 additions and 97 deletions.
7 changes: 1 addition & 6 deletions Benchmark/Craftimizer.Benchmark.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Platforms>x64</Platforms>
<Configurations>Debug;Release;Trace</Configurations>
<Configurations>Debug;Release</Configurations>
</PropertyGroup>

<ItemGroup>
Expand All @@ -32,10 +32,5 @@
<PropertyGroup Condition="'$(IS_BENCH)'=='1'">
<DefineConstants>$(DefineConstants);IS_DETERMINISTIC</DefineConstants>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)'=='Trace'">
<Optimize>True</Optimize>
<DefineConstants>$(DefineConstants);IS_DETERMINISTIC;IS_TRACE</DefineConstants>
</PropertyGroup>

</Project>
4 changes: 0 additions & 4 deletions Benchmark/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,8 @@ internal static class Program
{
private static Task Main(string[] args)
{
#if !IS_TRACE
RunBench(args);
return Task.CompletedTask;
#else
return RunTrace();
#endif
// return RunOther();
}

Expand Down
8 changes: 1 addition & 7 deletions Craftimizer.Test/Craftimizer.Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>

<IsPackable>false</IsPackable>
<IsTestProject>true</IsTestProject>
<Platforms>x64</Platforms>
<Configurations>Debug;Release;Trace</Configurations>
<Configurations>Debug;Release</Configurations>
</PropertyGroup>

<ItemGroup>
Expand All @@ -27,9 +26,4 @@
<DefineConstants>$(DefineConstants);IS_DETERMINISTIC</DefineConstants>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)'=='Trace'">
<Optimize>True</Optimize>
<DefineConstants>$(DefineConstants);IS_DETERMINISTIC;IS_TRACE</DefineConstants>
</PropertyGroup>

</Project>
13 changes: 0 additions & 13 deletions Craftimizer.Test/Solver/ActionSet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,31 +89,18 @@ public void TestElementAt()

Assert.AreEqual(4, set.Count);

#if !IS_TRACE
Assert.AreEqual(ActionType.DelicateSynthesis, set.ElementAt(0));
Assert.AreEqual(ActionType.FocusedTouch, set.ElementAt(1));
Assert.AreEqual(ActionType.ByregotsBlessing, set.ElementAt(2));
Assert.AreEqual(ActionType.BasicSynthesis, set.ElementAt(3));
#else
Assert.AreEqual(ActionType.BasicSynthesis, set.ElementAt(0));
Assert.AreEqual(ActionType.ByregotsBlessing, set.ElementAt(1));
Assert.AreEqual(ActionType.FocusedTouch, set.ElementAt(2));
Assert.AreEqual(ActionType.DelicateSynthesis, set.ElementAt(3));
#endif

set.RemoveAction(ActionType.FocusedTouch);

Assert.AreEqual(3, set.Count);

#if !IS_TRACE
Assert.AreEqual(ActionType.DelicateSynthesis, set.ElementAt(0));
Assert.AreEqual(ActionType.ByregotsBlessing, set.ElementAt(1));
Assert.AreEqual(ActionType.BasicSynthesis, set.ElementAt(2));
#else
Assert.AreEqual(ActionType.BasicSynthesis, set.ElementAt(0));
Assert.AreEqual(ActionType.ByregotsBlessing, set.ElementAt(1));
Assert.AreEqual(ActionType.DelicateSynthesis, set.ElementAt(2));
#endif
}

[TestMethod]
Expand Down
10 changes: 0 additions & 10 deletions Craftimizer.sln
Original file line number Diff line number Diff line change
Expand Up @@ -23,38 +23,28 @@ Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Release|x64 = Release|x64
Trace|x64 = Trace|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{13C812E9-0D42-4B95-8646-40EEBF30636F}.Debug|x64.ActiveCfg = Debug|x64
{13C812E9-0D42-4B95-8646-40EEBF30636F}.Debug|x64.Build.0 = Debug|x64
{13C812E9-0D42-4B95-8646-40EEBF30636F}.Release|x64.ActiveCfg = Release|x64
{13C812E9-0D42-4B95-8646-40EEBF30636F}.Release|x64.Build.0 = Release|x64
{13C812E9-0D42-4B95-8646-40EEBF30636F}.Trace|x64.ActiveCfg = Release|x64
{057C4B64-4D99-4847-9BCF-966571CAE57C}.Debug|x64.ActiveCfg = Debug|x64
{057C4B64-4D99-4847-9BCF-966571CAE57C}.Debug|x64.Build.0 = Debug|x64
{057C4B64-4D99-4847-9BCF-966571CAE57C}.Release|x64.ActiveCfg = Release|x64
{057C4B64-4D99-4847-9BCF-966571CAE57C}.Release|x64.Build.0 = Release|x64
{057C4B64-4D99-4847-9BCF-966571CAE57C}.Trace|x64.ActiveCfg = Trace|x64
{057C4B64-4D99-4847-9BCF-966571CAE57C}.Trace|x64.Build.0 = Trace|x64
{172EE849-AC7E-4F2A-ACAB-EF9D065523B3}.Debug|x64.ActiveCfg = Debug|x64
{172EE849-AC7E-4F2A-ACAB-EF9D065523B3}.Debug|x64.Build.0 = Debug|x64
{172EE849-AC7E-4F2A-ACAB-EF9D065523B3}.Release|x64.ActiveCfg = Release|x64
{172EE849-AC7E-4F2A-ACAB-EF9D065523B3}.Release|x64.Build.0 = Release|x64
{172EE849-AC7E-4F2A-ACAB-EF9D065523B3}.Trace|x64.ActiveCfg = Trace|x64
{172EE849-AC7E-4F2A-ACAB-EF9D065523B3}.Trace|x64.Build.0 = Trace|x64
{2B0EA452-6DFC-48DB-9049-EA782E600C21}.Debug|x64.ActiveCfg = Debug|x64
{2B0EA452-6DFC-48DB-9049-EA782E600C21}.Debug|x64.Build.0 = Debug|x64
{2B0EA452-6DFC-48DB-9049-EA782E600C21}.Release|x64.ActiveCfg = Release|x64
{2B0EA452-6DFC-48DB-9049-EA782E600C21}.Release|x64.Build.0 = Release|x64
{2B0EA452-6DFC-48DB-9049-EA782E600C21}.Trace|x64.ActiveCfg = Trace|x64
{2B0EA452-6DFC-48DB-9049-EA782E600C21}.Trace|x64.Build.0 = Trace|x64
{C3AEA981-9DA8-405C-995B-86528493891B}.Debug|x64.ActiveCfg = Debug|x64
{C3AEA981-9DA8-405C-995B-86528493891B}.Debug|x64.Build.0 = Debug|x64
{C3AEA981-9DA8-405C-995B-86528493891B}.Release|x64.ActiveCfg = Release|x64
{C3AEA981-9DA8-405C-995B-86528493891B}.Release|x64.Build.0 = Release|x64
{C3AEA981-9DA8-405C-995B-86528493891B}.Trace|x64.ActiveCfg = Trace|x64
{C3AEA981-9DA8-405C-995B-86528493891B}.Trace|x64.Build.0 = Trace|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
7 changes: 1 addition & 6 deletions Simulator/Craftimizer.Simulator.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Platforms>x64</Platforms>
<Configurations>Debug;Release;Trace</Configurations>
<Configurations>Debug;Release</Configurations>
</PropertyGroup>

<ItemGroup>
Expand All @@ -19,9 +19,4 @@
<DefineConstants>$(DefineConstants);IS_DETERMINISTIC</DefineConstants>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)'=='Trace'">
<Optimize>True</Optimize>
<DefineConstants>$(DefineConstants);IS_DETERMINISTIC;IS_TRACE</DefineConstants>
</PropertyGroup>

</Project>
31 changes: 0 additions & 31 deletions Solver/ActionSet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ public struct ActionSet

public static readonly ActionType[] AcceptedActions = new[]
{
#if !IS_TRACE
ActionType.StandardTouchCombo,
ActionType.AdvancedTouchCombo,
ActionType.FocusedTouchCombo,
Expand Down Expand Up @@ -41,36 +40,6 @@ public struct ActionSet
ActionType.Observe,
ActionType.MastersMend,
ActionType.BasicTouch,
#else
//ActionType.BasicSynthesis,
ActionType.BasicTouch,
ActionType.MastersMend,
ActionType.Observe,
ActionType.WasteNot,
ActionType.Veneration,
ActionType.StandardTouch,
ActionType.GreatStrides,
ActionType.Innovation,
ActionType.BasicSynthesis,
ActionType.WasteNot2,
ActionType.ByregotsBlessing,
ActionType.MuscleMemory,
//ActionType.CarefulSynthesis,
ActionType.Manipulation,
ActionType.PrudentTouch,
ActionType.FocusedSynthesis,
ActionType.FocusedTouch,
ActionType.Reflect,
ActionType.PreparatoryTouch,
//ActionType.Groundwork,
ActionType.DelicateSynthesis,
ActionType.TrainedEye,
ActionType.CarefulSynthesis,
ActionType.AdvancedTouch,
ActionType.Groundwork,
ActionType.PrudentSynthesis,
ActionType.TrainedFinesse,
#endif
};

public static readonly int[] AcceptedActionsLUT;
Expand Down
7 changes: 1 addition & 6 deletions Solver/Craftimizer.Solver.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<Nullable>enable</Nullable>
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
<Platforms>x64</Platforms>
<Configurations>Debug;Release;Trace</Configurations>
<Configurations>Debug;Release</Configurations>
</PropertyGroup>

<ItemGroup>
Expand All @@ -24,9 +24,4 @@
<DefineConstants>$(DefineConstants);IS_DETERMINISTIC</DefineConstants>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)'=='Trace'">
<Optimize>True</Optimize>
<DefineConstants>$(DefineConstants);IS_DETERMINISTIC;IS_TRACE</DefineConstants>
</PropertyGroup>

</Project>
8 changes: 6 additions & 2 deletions Solver/SimulationNode.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
using Craftimizer.Simulator;
using Craftimizer.Simulator.Actions;
using System.Diagnostics.Contracts;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

namespace Craftimizer.Solver;
Expand Down Expand Up @@ -40,9 +42,11 @@ public static CompletionState GetCompletionState(CompletionState simCompletionSt

if (state.Input.Recipe.MaxQuality == 0)
return 1f - ((float)(state.ActionCount + 1) / config.MaxStepCount);


[Pure]
[MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
static float Apply(float bonus, float value, float target) =>
bonus * (target > 0 ? Math.Min(1f, value / target) : 1);
bonus * (target > 0 ? Math.Clamp(value / target, 0, 1) : 1);

var progressScore = Apply(
config.ScoreProgress,
Expand Down
12 changes: 0 additions & 12 deletions Solver/Trace.cs

This file was deleted.

0 comments on commit e07617f

Please sign in to comment.