Skip to content

Commit

Permalink
Add SymuScenariosAndEvents
Browse files Browse the repository at this point in the history
  • Loading branch information
lmorisse committed May 29, 2020
1 parent 435a65a commit 614fc84
Show file tree
Hide file tree
Showing 67 changed files with 3,588 additions and 195 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

## Unreleased

* Update SymuForm, IterationResult for multiple iterations by [lmorisse](https://github.com/lmorisse)
* Add new project example: [SymuScenariosAndMonteCarlo](https://github.com/lmorisse/Symu/tree/master/Symu%20examples/SymuScenariosAndMonteCarlo) by [lmorisse](https://github.com/lmorisse)
* Add new project example: [SymuScenariosAndMonteCarloTests](https://github.com/lmorisse/Symu/tree/master/Symu%20examples/SymuScenariosAndMonteCarloTests) by [lmorisse](https://github.com/lmorisse)


## 0.6.0 [](https://github.com/lmorisse/symu/compare/v0.6.0..v0.5.0)
* Add MurphyIncompleteInformation by [lmorisse](https://github.com/lmorisse)
* Renaming SimulationEngine (SymuEngine), TimeStep (Schedule) by [lmorisse](https://github.com/lmorisse)
Expand Down
4 changes: 2 additions & 2 deletions Symu examples/SymuBeliefsAndInfluence/Home.cs
Original file line number Diff line number Diff line change
Expand Up @@ -115,12 +115,12 @@ protected override void UpdateSettings()

#endregion

TimeStepType = TimeStepType.Daily;
SetTimeStepType(TimeStepType.Daily);
}

protected override void SetScenarii()
{
_ = new TimeStepScenario(_environment)
_ = new TimeBasedScenario(_environment)
{
NumberOfSteps = ushort.Parse(tbSteps.Text)
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public void Initialize()
_environment.SetOrganization(_organization);
_simulation.SetEnvironment(_environment);
_environment.SetDebug(true);
var scenario = new TimeStepScenario(_environment)
var scenario = new TimeBasedScenario(_environment)
{
NumberOfSteps = NumberOfSteps
};
Expand Down
12 changes: 12 additions & 0 deletions Symu examples/SymuExamples.sln
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SymuMurphiesAndBlockers", "
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SymuMurphiesAndBlockersTests", "SymuMurphiesAndBlockersTests\SymuMurphiesAndBlockersTests.csproj", "{979382EC-EC34-4284-9E6A-018A40CA82F1}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SymuScenariosAndMonteCarlo", "SymuScenariosAndMonteCarlo\SymuScenariosAndMonteCarlo.csproj", "{5E1F9690-2B9C-4354-9AD7-9D9CD873965B}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SymuScenariosAndMonteCarloTests", "SymuScenariosAndMonteCarloTests\SymuScenariosAndMonteCarloTests.csproj", "{35B38D26-104A-45AC-A13B-EAD8F4CC088A}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -69,6 +73,14 @@ Global
{979382EC-EC34-4284-9E6A-018A40CA82F1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{979382EC-EC34-4284-9E6A-018A40CA82F1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{979382EC-EC34-4284-9E6A-018A40CA82F1}.Release|Any CPU.Build.0 = Release|Any CPU
{5E1F9690-2B9C-4354-9AD7-9D9CD873965B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5E1F9690-2B9C-4354-9AD7-9D9CD873965B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5E1F9690-2B9C-4354-9AD7-9D9CD873965B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5E1F9690-2B9C-4354-9AD7-9D9CD873965B}.Release|Any CPU.Build.0 = Release|Any CPU
{35B38D26-104A-45AC-A13B-EAD8F4CC088A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{35B38D26-104A-45AC-A13B-EAD8F4CC088A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{35B38D26-104A-45AC-A13B-EAD8F4CC088A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{35B38D26-104A-45AC-A13B-EAD8F4CC088A}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
4 changes: 2 additions & 2 deletions Symu examples/SymuGroupAndInteraction/Home.cs
Original file line number Diff line number Diff line change
Expand Up @@ -146,12 +146,12 @@ protected override void UpdateSettings()

#endregion

TimeStepType = TimeStepType.Daily;
SetTimeStepType(TimeStepType.Daily);
}

protected override void SetScenarii()
{
_ = new TimeStepScenario(_environment)
_ = new TimeBasedScenario(_environment)
{
NumberOfSteps = ushort.Parse(tbSteps.Text)
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public void Initialize()
_environment.SetOrganization(_organization);
_symu.SetEnvironment(_environment);
_environment.SetDebug(true);
var scenario = new TimeStepScenario(_environment)
var scenario = new TimeBasedScenario(_environment)
{
NumberOfSteps = NumberOfSteps
};
Expand Down
8 changes: 4 additions & 4 deletions Symu examples/SymuLearnAndForget/Home.cs
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ protected override void UpdateSettings()

protected override void SetScenarii()
{
_ = new TimeStepScenario(_environment)
_ = new TimeBasedScenario(_environment)
{
NumberOfSteps = ushort.Parse(tbSteps.Text)
};
Expand Down Expand Up @@ -269,16 +269,16 @@ public override void Display()

// Global Knowledge - using iteration result

lock (_environment.IterationResult.OrganizationKnowledgeAndBelief.Knowledges)
lock (_environment.IterationResult.OrganizationKnowledgeAndBelief.Knowledge)
{
if (!_environment.IterationResult.OrganizationKnowledgeAndBelief.Knowledges.Any())
if (!_environment.IterationResult.OrganizationKnowledgeAndBelief.Knowledge.Any())
{
return;
}
}


var knowledge = _environment.IterationResult.OrganizationKnowledgeAndBelief.Knowledges.Last();
var knowledge = _environment.IterationResult.OrganizationKnowledgeAndBelief.Knowledge.Last();
WriteTextSafe(lblGlobalKnowledge, knowledge.Sum.ToString("F1", CultureInfo.InvariantCulture));
var obsolescence = _environment.IterationResult.OrganizationKnowledgeAndBelief.KnowledgeObsolescence.Last();
WriteTextSafe(lblGlobalObsolescence, obsolescence.Sum.ToString("F1", CultureInfo.InvariantCulture));
Expand Down
2 changes: 1 addition & 1 deletion Symu examples/SymuLearnAndForgetTests/IntegrationTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public void Initialize()
_environment.SetOrganization(_organization);
_symu.SetEnvironment(_environment);
_environment.SetDebug(true);
var scenario = new TimeStepScenario(_environment)
var scenario = new TimeBasedScenario(_environment)
{
NumberOfSteps = 10
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public int NumberOfTasks
{
if (value < 0)
{
throw new ArgumentOutOfRangeException("NumberOfTasks should be >= 0");
throw new ArgumentOutOfRangeException("NumberOfMessages should be >= 0");
}

_numberOfTasks = value;
Expand Down
2 changes: 1 addition & 1 deletion Symu examples/SymuMessageAndTask/Home.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Symu examples/SymuMessageAndTask/Home.cs
Original file line number Diff line number Diff line change
Expand Up @@ -143,12 +143,12 @@ protected override void UpdateSettings()
#endregion

SetRandomLevel(cbRandomLevel.SelectedIndex);
TimeStepType = TimeStepType.Daily;
SetTimeStepType(TimeStepType.Daily);
}

protected override void SetScenarii()
{
_ = new TimeStepScenario(_environment)
_ = new TimeBasedScenario(_environment)
{
NumberOfSteps = ushort.Parse(tbSteps.Text)
};
Expand Down
2 changes: 1 addition & 1 deletion Symu examples/SymuMessageAndTaskTests/IntegrationTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public void Initialize()
_environment.SetOrganization(_organization);
_symu.SetEnvironment(_environment);
_environment.SetDebug(true);
var scenario = new TimeStepScenario(_environment)
var scenario = new TimeBasedScenario(_environment)
{
NumberOfSteps = NumberOfSteps
};
Expand Down
4 changes: 2 additions & 2 deletions Symu examples/SymuMurphiesAndBlockers/Home.cs
Original file line number Diff line number Diff line change
Expand Up @@ -184,12 +184,12 @@ protected override void UpdateSettings()

OrganizationEntity.Templates.Human.Cognitive.InteractionCharacteristics.PreferredCommunicationMediums = EmailComm.Checked ? CommunicationMediums.Email : CommunicationMediums.FaceToFace;

TimeStepType = TimeStepType.Daily;
SetTimeStepType(TimeStepType.Daily);
}

protected override void SetScenarii()
{
_ = new TimeStepScenario(_environment)
_ = new TimeBasedScenario(_environment)
{
NumberOfSteps = ushort.Parse(tbSteps.Text)
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public void Initialize()
_environment.SetOrganization(_organization);
_symu.SetEnvironment(_environment);
_environment.SetDebug(true);
var scenario = new TimeStepScenario(_environment)
var scenario = new TimeBasedScenario(_environment)
{
NumberOfSteps = NumberOfSteps
};
Expand Down
28 changes: 28 additions & 0 deletions Symu examples/SymuScenariosAndEvents/App.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>

<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" />
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a"
culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.6.0" newVersion="4.0.6.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Collections.Immutable" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.2.5.0" newVersion="1.2.5.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Reflection.Metadata" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.4.5.0" newVersion="1.4.5.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Text.Encoding.CodePages" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.1.3.0" newVersion="4.1.3.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
74 changes: 74 additions & 0 deletions Symu examples/SymuScenariosAndEvents/ChartAppearance.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
#region Copyright Syncfusion Inc. 2001-2020.
// Copyright Syncfusion Inc. 2001-2020. All rights reserved.
// Use of this code is subject to the terms of our license.
// A copy of the current license can be obtained at any time by e-mailing
// licensing@syncfusion.com. Any infringement will be prosecuted under
// applicable laws.
#endregion

using System;
using System.Drawing;
using Syncfusion.Windows.Forms.Chart;

namespace SymuScenariosAndEvents
{
public static class ChartAppearance
{
public static void ApplyChartStyles(ChartControl chart)
{
if (chart == null)
{
throw new ArgumentNullException(nameof(chart));
}

#region Chart Appearance Customization

chart.Skins = Skins.Metro;
chart.BorderAppearance.SkinStyle = ChartBorderSkinStyle.None;
chart.BorderAppearance.FrameThickness = new ChartThickness(-2, -2, 2, 2);
chart.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
chart.ChartArea.PrimaryXAxis.HidePartialLabels = true;
chart.ElementsSpacing = 5;

#endregion

#region Axes Customization

chart.PrimaryYAxis.RangeType = ChartAxisRangeType.Set;
chart.PrimaryXAxis.RangeType = ChartAxisRangeType.Set;
if (chart.Series.Count == 0 || chart.Series[0].Points.Count == 0)
{
return;
}
var max = chart.Series[0].Points[0].YValues[0];
for (var i = 0; i < chart.Series.Count; i++)
{
for (var j = 0; j < chart.Series[i].Points.Count; j++)
{
max = Math.Max(max, chart.Series[i].Points[j].YValues[0]);
}
}
chart.PrimaryYAxis.Range = new MinMaxInfo(0, max + 1, Math.Round(max / 10));
var min = chart.Series[0].Points[0].X;
max = min;
for (var i = 0; i < chart.Series.Count; i++)
{
for (var j = 0; j < chart.Series[i].Points.Count; j++)
{
min = Math.Min(min, chart.Series[i].Points[j].X);
max = Math.Max(max, chart.Series[i].Points[j].X);
}
}
chart.PrimaryXAxis.Range = new MinMaxInfo(min-10, max+10, Math.Round((max-min)/10));

chart.PrimaryXAxis.LabelRotate = true;
chart.PrimaryXAxis.LabelRotateAngle = 270;

chart.Series[0].Style.Border.Color = Color.Transparent;

#endregion


}
}
}
19 changes: 19 additions & 0 deletions Symu examples/SymuScenariosAndEvents/Classes/EventType.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#region Licence

// Description: Symu - SymuScenariosAndEvents
// Website: https://symu.org
// Copyright: (c) 2020 laurent morisseau
// License : the program is distributed under the terms of the GNU General Public License

#endregion

namespace SymuScenariosAndEvents.Classes
{
public enum EventType
{
NoEvent = 0,
OneShot = 1,
Cyclical = 2,
Random = 3
}
}

0 comments on commit 614fc84

Please sign in to comment.