Skip to content

Commit

Permalink
* Fixed: Irregular Fit
Browse files Browse the repository at this point in the history
* Fixed: GUI
  • Loading branch information
Oleksiy Penkov committed Mar 29, 2024
1 parent b636de4 commit 63242dc
Show file tree
Hide file tree
Showing 7 changed files with 325 additions and 30 deletions.
3 changes: 2 additions & 1 deletion LFPSO/unit_LFPSO_Base.pas
Original file line number Diff line number Diff line change
Expand Up @@ -537,13 +537,14 @@ procedure TLFPSO_BASE.SendUpdateMessage(const Step: integer);
msg_prm: PUpdateFitProgressMsg;
begin
New(msg_prm);
msg_prm.Full := True;
msg_prm.Full := True;
msg_prm.LastChi := FGlobalBestChiSqr;
msg_prm.BestChi := FAbsoluteBestChiSqr;
msg_prm.Step := Step;
msg_prm.Curve := FResultingCurve;
msg_prm.Structure := FStructure;
msg_prm.Poly := GetPolynomes;
msg_prm.Res := GetResult;

PostMessage(
Application.MainFormHandle,
Expand Down
13 changes: 10 additions & 3 deletions LFPSO/unit_LFPSO_Irregular.pas
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,11 @@ procedure TLFPSO_Irregular.UpdateLFPSO(const t: integer);
V[i][j][k][0] := Omega(t, FTMax) * LevyWalk(X[i][j][k][0], gbest[j][k][0]) +
c1 * Random * (pbest[j][k][0] - X[i][j][k][0]) +
c2 * Random * (gbest[j][k][0] - X[i][j][k][0]);
CheckLimits(i, j, k);
end
else
X[i][j][k][0] := X[i][FLinks[j][k]][k][0];

CheckLimits(i, j, k);
end;

if FFitParams.Smooth then Smooth(i);
Expand All @@ -117,10 +118,11 @@ procedure TLFPSO_Irregular.UpdatePSO(const t: integer);
V[i][j][k][0] := Omega(t, FTMax) * V[i][j][k][0] +
c1 * Random * (pbest[j][k][0] - X[i][j][k][0]) +
c2 * Random * (gbest[j][k][0] - X[i][j][k][0]);
CheckLimits(i, j, k);
end
else
X[i][j][k][0] := X[i][FLinks[j][k]][k][0];

CheckLimits(i, j, k);
end;

if FFitParams.Smooth then Smooth(i);
Expand Down Expand Up @@ -157,8 +159,11 @@ procedure TLFPSO_Irregular.XSeed;
for i := 1 to High(X) do // for every member of the population
begin
for j := 0 to High(X[i]) do //for every layer
for k := 1 to 3 do // for H, s, rho
for k := 1 to 3 do
begin // for H, s, rho
X[i][j][k][0] := X[0][j][k][0] + Rand(XRange[0][j][k][0] * FFitParams.Ksxr);
CheckLimits(i, j, k);
end;

if FFitParams.Smooth then Smooth(i);
end;
Expand All @@ -179,6 +184,8 @@ procedure TLFPSO_Irregular.RangeSeed;
X[i][j][k][0] := X[i][FLinks[j][k]][k][0]
else
X[i][j][k][0] := Xmin[0][j][k][0] + Random * (Xmax[0][j][k][0] - Xmin[0][j][k][0]); // min + Random * (min-max)

CheckLimits(i, j, k);
end;

if FFitParams.Smooth then Smooth(i);
Expand Down
155 changes: 147 additions & 8 deletions XRayCalc3.dproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectGuid>{D89E79FA-2135-48C6-94C6-60FBC791086C}</ProjectGuid>
<ProjectVersion>19.5</ProjectVersion>
<ProjectVersion>20.1</ProjectVersion>
<FrameworkType>VCL</FrameworkType>
<Base>True</Base>
<Config Condition="'$(Config)'==''">Release</Config>
Expand Down Expand Up @@ -114,7 +114,7 @@
<VerInfo_AutoGenVersion>true</VerInfo_AutoGenVersion>
<VerInfo_Keys>CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=3.0.0.200;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=3.0.0.0;Comments=</VerInfo_Keys>
<Icon_MainIcon>Resources\XRayCalc3_Icon.ico</Icon_MainIcon>
<Debugger_RunParams>-f &quot;d:\DelphiProjects\X-Ray Calc\X-Ray Calc 3\test_data\W-BN(221101A).xrcx&quot; -a</Debugger_RunParams>
<Debugger_RunParams>-f &quot;d:\DelphiProjects\X-Ray Calc\X-Ray Calc 3\test_data\ML(20x4)_Poly1_#1.xrcx&quot; -a</Debugger_RunParams>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_1_Win64)'!=''">
<AppDPIAwarenessMode>PerMonitorV2</AppDPIAwarenessMode>
Expand All @@ -134,18 +134,24 @@
<DCC_ImportedDataReferences>false</DCC_ImportedDataReferences>
<Icon_MainIcon>Resources\XRayCalc3_Icon.ico</Icon_MainIcon>
<VerInfo_MajorVer>3</VerInfo_MajorVer>
<VerInfo_Build>420</VerInfo_Build>
<VerInfo_Keys>CompanyName=Zhejiang University;FileDescription=$(MSBuildProjectName);FileVersion=3.0.8.420;InternalName=;LegalCopyright=Oleksiy Penkov;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=3.0.4;Comments=</VerInfo_Keys>
<VerInfo_Release>8</VerInfo_Release>
<VerInfo_Build>445</VerInfo_Build>
<VerInfo_Keys>CompanyName=Zhejiang University;FileDescription=$(MSBuildProjectName);FileVersion=3.1.2.445;InternalName=;LegalCopyright=Oleksiy Penkov;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=3.0.4;Comments=</VerInfo_Keys>
<VerInfo_MinorVer>1</VerInfo_MinorVer>
<VerInfo_Release>2</VerInfo_Release>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_2_Win64)'!=''">
<AppDPIAwarenessMode>PerMonitorV2</AppDPIAwarenessMode>
<DCC_ExeOutput>.\OUT\BIN64</DCC_ExeOutput>
<DCC_DcpOutput>.\OUT\DCP64</DCC_DcpOutput>
<DCC_DcuOutput>.\OUT\DCU64</DCC_DcuOutput>
<VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
<VerInfo_Locale>1033</VerInfo_Locale>
<Icon_MainIcon>Resources\XRayCalc3_x64_Icon.ico</Icon_MainIcon>
<VerInfo_MajorVer>3</VerInfo_MajorVer>
<VerInfo_MinorVer>1</VerInfo_MinorVer>
<VerInfo_Build>445</VerInfo_Build>
<VerInfo_Keys>CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=3.1.2.445;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments=</VerInfo_Keys>
<OutputExt>x64.exe</OutputExt>
<VerInfo_Release>2</VerInfo_Release>
</PropertyGroup>
<ItemGroup>
<DelphiCompile Include="$(MainSource)">
Expand Down Expand Up @@ -233,6 +239,9 @@
<Form>frmFitSettings</Form>
<FormType>dfm</FormType>
</DCCReference>
<DCCReference Include="components\unit_AutoCompleteEdit.pas"/>
<DCCReference Include="components\MHLButtonedEdit.pas"/>
<DCCReference Include="components\unit_StaticTip.pas"/>
<BuildConfiguration Include="Base">
<Key>Base</Key>
</BuildConfiguration>
Expand All @@ -254,8 +263,8 @@
<Source Name="MainSource">XRayCalc3.dpr</Source>
</Source>
<Excluded_Packages>
<Excluded_Packages Name="$(BDSBIN)\dcloffice2k280.bpl">Microsoft Office 2000 Sample Automation Server Wrapper Components</Excluded_Packages>
<Excluded_Packages Name="$(BDSBIN)\dclofficexp280.bpl">Microsoft Office XP Sample Automation Server Wrapper Components</Excluded_Packages>
<Excluded_Packages Name="$(BDSBIN)\dcloffice2k290.bpl">Microsoft Office 2000 Sample Automation Server Wrapper Components</Excluded_Packages>
<Excluded_Packages Name="$(BDSBIN)\dclofficexp290.bpl">Microsoft Office XP Sample Automation Server Wrapper Components</Excluded_Packages>
</Excluded_Packages>
</Delphi.Personality>
<Deployment Version="4">
Expand Down Expand Up @@ -361,6 +370,16 @@
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="AndroidSplashImageDefV21">
<Platform Name="Android">
<RemoteDir>res\drawable-anydpi-v21</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="Android64">
<RemoteDir>res\drawable-anydpi-v21</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="AndroidSplashStyles">
<Platform Name="Android">
<RemoteDir>res\values</RemoteDir>
Expand All @@ -381,6 +400,66 @@
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="AndroidSplashStylesV31">
<Platform Name="Android">
<RemoteDir>res\values-v31</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="Android64">
<RemoteDir>res\values-v31</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_AdaptiveIcon">
<Platform Name="Android">
<RemoteDir>res\drawable-anydpi-v26</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="Android64">
<RemoteDir>res\drawable-anydpi-v26</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_AdaptiveIconBackground">
<Platform Name="Android">
<RemoteDir>res\drawable</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="Android64">
<RemoteDir>res\drawable</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_AdaptiveIconForeground">
<Platform Name="Android">
<RemoteDir>res\drawable</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="Android64">
<RemoteDir>res\drawable</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_AdaptiveIconMonochrome">
<Platform Name="Android">
<RemoteDir>res\drawable</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="Android64">
<RemoteDir>res\drawable</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_AdaptiveIconV33">
<Platform Name="Android">
<RemoteDir>res\drawable-anydpi-v33</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="Android64">
<RemoteDir>res\drawable-anydpi-v33</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_Colors">
<Platform Name="Android">
<RemoteDir>res\values</RemoteDir>
Expand All @@ -391,6 +470,16 @@
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_ColorsDark">
<Platform Name="Android">
<RemoteDir>res\values-night-v21</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="Android64">
<RemoteDir>res\values-night-v21</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_DefaultAppIcon">
<Platform Name="Android">
<RemoteDir>res\drawable</RemoteDir>
Expand Down Expand Up @@ -561,6 +650,56 @@
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_VectorizedNotificationIcon">
<Platform Name="Android">
<RemoteDir>res\drawable-anydpi-v24</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="Android64">
<RemoteDir>res\drawable-anydpi-v24</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_VectorizedSplash">
<Platform Name="Android">
<RemoteDir>res\drawable</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="Android64">
<RemoteDir>res\drawable</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_VectorizedSplashDark">
<Platform Name="Android">
<RemoteDir>res\drawable-night-anydpi-v21</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="Android64">
<RemoteDir>res\drawable-night-anydpi-v21</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_VectorizedSplashV31">
<Platform Name="Android">
<RemoteDir>res\drawable-anydpi-v31</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="Android64">
<RemoteDir>res\drawable-anydpi-v31</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_VectorizedSplashV31Dark">
<Platform Name="Android">
<RemoteDir>res\drawable-night-anydpi-v31</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="Android64">
<RemoteDir>res\drawable-night-anydpi-v31</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="DebugSymbols">
<Platform Name="iOSSimulator">
<Operation>1</Operation>
Expand Down
Loading

0 comments on commit 63242dc

Please sign in to comment.