Skip to content

Commit 1c88a5e

Browse files
committed
V0.8.0
1 parent 8de375e commit 1c88a5e

File tree

304 files changed

+1451
-1050
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

304 files changed

+1451
-1050
lines changed

CHANGELOG.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,15 @@
22

33
## Unreleased
44

5+
## 0.8.0 [](https://github.com/lmorisse/symu/compare/v0.8.0..v0.7.0) by [lmorisse](https://github.com/lmorisse)
6+
* Refactoring IterationResult
57
* Add LearningModel.OnAfterLearning event
68
* Refactoring Agent constructor and CommunicationTemplates
7-
* Add CyclicalIsolation by [lmorisse](https://github.com/lmorisse)
8-
* Add PromoterTemplate by [lmorisse](https://github.com/lmorisse)
9-
* Add Iterations and Charts in SymuMessageAndTask example by [lmorisse](https://github.com/lmorisse)
10-
* Refactoring BlockerCollection, BlockerResults and TasksResults by [lmorisse](https://github.com/lmorisse)
11-
* Add MessageResults by [lmorisse](https://github.com/lmorisse)
12-
9+
* Add CyclicalIsolation)
10+
* Add PromoterTemplate
11+
* Add Iterations and Charts in SymuMessageAndTask example
12+
* Refactoring BlockerCollection, BlockerResults and TasksResults
13+
* Add MessageResults
1314

1415
## 0.7.0 [](https://github.com/lmorisse/symu/compare/v0.7.0..v0.6.0) by [lmorisse](https://github.com/lmorisse)
1516
* Renaming namespaces

RELEASENOTES.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Release notes
22

3+
## 0.8.0
4+
This release contains refactoring and minor bug fixes
5+
36
## 0.7.0
47
This release contains a new project example: [SymuScenariosAndEvents](https://github.com/lmorisse/Symu/tree/master/Symu%20examples/SymuScenariosAndEvents).
58

Symu examples/SymuBeliefsAndInfluence/Classes/ExampleEnvironment.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#region Licence
22

3-
// Description: Symu - SymuBeliefsAndInfluence
3+
// Description: SymuBiz - SymuBeliefsAndInfluence
44
// Website: https://symu.org
55
// Copyright: (c) 2020 laurent morisseau
66
// License : the program is distributed under the terms of the GNU General Public License
@@ -14,10 +14,8 @@
1414
using Symu.Classes.Agents;
1515
using Symu.Classes.Agents.Models.CognitiveTemplates;
1616
using Symu.Classes.Organization;
17-
using Symu.Classes.Task;
1817
using Symu.Common;
1918
using Symu.Environment;
20-
using Symu.Messaging.Messages;
2119
using Symu.Repository.Networks.Knowledges;
2220

2321
#endregion
@@ -32,6 +30,7 @@ public class ExampleEnvironment : SymuEnvironment
3230
public List<Knowledge> Knowledges { get; private set; }
3331
public List<InfluencerAgent> Influencers { get; } = new List<InfluencerAgent>();
3432
public PromoterTemplate InfluencerTemplate { get; } = new PromoterTemplate();
33+
3534
public SimpleHumanTemplate WorkerTemplate { get; } = new SimpleHumanTemplate();
3635
//public MurphyTask Model { get; } = new MurphyTask();
3736

Symu examples/SymuBeliefsAndInfluence/Classes/InfluencerAgent.cs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#region Licence
22

3-
// Description: Symu - SymuBeliefsAndInfluence
3+
// Description: SymuBiz - SymuBeliefsAndInfluence
44
// Website: https://symu.org
55
// Copyright: (c) 2020 laurent morisseau
66
// License : the program is distributed under the terms of the GNU General Public License
@@ -26,13 +26,15 @@ namespace SymuBeliefsAndInfluence.Classes
2626
public sealed class InfluencerAgent : Agent
2727
{
2828
public const byte ClassKey = SymuYellowPages.Actor;
29-
public IEnumerable<Knowledge> Knowledges => ((ExampleEnvironment)Environment).Knowledges;
3029

31-
public InfluencerAgent(ushort agentKey, SymuEnvironment environment, CognitiveArchitectureTemplate template) : base(
30+
public InfluencerAgent(ushort agentKey, SymuEnvironment environment,
31+
CognitiveArchitectureTemplate template) : base(
3232
new AgentId(agentKey, ClassKey), environment, template)
3333
{
3434
}
3535

36+
public IEnumerable<Knowledge> Knowledges => ((ExampleEnvironment) Environment).Knowledges;
37+
3638
/// <summary>
3739
/// Customize the cognitive architecture of the agent
3840
/// After setting the Agent template
@@ -56,7 +58,8 @@ protected override void SetModels()
5658
base.SetModels();
5759
foreach (var knowledge in Knowledges)
5860
{
59-
KnowledgeModel.AddKnowledge(knowledge.Id, KnowledgeLevel.FullKnowledge, Cognitive.InternalCharacteristics);
61+
KnowledgeModel.AddKnowledge(knowledge.Id, KnowledgeLevel.FullKnowledge,
62+
Cognitive.InternalCharacteristics);
6063
BeliefsModel.AddBelief(knowledge.Id, Cognitive.KnowledgeAndBeliefs.DefaultBeliefLevel);
6164
}
6265
}

Symu examples/SymuBeliefsAndInfluence/Classes/PersonAgent.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#region Licence
22

3-
// Description: Symu - SymuBeliefsAndInfluence
3+
// Description: SymuBiz - SymuBeliefsAndInfluence
44
// Website: https://symu.org
55
// Copyright: (c) 2020 laurent morisseau
66
// License : the program is distributed under the terms of the GNU General Public License
@@ -65,7 +65,8 @@ protected override void SetModels()
6565
base.SetModels();
6666
foreach (var knowledge in Knowledges)
6767
{
68-
KnowledgeModel.AddKnowledge(knowledge.Id, KnowledgeLevel.FullKnowledge, Cognitive.InternalCharacteristics);
68+
KnowledgeModel.AddKnowledge(knowledge.Id, KnowledgeLevel.FullKnowledge,
69+
Cognitive.InternalCharacteristics);
6970
//Beliefs are added with knowledge based on DefaultBeliefLevel of the worker cognitive template
7071
BeliefsModel.AddBelief(knowledge.Id, Cognitive.KnowledgeAndBeliefs.DefaultBeliefLevel);
7172
}

Symu examples/SymuBeliefsAndInfluence/Home.cs

Lines changed: 41 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#region Licence
22

3-
// Description: Symu - SymuBeliefsAndInfluence
3+
// Description: SymuBiz - SymuBeliefsAndInfluence
44
// Website: https://symu.org
55
// Copyright: (c) 2020 laurent morisseau
66
// License : the program is distributed under the terms of the GNU General Public License
@@ -42,17 +42,21 @@ private void LoadSettings()
4242
DisplayButtons();
4343

4444
InfluenceModelOn.Checked = OrganizationEntity.Models.Influence.On;
45-
InfluenceRateOfAgentsOn.Text = OrganizationEntity.Models.Influence.RateOfAgentsOn.ToString(CultureInfo.InvariantCulture);
45+
InfluenceRateOfAgentsOn.Text =
46+
OrganizationEntity.Models.Influence.RateOfAgentsOn.ToString(CultureInfo.InvariantCulture);
4647

4748
BeliefsModelOn.Checked = OrganizationEntity.Models.Beliefs.On;
48-
BeliefsRateOfAgentsOn.Text = OrganizationEntity.Models.Beliefs.RateOfAgentsOn.ToString(CultureInfo.InvariantCulture);
49+
BeliefsRateOfAgentsOn.Text =
50+
OrganizationEntity.Models.Beliefs.RateOfAgentsOn.ToString(CultureInfo.InvariantCulture);
4951

5052
tbWorkers.Text = _environment.WorkersCount.ToString(CultureInfo.InvariantCulture);
5153
tbInfluencers.Text = _environment.InfluencersCount.ToString(CultureInfo.InvariantCulture);
5254
tbKnowledge.Text = _environment.KnowledgeCount.ToString(CultureInfo.InvariantCulture);
5355

5456
HasBeliefs.Checked = OrganizationEntity.Templates.Human.Cognitive.KnowledgeAndBeliefs.HasBelief;
55-
ThresholdForReacting.Text = OrganizationEntity.Murphies.IncompleteBelief.ThresholdForReacting.ToString(CultureInfo.InvariantCulture);
57+
ThresholdForReacting.Text =
58+
OrganizationEntity.Murphies.IncompleteBelief.ThresholdForReacting
59+
.ToString(CultureInfo.InvariantCulture);
5660

5761
#region Influencer
5862

@@ -75,7 +79,8 @@ private void LoadSettings()
7579

7680
#region Worker
7781

78-
MandatoryRatio.Text = OrganizationEntity.Murphies.IncompleteBelief.MandatoryRatio.ToString(CultureInfo.InvariantCulture);
82+
MandatoryRatio.Text =
83+
OrganizationEntity.Murphies.IncompleteBelief.MandatoryRatio.ToString(CultureInfo.InvariantCulture);
7984
RiskAversion.Text = _environment.WorkerTemplate.Cognitive.InternalCharacteristics.RiskAversionThreshold
8085
.ToString(CultureInfo.InvariantCulture);
8186
BeliefWeight.Items.AddRange(BeliefWeightLevelService.GetNames());
@@ -313,7 +318,8 @@ private void MinimumBeliefToSendPerBit_TextChanged(object sender, EventArgs e)
313318
try
314319
{
315320
_environment.InfluencerTemplate.Cognitive.MessageContent
316-
.MinimumBeliefToSendPerBit = float.Parse(MinimumBeliefToSendPerBit.Text, CultureInfo.InvariantCulture);
321+
.MinimumBeliefToSendPerBit =
322+
float.Parse(MinimumBeliefToSendPerBit.Text, CultureInfo.InvariantCulture);
317323
MinimumBeliefToSendPerBit.BackColor = SystemColors.Window;
318324
}
319325
catch (FormatException)
@@ -332,7 +338,8 @@ private void MinimumNumberOfBitsOfBeliefToSend_TextChanged(object sender, EventA
332338
try
333339
{
334340
_environment.InfluencerTemplate.Cognitive.MessageContent
335-
.MinimumNumberOfBitsOfBeliefToSend = byte.Parse(MinimumNumberOfBitsOfBeliefToSend.Text, CultureInfo.InvariantCulture);
341+
.MinimumNumberOfBitsOfBeliefToSend = byte.Parse(MinimumNumberOfBitsOfBeliefToSend.Text,
342+
CultureInfo.InvariantCulture);
336343
MinimumNumberOfBitsOfBeliefToSend.BackColor = SystemColors.Window;
337344
}
338345
catch (FormatException)
@@ -351,7 +358,8 @@ private void MaximumNumberOfBitsOfBeliefToSend_TextChanged(object sender, EventA
351358
try
352359
{
353360
_environment.InfluencerTemplate.Cognitive.MessageContent
354-
.MaximumNumberOfBitsOfBeliefToSend = byte.Parse(MaximumNumberOfBitsOfBeliefToSend.Text, CultureInfo.InvariantCulture);
361+
.MaximumNumberOfBitsOfBeliefToSend = byte.Parse(MaximumNumberOfBitsOfBeliefToSend.Text,
362+
CultureInfo.InvariantCulture);
355363
MaximumNumberOfBitsOfBeliefToSend.BackColor = SystemColors.Window;
356364
}
357365
catch (FormatException)
@@ -387,7 +395,8 @@ private void MandatoryRatio_TextChanged(object sender, EventArgs e)
387395
{
388396
try
389397
{
390-
OrganizationEntity.Murphies.IncompleteBelief.MandatoryRatio = float.Parse(MandatoryRatio.Text, CultureInfo.InvariantCulture);
398+
OrganizationEntity.Murphies.IncompleteBelief.MandatoryRatio =
399+
float.Parse(MandatoryRatio.Text, CultureInfo.InvariantCulture);
391400
MandatoryRatio.BackColor = SystemColors.Window;
392401
}
393402
catch (FormatException)
@@ -405,7 +414,8 @@ private void RateOfAgentsOn_TextChanged(object sender, EventArgs e)
405414
{
406415
try
407416
{
408-
OrganizationEntity.Models.Influence.RateOfAgentsOn = float.Parse(InfluenceRateOfAgentsOn.Text, CultureInfo.InvariantCulture);
417+
OrganizationEntity.Models.Influence.RateOfAgentsOn =
418+
float.Parse(InfluenceRateOfAgentsOn.Text, CultureInfo.InvariantCulture);
409419
InfluenceRateOfAgentsOn.BackColor = SystemColors.Window;
410420
}
411421
catch (FormatException)
@@ -442,7 +452,8 @@ private void BeliefsRateOfAgentsOn_TextChanged(object sender, EventArgs e)
442452
{
443453
try
444454
{
445-
OrganizationEntity.Models.Beliefs.RateOfAgentsOn = float.Parse(BeliefsRateOfAgentsOn.Text, CultureInfo.InvariantCulture);
455+
OrganizationEntity.Models.Beliefs.RateOfAgentsOn =
456+
float.Parse(BeliefsRateOfAgentsOn.Text, CultureInfo.InvariantCulture);
446457
BeliefsRateOfAgentsOn.BackColor = SystemColors.Window;
447458
}
448459
catch (FormatException)
@@ -456,6 +467,25 @@ private void BeliefsRateOfAgentsOn_TextChanged(object sender, EventArgs e)
456467
}
457468
}
458469

470+
private void textBox1_TextChanged(object sender, EventArgs e)
471+
{
472+
try
473+
{
474+
OrganizationEntity.Murphies.IncompleteBelief.ThresholdForReacting =
475+
float.Parse(ThresholdForReacting.Text, CultureInfo.InvariantCulture);
476+
ThresholdForReacting.BackColor = SystemColors.Window;
477+
}
478+
catch (FormatException)
479+
{
480+
ThresholdForReacting.BackColor = Color.Red;
481+
}
482+
catch (ArgumentOutOfRangeException exception)
483+
{
484+
ThresholdForReacting.BackColor = Color.Red;
485+
MessageBox.Show(exception.Message);
486+
}
487+
}
488+
459489
#region Menu
460490

461491
private void symuorgToolStripMenuItem_Click(object sender, EventArgs e)
@@ -479,23 +509,5 @@ private void issuesToolStripMenuItem_Click(object sender, EventArgs e)
479509
}
480510

481511
#endregion
482-
483-
private void textBox1_TextChanged(object sender, EventArgs e)
484-
{
485-
try
486-
{
487-
OrganizationEntity.Murphies.IncompleteBelief.ThresholdForReacting = float.Parse(ThresholdForReacting.Text, CultureInfo.InvariantCulture);
488-
ThresholdForReacting.BackColor = SystemColors.Window;
489-
}
490-
catch (FormatException)
491-
{
492-
ThresholdForReacting.BackColor = Color.Red;
493-
}
494-
catch (ArgumentOutOfRangeException exception)
495-
{
496-
ThresholdForReacting.BackColor = Color.Red;
497-
MessageBox.Show(exception.Message);
498-
}
499-
}
500512
}
501513
}

Symu examples/SymuBeliefsAndInfluence/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#region Licence
22

3-
// Description: Symu - SymuBeliefsAndInfluence
3+
// Description: SymuBiz - SymuBeliefsAndInfluence
44
// Website: https://symu.org
55
// Copyright: (c) 2020 laurent morisseau
66
// License : the program is distributed under the terms of the GNU General Public License

Symu examples/SymuBeliefsAndInfluence/Properties/AssemblyInfo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#region Licence
22

3-
// Description: Symu - SymuBeliefsAndInfluence
3+
// Description: SymuBiz - SymuBeliefsAndInfluence
44
// Website: https://symu.org
55
// Copyright: (c) 2020 laurent morisseau
66
// License : the program is distributed under the terms of the GNU General Public License

Symu examples/SymuBeliefsAndInfluence/Properties/Resources.resx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
: and then encoded with base64 encoding.
6161
-->
6262
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
63-
<xsd:element name="root" msdata:IsDataCopyTo="true">
63+
<xsd:element name="root" msdata:IsDataClone="true">
6464
<xsd:complexType>
6565
<xsd:choice maxOccurs="unbounded">
6666
<xsd:element name="metadata">

Symu examples/SymuBeliefsAndInfluenceTests/IntegrationTests.cs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#region Licence
22

3-
// Description: Symu - SymuBeliefsAndInfluenceTests
3+
// Description: SymuBiz - SymuBeliefsAndInfluenceTests
44
// Website: https://symu.org
55
// Copyright: (c) 2020 laurent morisseau
66
// License : the program is distributed under the terms of the GNU General Public License
@@ -13,7 +13,6 @@
1313
using Microsoft.VisualStudio.TestTools.UnitTesting;
1414
using Symu.Classes.Organization;
1515
using Symu.Classes.Scenario;
16-
using Symu.Common;
1716
using Symu.Engine;
1817
using Symu.Repository.Networks.Beliefs;
1918
using Symu.Tools;
@@ -248,8 +247,9 @@ public void NoWeightTest()
248247
(_environment.Schedule.Step * _environment.WorkersCount);
249248
Assert.AreEqual(100, tasksDoneRatio);
250249
}
250+
251251
/// <summary>
252-
/// Full risk aversion
252+
/// Full risk aversion
253253
/// </summary>
254254
[TestMethod]
255255
public void FullWeightTest()
@@ -266,10 +266,12 @@ public void FullWeightTest()
266266
: _environment.IterationResult.Tasks.Done * 100 /
267267
(_environment.Schedule.Step * _environment.WorkersCount);
268268
Assert.AreEqual(0, tasksDoneRatio);
269-
Assert.AreEqual(_environment.Schedule.Step * _environment.WorkersCount, _environment.IterationResult.Tasks.Cancelled);
269+
Assert.AreEqual(_environment.Schedule.Step * _environment.WorkersCount,
270+
_environment.IterationResult.Tasks.Cancelled);
270271
}
272+
271273
/// <summary>
272-
/// No risk aversion
274+
/// No risk aversion
273275
/// </summary>
274276
[TestMethod]
275277
public void FullWeightTest1()

0 commit comments

Comments
 (0)