Merge remote-tracking branch 'refs/remotes/origin/main'

main
Brett 2025-04-06 21:28:19 -04:00
commit d8c7a27214
20 changed files with 1300 additions and 1190 deletions

View File

@ -240,244 +240,7 @@
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=StringLiteralTypo/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" /> <option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=StringLiteralTypo/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CommentTypo/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" /> <option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CommentTypo/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=IdentifierTypo/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" /> <option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=IdentifierTypo/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppSmartPointerVsMakeFunction/@EntryIndexRemoved" /> <option name="/Default/CodeStyle/Naming/CppNaming/Rules/=Enums/@EntryIndexedValue" value="&lt;NamingElement Priority=&quot;3&quot;&gt;&lt;Descriptor Static=&quot;Indeterminate&quot; Constexpr=&quot;Indeterminate&quot; Const=&quot;Indeterminate&quot; Volatile=&quot;Indeterminate&quot; Accessibility=&quot;NOT_APPLICABLE&quot;&gt;&lt;type Name=&quot;enum&quot; /&gt;&lt;/Descriptor&gt;&lt;Policy Inspect=&quot;True&quot; WarnAboutPrefixesAndSuffixes=&quot;False&quot; Prefix=&quot;&quot; Suffix=&quot;&quot; Style=&quot;AA_BB&quot; /&gt;&lt;/NamingElement&gt;" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppCStyleCast/@EntryIndexRemoved" /> <option name="/Default/CodeStyle/Naming/CppNaming/Rules/=Class_0020and_0020struct_0020fields/@EntryIndexedValue" value="&lt;NamingElement Priority=&quot;11&quot;&gt;&lt;Descriptor Static=&quot;Indeterminate&quot; Constexpr=&quot;Indeterminate&quot; Const=&quot;Indeterminate&quot; Volatile=&quot;Indeterminate&quot; Accessibility=&quot;NOT_APPLICABLE&quot;&gt;&lt;type Name=&quot;class field&quot; /&gt;&lt;type Name=&quot;struct field&quot; /&gt;&lt;/Descriptor&gt;&lt;Policy Inspect=&quot;True&quot; WarnAboutPrefixesAndSuffixes=&quot;False&quot; Prefix=&quot;m_&quot; Suffix=&quot;&quot; Style=&quot;aa_bb&quot; /&gt;&lt;/NamingElement&gt;" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppFunctionalStyleCast/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppReinterpretCastFromVoidPtr/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppNonExplicitConvertingConstructor/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppNonExplicitConversionOperator/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDiscardedPostfixOperatorResult/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppConstValueFunctionReturnType/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMemberFunctionMayBeConst/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMemberFunctionMayBeStatic/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppLocalVariableMayBeConst/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppParameterMayBeConst/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppVariableCanBeMadeConstexpr/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppParameterMayBeConstPtrOrRef/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPassValueParameterByConstReference/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppThrowExpressionCanBeReplacedWithRethrow/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppZeroConstantCanBeReplacedWithNullptr/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppCompileTimeConstantCanBeReplacedWithBooleanConstant/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppIfCanBeReplacedByConstexprIf/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=IfStdIsConstantEvaluatedCanBeReplaced/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=StdIsConstantEvaluatedWillAlwaysEvaluateToConstant/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=ConstevalIfIsAlwaysConstant/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppClassCanBeFinal/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseStructuredBinding/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseTypeTraitAlias/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseAlgorithmWithCount/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseRangeAlgorithm/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseElementsView/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseStdSize/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppForLoopCanBeReplacedWithWhile/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppJoinDeclarationAndAssignment/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppReplaceTieWithStructuredBinding/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppReplaceMemsetWithZeroInitialization/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseAssociativeContains/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseEraseAlgorithm/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseFamiliarTemplateSyntaxForGenericLambdas/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppTooWideScope/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppTooWideScopeInitStatement/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantNamespaceDefinition/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppNonInlineFunctionDefinitionInHeaderFile/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppNonInlineVariableDefinitionInHeaderFile/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppFunctionIsNotImplemented/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPrivateSpecialMemberFunctionIsNotImplemented/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppHiddenFunction/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppHidingFunction/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPolymorphicClassWithNonVirtualPublicDestructor/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppAbstractClassWithoutSpecifier/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppIncompleteSwitchStatement/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDefaultCaseNotHandledInSwitchStatement/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPossiblyErroneousEmptyStatements/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppExpressionWithoutSideEffects/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppNoDiscardExpression/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppFunctionResultShouldBeUsed/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMissingKeywordThrow/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDependentTypeWithoutTypenameKeyword/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDependentTemplateWithoutTemplateKeyword/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppImplicitDefaultConstructorNotAvailable/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppClassNeedsConstructorBecauseOfUninitializedMember/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUninitializedNonStaticDataMember/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRangeBasedForIncompatibleReference/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppZeroValuedExpressionUsedAsNullPointer/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPossiblyUnintendedObjectSlicing/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPossiblyUninitializedMember/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDeclaratorDisambiguatedAsFunction/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppVirtualFunctionInFinalClass/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMustBePublicVirtualToImplementInterface/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDeclarationSpecifierWithoutDeclarators/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEmptyDeclaration/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDeclarationHidesLocal/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDeclarationHidesUncapturedLocal/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMismatchedClassTags/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUsingResultOfAssignmentAsCondition/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppIntegralToPointerConversion/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPointerToIntegralConversion/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppIncompatiblePointerConversion/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPointerConversionDropsQualifiers/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppStringLiteralToCharPointerConversion/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppNonExceptionSafeResourceAcquisition/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppVirtualFunctionCallInsideCtor/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppAbstractVirtualFunctionCallInCtor/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppInvalidLineContinuation/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPrintfBadFormat/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPrintfRiskyFormat/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPrintfMissedArg/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPrintfExtraArg/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppBoostFormatBadCode/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppBoostFormatLegacyCode/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppBoostFormatMixedArgs/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppBoostFormatTooFewArgs/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppBoostFormatTooManyArgs/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDeprecatedEntity/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMissingIncludeGuard/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDoxygenSyntaxError/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDoxygenUnresolvedReference/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDoxygenUndocumentedParameter/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDeletingVoidPointer/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppBooleanIncrementExpression/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDeprecatedRegisterStorageClassSpecifier/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppIdenticalOperandsInBinaryExpression/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEqualOperandsInBinaryExpression/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedefinitionOfDefaultArgumentInOverrideFunction/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUnnamedNamespaceInHeaderFile/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppParameterNamesMismatch/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDefaultedSpecialMemberFunctionIsImplicitlyDeleted/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppNodiscardFunctionWithoutReturnValue/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantComplexityInComparison/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppAbstractFinalClass/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppSpecialFunctionWithoutNoexceptSpecification/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUnsignedZeroComparison/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMultiCharacterLiteral/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMultiCharacterWideLiteral/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantQualifier/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantAccessSpecifier/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppAccessSpecifierWithNoDeclarations/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantTypenameKeyword/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantTemplateKeyword/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantElseKeyword/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantElseKeywordInsideCompoundStatement/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantControlFlowJump/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantEmptyStatement/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantEmptyDeclaration/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantParentheses/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantLambdaParameterList/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantCastExpression/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppHeaderHasBeenAlreadyIncluded/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppTemplateArgumentsCanBeDeduced/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantTemplateArguments/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppStaticSpecifierOnAnonymousNamespaceMember/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantStaticSpecifierOnMemberAllocationFunction/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantStaticSpecifierOnThreadLocalLocalVariable/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantBaseClassAccessSpecifier/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantInlineSpecifier/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantConstSpecifier/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantBooleanExpressionArgument/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantVoidArgumentList/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantMemberInitializer/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantBaseClassInitializer/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppConstParameterInDeclaration/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppVolatileParameterInDeclaration/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppFinalFunctionInFinalClass/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppFinalNonOverridingVirtualFunction/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantElaboratedTypeSpecifier/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantDereferencingAndTakingAddress/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantConditionalExpression/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppConditionalExpressionCanBeSimplified/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantExportKeyword/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantZeroInitializerInAggregateInitialization/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUserDefinedLiteralSuffixDoesNotStartWithUnderscore/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppClassIsIncomplete/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppTemplateParameterShadowing/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMutableSpecifierOnReferenceMember/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDefaultInitializationWithNoUserConstructor/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppExplicitSpecializationInNonNamespaceScope/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUnionMemberOfReferenceType/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUninitializedDependentBaseClass/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPrecompiledHeaderIsNotIncluded/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPrecompiledHeaderNotFound/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppCoroutineCallResolveError/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppAwaiterTypeIsNotClass/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppOutParameterMustBeWritten/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppWarningDirective/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppStaticAssertFailure/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEvaluationFailure/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDeclaratorNeverUsed/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppTypeAliasNeverUsed/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppConceptNeverUsed/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppClassNeverUsed/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnumeratorNeverUsed/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppLambdaCaptureNeverUsed/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppLocalVariableWithNonTrivialDtorIsNeverUsed/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppParameterNeverUsed/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppTemplateParameterNeverUsed/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEntityAssignedButNoRead/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEntityUsedOnlyInUnevaluatedContext/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppLocalVariableMightNotBeInitialized/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppObjectMemberMightNotBeInitialized/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppSomeObjectMembersMightNotBeInitialized/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDeclaratorUsedBeforeInitialization/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUnusedIncludeDirective/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppNotAllPathsReturnValue/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CDeclarationWithImplicitIntType/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppFunctionDoesntReturnValue/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppReturnNoValueInNonVoidFunction/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppCVQualifierCanNotBeAppliedToReference/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDereferenceOperatorLimitExceeded/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppForwardEnumDeclarationWithoutUnderlyingType/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUnmatchedPragmaRegionDirective/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUnmatchedPragmaEndRegionDirective/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppStaticDataMemberInUnnamedStruct/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDefaultIsUsedAsIdentifier/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppLongFloat/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMsExtReinterpretCastFromNullptr/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMsExtBindingRValueToLvalueReference/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMsExtAddressOfClassRValue/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMsExtDoubleUserConversionInCopyInit/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMsExtCopyElisionInCopyInitDeclarator/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMsExtNotInitializedStaticConstLocalVar/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRemoveRedundantBraces/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceIfStatementBraces/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceForStatementBraces/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceWhileStatementBraces/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceDoStatementBraces/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppWrongIncludesOrder/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppWrongSlashesInIncludeDirective/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceNestedNamespacesStyle/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceTypeAliasCodeStyle/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceFunctionDeclarationStyle/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMemberInitializersOrder/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceOverridingFunctionStyle/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceOverridingDestructorStyle/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseAuto/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseAutoForNumeric/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceCVQualifiersPlacement/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceCVQualifiersOrder/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUnnecessaryWhitespace/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppTabsAreDisallowed/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAConstantConditions/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFANullDereference/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFANotInitializedField/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFALoopConditionNotUpdated/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFADeletedPointer/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAMemoryLeak/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAInvalidatedMemory/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFALocalValueEscapesScope/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFALocalValueEscapesFunction/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAConstantParameter/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAConstantFunctionResult/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAArrayIndexOutOfBounds/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAUnreachableCode/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAUnreachableFunctionCall/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAEndlessLoop/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAInfiniteRecursion/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAUnusedValue/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAUnreadVariable/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFATimeOver/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppInconsistentNaming/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=StringLiteralTypo/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CommentTypo/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=IdentifierTypo/@EntryIndexRemoved" />
</component> </component>
</project> </project>

View File

@ -27,7 +27,7 @@ macro(compile_options target_name)
sanitizers(${target_name}) sanitizers(${target_name})
endmacro() endmacro()
project(blt-gp VERSION 0.3.32) project(blt-gp VERSION 0.4.9)
include(CTest) include(CTest)
@ -122,5 +122,6 @@ if (${BUILD_GP_TESTS})
blt_add_project(blt-symbolic-regression tests/symbolic_regression_test.cpp test) blt_add_project(blt-symbolic-regression tests/symbolic_regression_test.cpp test)
blt_add_project(blt-drop tests/drop_test.cpp test) blt_add_project(blt-drop tests/drop_test.cpp test)
blt_add_project(blt-drop-2-type tests/2_type_drop_test.cpp test)
endif () endif ()

View File

@ -1,4 +1,4 @@
#!/usr/bin/python3 #!python3
import subprocess import subprocess

View File

@ -20,189 +20,208 @@
#define BLT_GP_EXAMPLE_SYMBOLIC_REGRESSION_H #define BLT_GP_EXAMPLE_SYMBOLIC_REGRESSION_H
#include "examples_base.h" #include "examples_base.h"
#include <blt/std/logging.h> #include <blt/logging/logging.h>
#include <blt/format/format.h> #include <blt/format/format.h>
#include <iostream> #include <iostream>
namespace blt::gp::example namespace blt::gp::example
{ {
class symbolic_regression_t : public example_base_t class symbolic_regression_t : public example_base_t
{ {
public: public:
struct context struct context
{ {
float x, y; float x, y;
}; };
private: private:
bool fitness_function(const tree_t& current_tree, fitness_t& fitness, size_t) const bool fitness_function(const tree_t& current_tree, fitness_t& fitness, size_t) const
{ {
constexpr static double value_cutoff = 1.e15; constexpr static double value_cutoff = 1.e15;
for (auto& fitness_case : training_cases) for (auto& fitness_case : training_cases)
{ {
const auto diff = std::abs(fitness_case.y - current_tree.get_evaluation_value<float>(fitness_case)); BLT_GP_UPDATE_CONTEXT(fitness_case);
if (diff < value_cutoff) const auto diff = std::abs(fitness_case.y - current_tree.get_evaluation_value<float>(fitness_case));
{ if (diff < value_cutoff)
fitness.raw_fitness += diff; {
if (diff <= 0.01) fitness.raw_fitness += diff;
fitness.hits++; if (diff <= 0.01)
} fitness.hits++;
else } else
fitness.raw_fitness += value_cutoff; fitness.raw_fitness += value_cutoff;
} }
fitness.standardized_fitness = fitness.raw_fitness; fitness.standardized_fitness = fitness.raw_fitness;
fitness.adjusted_fitness = (1.0 / (1.0 + fitness.standardized_fitness)); fitness.adjusted_fitness = (1.0 / (1.0 + fitness.standardized_fitness));
return static_cast<size_t>(fitness.hits) == training_cases.size(); return static_cast<size_t>(fitness.hits) == training_cases.size();
} }
static float example_function(const float x) static float example_function(const float x)
{ {
return x * x * x * x + x * x * x + x * x + x; return x * x * x * x + x * x * x + x * x + x;
} }
public: public:
template <typename SEED> template <typename SEED>
symbolic_regression_t(SEED seed, const prog_config_t& config): example_base_t{std::forward<SEED>(seed), config} symbolic_regression_t(SEED seed, const prog_config_t& config): example_base_t{std::forward<SEED>(seed), config}
{ {
BLT_INFO("Starting BLT-GP Symbolic Regression Example"); BLT_INFO("Starting BLT-GP Symbolic Regression Example");
BLT_DEBUG("Setup Fitness cases"); BLT_DEBUG("Setup Fitness cases");
for (auto& fitness_case : training_cases) for (auto& fitness_case : training_cases)
{ {
constexpr float range = 10; constexpr float range = 10;
constexpr float half_range = range / 2.0; constexpr float half_range = range / 2.0;
const auto x = program.get_random().get_float(-half_range, half_range); const auto x = program.get_random().get_float(-half_range, half_range);
const auto y = example_function(x); const auto y = example_function(x);
fitness_case = {x, y}; fitness_case = {x, y};
} }
fitness_function_ref = [this](const tree_t& t, fitness_t& f, const size_t i) fitness_function_ref = [this](const tree_t& t, fitness_t& f, const size_t i) {
{ return fitness_function(t, f, i);
return fitness_function(t, f, i); };
}; }
}
void setup_operations() void setup_operations()
{ {
BLT_DEBUG("Setup Types and Operators"); BLT_DEBUG("Setup Types and Operators");
static operation_t add{[](const float a, const float b) { return a + b; }, "add"}; static operation_t add{
static operation_t sub([](const float a, const float b) { return a - b; }, "sub"); // this is the function used by the operation
static operation_t mul([](const float a, const float b) { return a * b; }, "mul"); [](const float a, const float b) {
static operation_t pro_div([](const float a, const float b) { return b == 0.0f ? 0.0f : a / b; }, "div"); return a + b;
static operation_t op_sin([](const float a) { return std::sin(a); }, "sin"); },
static operation_t op_cos([](const float a) { return std::cos(a); }, "cos"); // this name is optional and is used if you print an individual
static operation_t op_exp([](const float a) { return std::exp(a); }, "exp"); "add"
static operation_t op_log([](const float a) { return a <= 0.0f ? 0.0f : std::log(a); }, "log"); };
static auto lit = operation_t([this]() static operation_t sub([](const float a, const float b) {
{ return a - b;
return program.get_random().get_float(-1.0f, 1.0f); }, "sub");
}, "lit").set_ephemeral(); static operation_t mul([](const float a, const float b) {
return a * b;
}, "mul");
static operation_t pro_div([](const float a, const float b) {
return b == 0.0f ? 0.0f : a / b;
}, "div");
static operation_t op_sin([](const float a) {
return std::sin(a);
}, "sin");
static operation_t op_cos([](const float a) {
return std::cos(a);
}, "cos");
static operation_t op_exp([](const float a) {
return std::exp(a);
}, "exp");
static operation_t op_log([](const float a) {
return a <= 0.0f ? 0.0f : std::log(a);
}, "log");
static auto lit = operation_t([this]() {
return program.get_random().get_float(-1.0f, 1.0f);
}, "lit").set_ephemeral();
static operation_t op_x([](const context& context) static operation_t op_x([](const context& context) {
{ return context.x;
return context.x; }, "x");
}, "x");
operator_builder<context> builder{}; operator_builder<context> builder{};
builder.build(add, sub, mul, pro_div, op_sin, op_cos, op_exp, op_log, lit, op_x); builder.build(add, sub, mul, pro_div, op_sin, op_cos, op_exp, op_log, lit, op_x);
program.set_operations(builder.grab()); program.set_operations(builder.grab());
} }
void generate_initial_population() void generate_initial_population()
{ {
BLT_DEBUG("Generate Initial Population"); BLT_DEBUG("Generate Initial Population");
static auto sel = select_tournament_t{}; static auto sel = select_tournament_t{};
if (crossover_sel == nullptr) if (crossover_sel == nullptr)
crossover_sel = &sel; crossover_sel = &sel;
if (mutation_sel == nullptr) if (mutation_sel == nullptr)
mutation_sel = &sel; mutation_sel = &sel;
if (reproduction_sel == nullptr) if (reproduction_sel == nullptr)
reproduction_sel = &sel; reproduction_sel = &sel;
program.generate_population(program.get_typesystem().get_type<float>().id(), fitness_function_ref, *crossover_sel, *mutation_sel, program.generate_initial_population(program.get_typesystem().get_type<float>().id());
*reproduction_sel); program.setup_generational_evaluation(fitness_function_ref, *crossover_sel,
} *mutation_sel, *reproduction_sel);
}
void run_generation_loop() void run_generation_loop()
{ {
BLT_DEBUG("Begin Generation Loop"); BLT_DEBUG("Begin Generation Loop");
while (!program.should_terminate()) while (!program.should_terminate())
{ {
#ifdef BLT_TRACK_ALLOCATIONS #ifdef BLT_TRACK_ALLOCATIONS
auto cross = crossover_calls.start_measurement(); auto cross = crossover_calls.start_measurement();
auto mut = mutation_calls.start_measurement(); auto mut = mutation_calls.start_measurement();
auto repo = reproduction_calls.start_measurement(); auto repo = reproduction_calls.start_measurement();
#endif #endif
BLT_TRACE("------------{Begin Generation %ld}------------", program.get_current_generation()); BLT_TRACE("------------\\{Begin Generation {}}------------", program.get_current_generation());
BLT_TRACE("Creating next generation"); BLT_TRACE("Creating next generation");
program.create_next_generation(); program.create_next_generation();
BLT_TRACE("Move to next generation"); BLT_TRACE("Move to next generation");
program.next_generation(); program.next_generation();
BLT_TRACE("Evaluate Fitness"); BLT_TRACE("Evaluate Fitness");
program.evaluate_fitness(); program.evaluate_fitness();
const auto& stats = program.get_population_stats(); const auto& stats = program.get_population_stats();
BLT_TRACE("Avg Fit: %lf, Best Fit: %lf, Worst Fit: %lf, Overall Fit: %lf", BLT_TRACE("Avg Fit: {:0.6f}, Best Fit: {:0.6f}, Worst Fit: {:0.6f}, Overall Fit: {:0.6f}", stats.average_fitness.load(std::memory_order_relaxed),
stats.average_fitness.load(std::memory_order_relaxed), stats.best_fitness.load(std::memory_order_relaxed), stats.best_fitness.load(std::memory_order_relaxed), stats.worst_fitness.load(std::memory_order_relaxed),
stats.worst_fitness.load(std::memory_order_relaxed), stats.overall_fitness.load(std::memory_order_relaxed)); stats.overall_fitness.load(std::memory_order_relaxed));
#ifdef BLT_TRACK_ALLOCATIONS #ifdef BLT_TRACK_ALLOCATIONS
crossover_calls.stop_measurement(cross); crossover_calls.stop_measurement(cross);
mutation_calls.stop_measurement(mut); mutation_calls.stop_measurement(mut);
reproduction_calls.stop_measurement(repo); reproduction_calls.stop_measurement(repo);
const auto total = (cross.get_call_difference() * 2) + mut.get_call_difference() + repo.get_call_difference(); const auto total = (cross.get_call_difference() * 2) + mut.get_call_difference() + repo.get_call_difference();
BLT_TRACE("Calls Crossover: %ld, Mutation %ld, Reproduction %ld; %ld", cross.get_call_difference(), mut.get_call_difference(), repo.get_call_difference(), total); BLT_TRACE("Calls Crossover: {}, Mutation {}, Reproduction {}; {}", cross.get_call_difference(), mut.get_call_difference(), repo.get_call_difference(), total);
BLT_TRACE("Value Crossover: %ld, Mutation %ld, Reproduction %ld; %ld", cross.get_value_difference(), mut.get_value_difference(), repo.get_value_difference(), (cross.get_value_difference() * 2 + mut.get_value_difference() + repo.get_value_difference()) - total); BLT_TRACE("Value Crossover: {}, Mutation {}, Reproduction {}; {}", cross.get_value_difference(), mut.get_value_difference(), repo.get_value_difference(), (cross.get_value_difference() * 2 + mut.get_value_difference() + repo.get_value_difference()) - total);
#endif #endif
BLT_TRACE("----------------------------------------------"); BLT_TRACE("----------------------------------------------");
std::cout << std::endl; std::cout << std::endl;
} }
} }
auto get_and_print_best() auto get_and_print_best()
{ {
const auto best = program.get_best_individuals<3>(); const auto best = program.get_best_individuals<3>();
BLT_INFO("Best approximations:"); BLT_INFO("Best approximations:");
for (auto& i_ref : best) for (auto& i_ref : best)
{ {
auto& i = i_ref.get(); auto& i = i_ref.get();
BLT_DEBUG("Fitness: %lf, stand: %lf, raw: %lf", i.fitness.adjusted_fitness, i.fitness.standardized_fitness, i.fitness.raw_fitness); BLT_DEBUG("Fitness: {:0.6f}, stand: {:0.6f}, raw: {:0.6f}", i.fitness.adjusted_fitness, i.fitness.standardized_fitness, i.fitness.raw_fitness);
i.tree.print(std::cout); i.tree.print(std::cout);
std::cout << "\n"; std::cout << "\n";
} }
return best; return best;
} }
void print_stats() const void print_stats() const
{ {
// TODO: make stats helper // TODO: make stats helper
const auto& stats = program.get_population_stats(); const auto& stats = program.get_population_stats();
BLT_INFO("Stats:"); BLT_INFO("Stats:");
BLT_INFO("Average fitness: %lf", stats.average_fitness.load()); BLT_INFO("Average fitness: {:0.6f}", stats.average_fitness.load());
BLT_INFO("Best fitness: %lf", stats.best_fitness.load()); BLT_INFO("Best fitness: {:0.6f}", stats.best_fitness.load());
BLT_INFO("Worst fitness: %lf", stats.worst_fitness.load()); BLT_INFO("Worst fitness: {:0.6f}", stats.worst_fitness.load());
BLT_INFO("Overall fitness: %lf", stats.overall_fitness.load()); BLT_INFO("Overall fitness: {:0.6f}", stats.overall_fitness.load());
} }
void execute() void execute()
{ {
setup_operations(); setup_operations();
generate_initial_population(); generate_initial_population();
run_generation_loop(); run_generation_loop();
get_and_print_best(); get_and_print_best();
print_stats(); print_stats();
} }
[[nodiscard]] const auto& get_training_cases() const [[nodiscard]] const auto& get_training_cases() const
{ {
return training_cases; return training_cases;
} }
private: private:
std::array<context, 200> training_cases{}; std::array<context, 200> training_cases{};
}; };
} }
#endif //BLT_GP_EXAMPLE_SYMBOLIC_REGRESSION_H #endif //BLT_GP_EXAMPLE_SYMBOLIC_REGRESSION_H

View File

@ -20,7 +20,7 @@
#define BLT_GP_ALLOCATOR_H #define BLT_GP_ALLOCATOR_H
#include <blt/std/types.h> #include <blt/std/types.h>
#include <blt/std/logging.h> #include <blt/logging/logging.h>
#include <blt/gp/util/trackers.h> #include <blt/gp/util/trackers.h>
#include <cstdlib> #include <cstdlib>
#include <vector> #include <vector>

View File

@ -63,9 +63,10 @@ namespace blt::gp
template<typename T> template<typename T>
static void call_drop(stack_allocator& read_allocator, const size_t offset) static void call_drop(stack_allocator& read_allocator, const size_t offset)
{ {
if constexpr (blt::gp::detail::has_func_drop_v<T>) if constexpr (blt::gp::detail::has_func_drop_v<detail::remove_cv_ref<T>>)
{ {
auto [type, ptr] = read_allocator.access_pointer<detail::remove_cv_ref<T>>(offset); auto [type, ptr] = read_allocator.access_pointer<detail::remove_cv_ref<T>>(offset);
// type is not ephemeral, so we must drop it.
if (!ptr.bit(0)) if (!ptr.bit(0))
type.drop(); type.drop();
} }
@ -200,7 +201,7 @@ namespace blt::gp
[[nodiscard]] bool return_has_ephemeral_drop() const [[nodiscard]] bool return_has_ephemeral_drop() const
{ {
return detail::has_func_drop_v<Return>; return detail::has_func_drop_v<detail::remove_cv_ref<Return>>;
} }
operator_id id = -1; operator_id id = -1;

File diff suppressed because it is too large Load Diff

View File

@ -61,16 +61,16 @@ namespace blt::gp
{ {
for (size_t i = 0; i < config.elites; i++) for (size_t i = 0; i < config.elites; i++)
{ {
if (ind.value.fitness.adjusted_fitness >= values[i].second) if (ind.second.fitness.adjusted_fitness >= values[i].second)
{ {
bool doesnt_contain = true; bool doesnt_contain = true;
for (blt::size_t j = 0; j < config.elites; j++) for (blt::size_t j = 0; j < config.elites; j++)
{ {
if (ind.index == values[j].first) if (ind.first == values[j].first)
doesnt_contain = false; doesnt_contain = false;
} }
if (doesnt_contain) if (doesnt_contain)
values[i] = {ind.index, ind.value.fitness.adjusted_fitness}; values[i] = {ind.first, ind.second.fitness.adjusted_fitness};
break; break;
} }
} }

View File

@ -21,21 +21,16 @@
#include <blt/std/types.h> #include <blt/std/types.h>
#include <blt/std/bump_allocator.h> #include <blt/std/bump_allocator.h>
#include <blt/std/assert.h> #include <blt/logging/logging.h>
#include <blt/std/logging.h>
#include <blt/std/allocator.h> #include <blt/std/allocator.h>
#include <blt/std/ranges.h>
#include <blt/meta/meta.h> #include <blt/meta/meta.h>
#include <blt/gp/fwdecl.h> #include <blt/gp/util/meta.h>
#include <blt/gp/util/trackers.h>
#include <blt/gp/allocator.h> #include <blt/gp/allocator.h>
#include <utility> #include <utility>
#include <stdexcept>
#include <cstdlib> #include <cstdlib>
#include <memory> #include <memory>
#include <type_traits> #include <type_traits>
#include <cstring> #include <cstring>
#include <iostream>
namespace blt::gp namespace blt::gp
{ {
@ -87,7 +82,7 @@ namespace blt::gp
static constexpr size_t aligned_size() noexcept static constexpr size_t aligned_size() noexcept
{ {
const auto bytes = detail::aligned_size(sizeof(NO_REF_T<T>)); const auto bytes = detail::aligned_size(sizeof(NO_REF_T<T>));
if constexpr (blt::gp::detail::has_func_drop_v<T>) if constexpr (blt::gp::detail::has_func_drop_v<gp::detail::remove_cv_ref<T>>)
return bytes + detail::aligned_size(sizeof(std::atomic_uint64_t*)); return bytes + detail::aligned_size(sizeof(std::atomic_uint64_t*));
return bytes; return bytes;
} }
@ -179,7 +174,7 @@ namespace blt::gp
const auto ptr = static_cast<char*>(allocate_bytes_for_size(aligned_size<NO_REF>())); const auto ptr = static_cast<char*>(allocate_bytes_for_size(aligned_size<NO_REF>()));
std::memcpy(ptr, &t, sizeof(NO_REF)); std::memcpy(ptr, &t, sizeof(NO_REF));
if constexpr (gp::detail::has_func_drop_v<T>) if constexpr (gp::detail::has_func_drop_v<gp::detail::remove_cv_ref<T>>)
{ {
new(ptr + sizeof(NO_REF)) mem::pointer_storage<std::atomic_uint64_t>{nullptr}; new(ptr + sizeof(NO_REF)) mem::pointer_storage<std::atomic_uint64_t>{nullptr};
} }

View File

@ -166,7 +166,7 @@ namespace blt::gp
~evaluation_ref() ~evaluation_ref()
{ {
if constexpr (detail::has_func_drop_v<T>) if constexpr (detail::has_func_drop_v<detail::remove_cv_ref<T>>)
{ {
if (m_value.get() != nullptr) if (m_value.get() != nullptr)
{ {

View File

@ -48,7 +48,7 @@ namespace blt::gp
template <typename T> template <typename T>
static type make_type(const type_id id) static type make_type(const type_id id)
{ {
return type(stack_allocator::aligned_size<T>(), id, blt::type_string<T>(), detail::has_func_drop_v<T>); return type(stack_allocator::aligned_size<T>(), id, blt::type_string<T>(), detail::has_func_drop_v<detail::remove_cv_ref<T>>);
} }
[[nodiscard]] size_t size() const [[nodiscard]] size_t size() const

View File

@ -17,7 +17,7 @@
*/ */
#include <blt/gp/generators.h> #include <blt/gp/generators.h>
#include <blt/gp/program.h> #include <blt/gp/program.h>
#include <blt/std/logging.h> #include <blt/logging/logging.h>
#include <stack> #include <stack>
namespace blt::gp namespace blt::gp

View File

@ -20,12 +20,12 @@
namespace blt::gp namespace blt::gp
{ {
void select_best_t::pre_process(gp_program&, population_t& pop) void select_best_t::pre_process(gp_program&, population_t&)
{ {
std::sort(pop.begin(), pop.end(), [](const auto& a, const auto& b) // std::sort(pop.begin(), pop.end(), [](const auto& a, const auto& b)
{ // {
return a.fitness.adjusted_fitness > b.fitness.adjusted_fitness; // return a.fitness.adjusted_fitness > b.fitness.adjusted_fitness;
}); // });
index = 0; index = 0;
} }
@ -35,19 +35,19 @@ namespace blt::gp
return pop.get_individuals()[index.fetch_add(1, std::memory_order_relaxed) % size].tree; return pop.get_individuals()[index.fetch_add(1, std::memory_order_relaxed) % size].tree;
} }
void select_worst_t::pre_process(gp_program&, population_t& pop) void select_worst_t::pre_process(gp_program&, population_t&)
{ {
std::sort(pop.begin(), pop.end(), [](const auto& a, const auto& b) // std::sort(pop.begin(), pop.end(), [](const auto& a, const auto& b)
{ // {
return a.fitness.adjusted_fitness < b.fitness.adjusted_fitness; // return a.fitness.adjusted_fitness < b.fitness.adjusted_fitness;
}); // });
index = 0; index = 0;
} }
const tree_t& select_worst_t::select(gp_program&, const population_t& pop) const tree_t& select_worst_t::select(gp_program&, const population_t& pop)
{ {
const auto size = pop.get_individuals().size(); const auto size = pop.get_individuals().size();
return pop.get_individuals()[index.fetch_add(1, std::memory_order_relaxed) % size].tree; return pop.get_individuals()[(size - 1) - (index.fetch_add(1, std::memory_order_relaxed) % size)].tree;
} }
const tree_t& select_random_t::select(gp_program& program, const population_t& pop) const tree_t& select_random_t::select(gp_program& program, const population_t& pop)

View File

@ -145,15 +145,34 @@ namespace blt::gp
size_t mutation_t::mutate_point(gp_program& program, tree_t& c, const tree_t::subtree_point_t node) const size_t mutation_t::mutate_point(gp_program& program, tree_t& c, const tree_t::subtree_point_t node) const
{ {
auto& new_tree = tree_t::get_thread_local(program); auto& new_tree = tree_t::get_thread_local(program);
#if BLT_DEBUG_LEVEL >= 2
auto previous_size = new_tree.size();
auto previous_bytes = new_tree.total_value_bytes();
#endif
config.generator.get().generate(new_tree, {program, node.type, config.replacement_min_depth, config.replacement_max_depth}); config.generator.get().generate(new_tree, {program, node.type, config.replacement_min_depth, config.replacement_max_depth});
#if BLT_DEBUG_LEVEL >= 2
const auto old_op = c.get_operator(node.pos);
if (!new_tree.check(detail::debug::context_ptr))
{
BLT_ERROR("Mutate point new tree check failed!");
BLT_ERROR("Old Op: {} got replaced with New Op: {}", program.get_name(old_op.id()).value_or("Unknown"),
program.get_name(new_tree.get_operator(0).id()).value_or("Unknown"));
BLT_ERROR("Tree started with size: {} and bytes: {}", previous_size, previous_bytes);
throw std::runtime_error("Mutate Point tree check failed");
}
#endif
c.replace_subtree(node, new_tree); c.replace_subtree(node, new_tree);
// this will check to make sure that the tree is in a correct and executable state. it requires that the evaluation is context free! // this will check to make sure that the tree is in a correct and executable state. it requires that the evaluation is context free!
#if BLT_DEBUG_LEVEL >= 2 #if BLT_DEBUG_LEVEL >= 2
const auto new_op = c.get_operator(node.pos);
if (!c.check(detail::debug::context_ptr)) if (!c.check(detail::debug::context_ptr))
{ {
print_mutate_stats(); print_mutate_stats();
BLT_ERROR("Old Op: {} got replaced with New Op: {}", program.get_name(old_op.id()).value_or("Unknown"),
program.get_name(new_op.id()).value_or("Unknown"));
throw std::runtime_error("Mutate Point tree check failed"); throw std::runtime_error("Mutate Point tree check failed");
} }
#endif #endif

View File

@ -18,7 +18,7 @@
#include <blt/gp/tree.h> #include <blt/gp/tree.h>
#include <blt/gp/stack.h> #include <blt/gp/stack.h>
#include <blt/std/assert.h> #include <blt/std/assert.h>
#include <blt/std/logging.h> #include <blt/logging/logging.h>
#include <blt/gp/program.h> #include <blt/gp/program.h>
#include <stack> #include <stack>
@ -501,6 +501,7 @@ namespace blt::gp
tree_t& tree_t::get_thread_local(gp_program& program) tree_t& tree_t::get_thread_local(gp_program& program)
{ {
thread_local tree_t tree{program}; thread_local tree_t tree{program};
tree.clear(program);
return tree; return tree;
} }
@ -544,8 +545,8 @@ namespace blt::gp
if (bytes_expected != bytes_size) if (bytes_expected != bytes_size)
{ {
BLT_ERROR_STREAM << "Stack state: " << values.size() << "\n"; BLT_ERROR("Stack state: {}", values.size());
BLT_ERROR("Child tree bytes %ld vs expected %ld, difference: %ld", bytes_size, bytes_expected, BLT_ERROR("Child tree bytes {} vs expected {}, difference: {}", bytes_size, bytes_expected,
static_cast<ptrdiff_t>(bytes_expected) - static_cast<ptrdiff_t>(bytes_size)); static_cast<ptrdiff_t>(bytes_expected) - static_cast<ptrdiff_t>(bytes_size));
BLT_ERROR("Amount of bytes in stack doesn't match the number of bytes expected for the operations"); BLT_ERROR("Amount of bytes in stack doesn't match the number of bytes expected for the operations");
return false; return false;
@ -588,18 +589,18 @@ namespace blt::gp
if (v1 != v2) if (v1 != v2)
{ {
const auto vd = std::abs(v1 - v2); const auto vd = std::abs(v1 - v2);
BLT_ERROR("found %ld bytes expected %ld bytes, total difference: %ld", v1, v2, vd); BLT_ERROR("found {} bytes expected {} bytes, total difference: {}", v1, v2, vd);
BLT_ERROR("Total Produced %ld || Total Consumed %ld || Total Difference %ld", total_produced, total_consumed, BLT_ERROR("Total Produced {} || Total Consumed {} || Total Difference {}", total_produced, total_consumed,
std::abs(static_cast<blt::ptrdiff_t>(total_produced) - static_cast<blt::ptrdiff_t>(total_consumed))); std::abs(static_cast<blt::ptrdiff_t>(total_produced) - static_cast<blt::ptrdiff_t>(total_consumed)));
return false; return false;
} }
} }
catch (std::exception& e) catch (std::exception& e)
{ {
BLT_ERROR("Exception occurred \"%s\"", e.what()); BLT_ERROR("Exception occurred \"{}\"", e.what());
BLT_ERROR("Total Produced %ld || Total Consumed %ld || Total Difference %ld", total_produced, total_consumed, BLT_ERROR("Total Produced {} || Total Consumed {} || Total Difference {}", total_produced, total_consumed,
std::abs(static_cast<blt::ptrdiff_t>(total_produced) - static_cast<blt::ptrdiff_t>(total_consumed))); std::abs(static_cast<blt::ptrdiff_t>(total_produced) - static_cast<blt::ptrdiff_t>(total_consumed)));
BLT_ERROR("We failed at index %lu", index); BLT_ERROR("We failed at index {}", index);
return false; return false;
} }
return true; return true;

View File

@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
#include <blt/gp/util/trackers.h> #include <blt/gp/util/trackers.h>
#include <blt/std/logging.h> #include <blt/logging/logging.h>
#include "blt/format/format.h" #include "blt/format/format.h"
#include <numeric> #include <numeric>

194
tests/2_type_drop_test.cpp Normal file
View File

@ -0,0 +1,194 @@
/*
* <Short Description>
* Copyright (C) 2025 Brett Terpstra
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "../examples/symbolic_regression.h"
#include <blt/gp/program.h>
#include <blt/logging/logging.h>
using namespace blt::gp;
std::atomic_uint64_t normal_construct = 0;
std::atomic_uint64_t ephemeral_construct = 0;
std::atomic_uint64_t normal_drop = 0;
std::atomic_uint64_t ephemeral_drop = 0;
std::atomic_uint64_t max_allocated = 0;
struct drop_type
{
float* m_value;
bool ephemeral = false;
drop_type() : m_value(new float(0))
{
++normal_construct;
}
explicit drop_type(const float silly) : m_value(new float(silly))
{
++normal_construct;
}
explicit drop_type(const float silly, bool) : m_value(new float(silly)), ephemeral(true)
{
// BLT_TRACE("Constructor with value %f", silly);
++ephemeral_construct;
}
[[nodiscard]] float value() const
{
return *m_value;
}
void drop() const
{
if (ephemeral)
{
std::cout << ("Ephemeral drop") << std::endl;
++ephemeral_drop;
}
else
++normal_drop;
delete m_value;
}
friend std::ostream& operator<<(std::ostream& os, const drop_type& dt)
{
os << dt.m_value;
return os;
}
};
struct context
{
float x, y;
};
prog_config_t config = prog_config_t()
.set_initial_min_tree_size(2)
.set_initial_max_tree_size(6)
.set_elite_count(2)
.set_crossover_chance(0.8)
.set_mutation_chance(0.1)
.set_reproduction_chance(0.1)
.set_max_generations(50)
.set_pop_size(500)
.set_thread_count(1);
example::symbolic_regression_t regression{691ul, config};
operation_t add{[](const drop_type a, const drop_type b) { return drop_type{a.value() + b.value()}; }, "add"};
operation_t addf{[](const float a, const float b) { return a + b; }, "addf"};
operation_t sub([](const drop_type a, const drop_type b) { return drop_type{a.value() - b.value()}; }, "sub");
operation_t subf([](const float a, const float b) { return a - b; }, "subf");
operation_t mul([](const drop_type a, const drop_type b) { return drop_type{a.value() * b.value()}; }, "mul");
operation_t mulf([](const float a, const float b) { return a * b; }, "mulf");
operation_t pro_div([](const drop_type a, const drop_type b) { return drop_type{b.value() == 0.0f ? 0.0f : a.value() / b.value()}; }, "div");
operation_t pro_divf([](const float a, const float b) { return b == 0.0f ? 0.0f : a / b; }, "divf");
operation_t op_sin([](const drop_type a) { return drop_type{std::sin(a.value())}; }, "sin");
operation_t op_sinf([](const float a) { return std::sin(a); }, "sinf");
operation_t op_cos([](const drop_type a) { return drop_type{std::cos(a.value())}; }, "cos");
operation_t op_cosf([](const float a) { return std::cos(a); }, "cosf");
operation_t op_exp([](const drop_type a) { return drop_type{std::exp(a.value())}; }, "exp");
operation_t op_expf([](const float a) { return std::exp(a); }, "expf");
operation_t op_log([](const drop_type a) { return drop_type{a.value() <= 0.0f ? 0.0f : std::log(a.value())}; }, "log");
operation_t op_logf([](const float a) { return a <= 0.0f ? 0.0f : std::log(a); }, "logf");
operation_t op_tof([](const drop_type a) { return a.value(); }, "to_f");
operation_t op_todrop([](const float a) { return drop_type{a}; }, "to_drop");
operation_t op_mixed_input([](const drop_type a, const float f)
{
return a.value() + f;
}, "mixed_input");
auto lit = operation_t([]()
{
return drop_type{regression.get_program().get_random().get_float(-1.0f, 1.0f), true};
}, "lit").set_ephemeral();
auto litf = operation_t([]()
{
return regression.get_program().get_random().get_float(-1.0f, 1.0f);
}, "litf").set_ephemeral();
operation_t op_x([](const context& context)
{
return drop_type{context.x};
}, "x");
operation_t op_xf([](const context& context)
{
return context.x;
}, "xf");
bool fitness_function(const tree_t& current_tree, fitness_t& fitness, size_t)
{
if (normal_construct - normal_drop > max_allocated)
max_allocated = normal_construct - normal_drop;
constexpr static double value_cutoff = 1.e15;
for (auto& fitness_case : regression.get_training_cases())
{
BLT_GP_UPDATE_CONTEXT(fitness_case);
auto val = current_tree.get_evaluation_ref<drop_type>(fitness_case);
const auto diff = std::abs(fitness_case.y - val.get().value());
if (diff < value_cutoff)
{
fitness.raw_fitness += diff;
if (diff <= 0.01)
fitness.hits++;
}
else
fitness.raw_fitness += value_cutoff;
}
fitness.standardized_fitness = fitness.raw_fitness;
fitness.adjusted_fitness = (1.0 / (1.0 + fitness.standardized_fitness));
return static_cast<size_t>(fitness.hits) == regression.get_training_cases().size();
}
int main()
{
operator_builder<context> builder{};
builder.build(add, sub, mul, pro_div, op_sin, op_cos, op_exp, op_log, op_mixed_input, lit, op_x, addf, subf, mulf, pro_divf, op_sinf, op_cosf,
op_expf, op_logf,
litf, op_xf, op_tof, op_todrop);
regression.get_program().set_operations(builder.grab());
auto& program = regression.get_program();
static auto sel = select_tournament_t{};
program.generate_initial_population(program.get_typesystem().get_type<drop_type>().id());
program.setup_generational_evaluation(fitness_function, sel, sel, sel);
while (!program.should_terminate())
{
BLT_TRACE("---------------\\{Begin Generation {}}---------------", program.get_current_generation());
BLT_TRACE("Creating next generation");
program.create_next_generation();
BLT_TRACE("Move to next generation");
program.next_generation();
BLT_TRACE("Evaluate Fitness");
program.evaluate_fitness();
}
// program.get_best_individuals<1>()[0].get().tree.print(program, std::cout, true, true);
regression.get_program().get_current_pop().clear();
regression.get_program().next_generation();
regression.get_program().get_current_pop().clear();
BLT_TRACE("Created {} times", normal_construct.load());
BLT_TRACE("Dropped {} times", normal_drop.load());
BLT_TRACE("Ephemeral created {} times", ephemeral_construct.load());
BLT_TRACE("Ephemeral dropped {} times", ephemeral_drop.load());
BLT_TRACE("Max allocated {} times", max_allocated.load());
}

View File

@ -17,7 +17,7 @@
*/ */
#include "../examples/symbolic_regression.h" #include "../examples/symbolic_regression.h"
#include <blt/gp/program.h> #include <blt/gp/program.h>
#include <blt/std/logging.h> #include <blt/logging/logging.h>
using namespace blt::gp; using namespace blt::gp;
@ -140,10 +140,11 @@ int main()
auto& program = regression.get_program(); auto& program = regression.get_program();
static auto sel = select_tournament_t{}; static auto sel = select_tournament_t{};
program.generate_population(program.get_typesystem().get_type<drop_type>().id(), fitness_function, sel, sel, sel); program.generate_initial_population(program.get_typesystem().get_type<drop_type>().id());
program.setup_generational_evaluation(fitness_function, sel, sel, sel);
while (!program.should_terminate()) while (!program.should_terminate())
{ {
BLT_TRACE("---------------{Begin Generation %lu}---------------", program.get_current_generation()); BLT_TRACE("---------------\\{Begin Generation {}}---------------", program.get_current_generation());
BLT_TRACE("Creating next generation"); BLT_TRACE("Creating next generation");
program.create_next_generation(); program.create_next_generation();
BLT_TRACE("Move to next generation"); BLT_TRACE("Move to next generation");
@ -158,10 +159,10 @@ int main()
regression.get_program().next_generation(); regression.get_program().next_generation();
regression.get_program().get_current_pop().clear(); regression.get_program().get_current_pop().clear();
BLT_TRACE("Created %ld times", normal_construct.load()); BLT_TRACE("Created {} times", normal_construct.load());
BLT_TRACE("Dropped %ld times", normal_drop.load()); BLT_TRACE("Dropped {} times", normal_drop.load());
BLT_TRACE("Ephemeral created %ld times", ephemeral_construct.load()); BLT_TRACE("Ephemeral created {} times", ephemeral_construct.load());
BLT_TRACE("Ephemeral dropped %ld times", ephemeral_drop.load()); BLT_TRACE("Ephemeral dropped {} times", ephemeral_drop.load());
BLT_TRACE("Max allocated %ld times", max_allocated.load()); BLT_TRACE("Max allocated {} times", max_allocated.load());
} }

View File

@ -19,6 +19,7 @@
#include <fstream> #include <fstream>
#include <array> #include <array>
#include <sstream>
#include <blt/profiling/profiler_v2.h> #include <blt/profiling/profiler_v2.h>
static const auto SEED_FUNC = [] { return std::random_device()(); }; static const auto SEED_FUNC = [] { return std::random_device()(); };
@ -56,7 +57,7 @@ void run(const blt::gp::prog_config_t& config)
auto mut = mutation_calls.start_measurement(); auto mut = mutation_calls.start_measurement();
auto repo = reproduction_calls.start_measurement(); auto repo = reproduction_calls.start_measurement();
#endif #endif
BLT_TRACE("------------{Begin Generation %ld}------------", program.get_current_generation()); BLT_TRACE("------------\\{Begin Generation {}}------------", program.get_current_generation());
BLT_TRACE("Creating next generation"); BLT_TRACE("Creating next generation");
BLT_START_INTERVAL("Symbolic Regression", "Create Next Generation"); BLT_START_INTERVAL("Symbolic Regression", "Create Next Generation");
program.create_next_generation(); program.create_next_generation();
@ -71,7 +72,7 @@ void run(const blt::gp::prog_config_t& config)
BLT_END_INTERVAL("Symbolic Regress", "Evaluate Fitness"); BLT_END_INTERVAL("Symbolic Regress", "Evaluate Fitness");
BLT_START_INTERVAL("Symbolic Regress", "Fitness Print"); BLT_START_INTERVAL("Symbolic Regress", "Fitness Print");
const auto& stats = program.get_population_stats(); const auto& stats = program.get_population_stats();
BLT_TRACE("Avg Fit: %lf, Best Fit: %lf, Worst Fit: %lf, Overall Fit: %lf", BLT_TRACE("Avg Fit: {}, Best Fit: {}, Worst Fit: {}, Overall Fit: {}",
stats.average_fitness.load(std::memory_order_relaxed), stats.best_fitness.load(std::memory_order_relaxed), stats.average_fitness.load(std::memory_order_relaxed), stats.best_fitness.load(std::memory_order_relaxed),
stats.worst_fitness.load(std::memory_order_relaxed), stats.overall_fitness.load(std::memory_order_relaxed)); stats.worst_fitness.load(std::memory_order_relaxed), stats.overall_fitness.load(std::memory_order_relaxed));
BLT_END_INTERVAL("Symbolic Regress", "Fitness Print"); BLT_END_INTERVAL("Symbolic Regress", "Fitness Print");
@ -123,17 +124,8 @@ void do_run()
.set_pop_size(population_sizes) .set_pop_size(population_sizes)
.set_thread_count(0); .set_thread_count(0);
BLT_INFO_STREAM << "Run: Crossover ("; BLT_INFO("Run: Crossover ({}) Mutation ({}) Reproduction ({}) Elite ({}) Population Size ({})", crossover_chance,
BLT_INFO_STREAM << crossover_chance; mutation_chance, reproduction_chance, elite_amount, population_sizes);
BLT_INFO_STREAM << ") Mutation (";
BLT_INFO_STREAM << mutation_chance;
BLT_INFO_STREAM << ") Reproduction (";
BLT_INFO_STREAM << reproduction_chance;
BLT_INFO_STREAM << ") Elite (";
BLT_INFO_STREAM << elite_amount;
BLT_INFO_STREAM << ") Population Size (";
BLT_INFO_STREAM << population_sizes;
BLT_INFO_STREAM << ")" << "\n";
run(config); run(config);
results << "Run: Crossover ("; results << "Run: Crossover (";
@ -190,10 +182,10 @@ inline void there(blt::size_t)
int main() int main()
{ {
// blt::gp::thread_manager_t threads{ // blt::gp::thread_manager_t threads{
// std::thread::hardware_concurrency(), blt::gp::task_builder_t<test>::make_callable( // std::thread::hardware_concurrency(), blt::gp::task_builder_t<test>::make_callable(
// blt::gp::task_t{test::hello, hello}, // blt::gp::task_t{test::hello, hello},
// blt::gp::task_t{test::there, there} // blt::gp::task_t{test::there, there}
// ) // )
// }; // };
// threads.add_task(test::hello); // threads.add_task(test::hello);
@ -202,7 +194,7 @@ int main()
// threads.add_task(test::there); // threads.add_task(test::there);
// while (threads.has_tasks_left()) // while (threads.has_tasks_left())
// threads.execute(); // threads.execute();
for (int i = 0; i < 1; i++) for (int i = 0; i < 1; i++)
do_run(); do_run();