Skip to content

Commit

Permalink
Renaming networks
Browse files Browse the repository at this point in the history
  • Loading branch information
lmorisse committed Aug 20, 2020
1 parent 9f8c443 commit 688ba55
Show file tree
Hide file tree
Showing 35 changed files with 216 additions and 216 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ namespace Symu.Classes.Agents.Models.CognitiveModels
public class ActivityModel
{
private readonly AgentId _agentId;
private readonly NetworkActivities _networkActivities;
private readonly ActivityNetwork _networkActivities;

/// <summary>
/// Initialize influence model :
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public class BeliefsModel
private readonly AgentId _agentId;
private readonly KnowledgeAndBeliefs _knowledgeAndBeliefs;
private readonly MessageContent _messageContent;
private readonly NetworkBeliefs _networkBeliefs;
private readonly BeliefNetwork _networkBeliefs;

/// <summary>
/// Initialize Beliefs model :
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ namespace Symu.Classes.Agents.Models.CognitiveModels
public class InfluenceModel
{
private readonly AgentId _agentId;
private readonly NetworkBeliefs _networkBeliefs;
private readonly NetworkInfluences _networkInfluences;
private readonly BeliefNetwork _networkBeliefs;
private readonly InfluenceNetwork _networkInfluences;

/// <summary>
/// Initialize influence model :
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public class KnowledgeModel
private readonly AgentId _agentId;
private readonly KnowledgeAndBeliefs _knowledgeAndBeliefs;
private readonly MessageContent _messageContent;
private readonly NetworkKnowledges _networkKnowledges;
private readonly KnowledgeNetwork _knowledgeNetwork;

/// <summary>
/// Initialize Knowledge model :
Expand Down Expand Up @@ -62,19 +62,19 @@ public class KnowledgeModel

On = entity.IsAgentOn();
_agentId = agentId;
_networkKnowledges = network.Knowledge;
_knowledgeNetwork = network.Knowledge;
_knowledgeAndBeliefs = cognitiveArchitecture.KnowledgeAndBeliefs;
_messageContent = cognitiveArchitecture.MessageContent;
if (_knowledgeAndBeliefs.HasKnowledge)
{
if (_networkKnowledges.Exists(_agentId))
if (_knowledgeNetwork.Exists(_agentId))
{
Expertise = _networkKnowledges.GetAgentExpertise(_agentId);
Expertise = _knowledgeNetwork.GetAgentExpertise(_agentId);
}
else
{
Expertise = new AgentExpertise();
_networkKnowledges.Add(_agentId, Expertise);
_knowledgeNetwork.Add(_agentId, Expertise);
}
}
else
Expand Down Expand Up @@ -148,8 +148,8 @@ public void InitializeExpertise(ushort step)
return;
}

_networkKnowledges.AddAgentId(_agentId, Expertise);
_networkKnowledges.InitializeExpertise(_agentId, !_knowledgeAndBeliefs.HasInitialKnowledge, step);
_knowledgeNetwork.AddAgentId(_agentId, Expertise);
_knowledgeNetwork.InitializeExpertise(_agentId, !_knowledgeAndBeliefs.HasInitialKnowledge, step);
}

/// <summary>
Expand All @@ -159,7 +159,7 @@ public void InitializeExpertise(ushort step)
/// <param name="step"></param>
public void InitializeKnowledge(ushort knowledgeId, ushort step)
{
_networkKnowledges.InitializeAgentKnowledge(GetKnowledge(knowledgeId),
_knowledgeNetwork.InitializeAgentKnowledge(GetKnowledge(knowledgeId),
!_knowledgeAndBeliefs.HasInitialKnowledge, step);
}

Expand All @@ -174,7 +174,7 @@ public void AddExpertise(AgentExpertise expertise)
return;
}

_networkKnowledges.Add(_agentId, expertise);
_knowledgeNetwork.Add(_agentId, expertise);
}

/// <summary>
Expand Down Expand Up @@ -209,7 +209,7 @@ public void AddKnowledge(ushort knowledgeId, KnowledgeLevel level, float minimum
return;
}

_networkKnowledges.Add(_agentId, knowledgeId, level, minimumKnowledge, timeToLive);
_knowledgeNetwork.Add(_agentId, knowledgeId, level, minimumKnowledge, timeToLive);
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public class LearningModel : ModelEntity
{
private readonly AgentId _id;
private readonly InternalCharacteristics _internalCharacteristics;
private readonly NetworkKnowledges _networkKnowledges;
private readonly KnowledgeNetwork _knowledgeNetwork;
private readonly byte _randomLevel;
/// <summary>
/// Accumulates all learning of the agent during the simulation
Expand Down Expand Up @@ -64,17 +64,17 @@ public float GetKnowledgePotential()
return Expertise.List.Sum(l => l.GetKnowledgePotential());
}

public LearningModel(AgentId agentId, OrganizationModels models, NetworkKnowledges networkKnowledges,
public LearningModel(AgentId agentId, OrganizationModels models, KnowledgeNetwork knowledgeNetwork,
CognitiveArchitecture cognitiveArchitecture)
{
if (models == null)
{
throw new ArgumentNullException(nameof(models));
}

if (networkKnowledges == null)
if (knowledgeNetwork == null)
{
throw new ArgumentNullException(nameof(networkKnowledges));
throw new ArgumentNullException(nameof(knowledgeNetwork));
}

if (cognitiveArchitecture == null)
Expand All @@ -86,15 +86,15 @@ public float GetKnowledgePotential()
_id = agentId;
TasksAndPerformance = cognitiveArchitecture.TasksAndPerformance;
_internalCharacteristics = cognitiveArchitecture.InternalCharacteristics;
_networkKnowledges = networkKnowledges;
_knowledgeNetwork = knowledgeNetwork;
_randomLevel = models.RandomLevelValue;
if (!cognitiveArchitecture.InternalCharacteristics.CanLearn || !cognitiveArchitecture.KnowledgeAndBeliefs.HasKnowledge)
{
// Agent is not concerned by this model
On = false;
}

Expertise = _networkKnowledges.Exists(_id) ? _networkKnowledges.GetAgentExpertise(_id): null;
Expertise = _knowledgeNetwork.Exists(_id) ? _knowledgeNetwork.GetAgentExpertise(_id): null;
}

public TasksAndPerformance TasksAndPerformance { get; set; }
Expand Down Expand Up @@ -158,7 +158,7 @@ public void Learn(ushort knowledgeId, Bits knowledgeBits, float maxRateLearnable
throw new ArgumentNullException(nameof(knowledgeBits));
}

_networkKnowledges.LearnNewKnowledge(_id, knowledgeId, minimumKnowledge, timeToLive, step);
_knowledgeNetwork.LearnNewKnowledge(_id, knowledgeId, minimumKnowledge, timeToLive, step);
var agentKnowledge = Expertise.GetKnowledge(knowledgeId);
Learn(knowledgeBits, maxRateLearnable, agentKnowledge, step);
}
Expand Down Expand Up @@ -218,7 +218,7 @@ public float Learn(ushort knowledgeId, byte knowledgeBit, float minimumKnowledge
return 0;
}

_networkKnowledges.LearnNewKnowledge(_id, knowledgeId, minimumKnowledge, timeToLive, step);
_knowledgeNetwork.LearnNewKnowledge(_id, knowledgeId, minimumKnowledge, timeToLive, step);
return AgentKnowledgeLearn(Expertise.GetKnowledge(knowledgeId), knowledgeBit, NextLearning(), step);
}

Expand Down Expand Up @@ -284,7 +284,7 @@ public float LearnByDoing(ushort knowledgeId, byte knowledgeBit, ushort step)
return 0;
}

_networkKnowledges.LearnNewKnowledge(_id, knowledgeId, minimumKnowledge, timeToLive, step);
_knowledgeNetwork.LearnNewKnowledge(_id, knowledgeId, minimumKnowledge, timeToLive, step);
return AgentKnowledgeLearn(Expertise.GetKnowledge(knowledgeId), knowledgeBit, NextLearningByDoing(), step);
}

Expand Down
4 changes: 2 additions & 2 deletions SourceCode/Symu/Repository/Entity/Database.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public class Database : IResource
public IAgentId Id => Entity.AgentId;

public Database(DatabaseEntity entity, OrganizationModels organizationModels,
NetworkKnowledges networkKnowledges)
KnowledgeNetwork knowledgeNetwork)
{
if (entity == null)
{
Expand All @@ -62,7 +62,7 @@ public class Database : IResource
}

Entity = new DatabaseEntity(entity.AgentId, entity.CognitiveArchitecture);
_learningModel = new LearningModel((AgentId)Entity.AgentId, organizationModels, networkKnowledges,
_learningModel = new LearningModel((AgentId)Entity.AgentId, organizationModels, knowledgeNetwork,
entity.CognitiveArchitecture);
_forgettingModel = new ForgettingModel(_database, entity.CognitiveArchitecture, organizationModels);
}
Expand Down
6 changes: 3 additions & 3 deletions SourceCode/Symu/Repository/Entity/Email.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ namespace Symu.Repository.Entity
/// </summary>
public class Email : Database
{
public static Email CreateInstance(AgentId agentId, OrganizationModels organizationModels, NetworkKnowledges networkKnowledges)
public static Email CreateInstance(AgentId agentId, OrganizationModels organizationModels, KnowledgeNetwork knowledgeNetwork)
{
CommunicationTemplate communication = new EmailTemplate();
var entity = new DatabaseEntity(agentId, communication);
return new Email(entity, organizationModels, networkKnowledges);
return new Email(entity, organizationModels, knowledgeNetwork);
}

private Email(DatabaseEntity entity, OrganizationModels organizationModels,
NetworkKnowledges networkKnowledges) : base(entity, organizationModels, networkKnowledges)
KnowledgeNetwork knowledgeNetwork) : base(entity, organizationModels, knowledgeNetwork)
{
}

Expand Down
6 changes: 3 additions & 3 deletions SourceCode/Symu/Repository/Entity/Wiki.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ namespace Symu.Repository.Entity
/// </summary>
public class Wiki : Database
{
public static Wiki CreateInstance(AgentId agentId, OrganizationModels organizationModels, NetworkKnowledges networkKnowledges)
public static Wiki CreateInstance(AgentId agentId, OrganizationModels organizationModels, KnowledgeNetwork knowledgeNetwork)
{
CommunicationTemplate communication = new ViaPlatformTemplate();
var entity = new DatabaseEntity(agentId, communication);
return new Wiki(entity, organizationModels, networkKnowledges);
return new Wiki(entity, organizationModels, knowledgeNetwork);
}

private Wiki(DatabaseEntity entity, OrganizationModels organizationModels,
NetworkKnowledges networkKnowledges) : base(entity, organizationModels, networkKnowledges)
KnowledgeNetwork knowledgeNetwork) : base(entity, organizationModels, knowledgeNetwork)
{
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ namespace Symu.Repository.Networks.Activities
/// Key => GroupId
/// Value => List of AgentActivity : AgentId, activity
/// </summary>
public class NetworkActivities
public class ActivityNetwork
{
/// <summary>
/// List of all GroupIds and their activities
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ namespace Symu.Repository.Networks.Beliefs
/// Value : the list of NetworkInformation the agent knows
/// </summary>
/// <example></example>
public class NetworkBeliefs
public class BeliefNetwork
{
public NetworkBeliefs(BeliefWeightLevel beliefWeightLevel)
public BeliefNetwork(BeliefWeightLevel beliefWeightLevel)
{
BeliefWeightLevel = beliefWeightLevel;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ namespace Symu.Repository.Networks.Enculturation
/// Key => AgentId
/// Value => Enculturation value
/// </summary>
public class NetworkEnculturation
public class EnculturationNetwork
{
/// <summary>
/// List of all agentId and their enculturation information
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ namespace Symu.Repository.Networks.Group
/// Value => List of AgentIds
/// </summary>
/// <example>Groups : team, task force, quality circle, community of practices, committees, ....</example>
public class NetworkGroups
public class GroupNetwork
{
/// <summary>
/// Key => groupId
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ namespace Symu.Repository.Networks.Influences
/// <summary>
/// NetWork of agents influences
/// </summary>
public class NetworkInfluences
public class InfluenceNetwork
{
public List<Influence> List { get; } = new List<Influence>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ namespace Symu.Repository.Networks.Knowledges
/// Value : the list of NetworkInformation the agent knows
/// </summary>
/// <example></example>
public class NetworkKnowledges
public class KnowledgeNetwork
{
/// <summary>
/// Describe the knowledge model :
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ namespace Symu.Repository.Networks.Link
/// AgentId1 has the smallest key
/// AgentId2 has the highest key
/// </summary>
public class NetworkLink
public class LinkEntity
{
/// <summary>
/// Constructor
/// </summary>
/// <param name="agentId1"></param>
/// <param name="agentId2"></param>
public NetworkLink(IAgentId agentId1, IAgentId agentId2)
public LinkEntity(IAgentId agentId1, IAgentId agentId2)
{
if (agentId1 == null)
{
Expand Down Expand Up @@ -112,7 +112,7 @@ public bool HasLink(IAgentId agentId1, IAgentId agentId2)

public override bool Equals(object obj)
{
return obj is NetworkLink link &&
return obj is LinkEntity link &&
link.HasLink(AgentId1, AgentId2);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,18 @@ namespace Symu.Repository.Networks.Link
/// <summary>
/// List of Links of a NetWork
/// </summary>
public class NetworkLinks
public class LinkNetwork
{
private uint _maxLinksCount;
public List<NetworkLink> List { get; } = new List<NetworkLink>();
public List<LinkEntity> List { get; } = new List<LinkEntity>();
public int Count => List.Count;

/// <summary>
/// Gets or sets the element at the specified index
/// </summary>
/// <param name="index">0 based</param>
/// <returns></returns>
public NetworkLink this[int index]
public LinkEntity this[int index]
{
get => List[index];
set => List[index] = value;
Expand Down Expand Up @@ -95,13 +95,13 @@ public void AddLink(IAgentId agentId1, IAgentId agentId2)
}
else
{
List.Add(new NetworkLink(agentId1, agentId2));
List.Add(new LinkEntity(agentId1, agentId2));
}
}

public bool Exists(NetworkLink link)
public bool Exists(LinkEntity linkEntity)
{
return List.Contains(link);
return List.Contains(linkEntity);
}

/// <summary>
Expand All @@ -114,7 +114,7 @@ public bool Exists(IAgentId agentId1, IAgentId agentId2)
return List.Exists(x => x.HasLink(agentId1, agentId2));
}

private NetworkLink Get(IAgentId agentId1, IAgentId agentId2)
private LinkEntity Get(IAgentId agentId1, IAgentId agentId2)
{
return List.Find(x => x.HasLink(agentId1, agentId2));
}
Expand Down

0 comments on commit 688ba55

Please sign in to comment.