• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# INetwork类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中INetwork的典型用法代码示例。如果您正苦于以下问题:C# INetwork类的具体用法?C# INetwork怎么用?C# INetwork使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



INetwork类属于命名空间,在下文中一共展示了INetwork类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: RemoveUnusedNodes

 private void RemoveUnusedNodes(INetwork network)
 {
     if (allowRemoveUnusedNodes)
     {
         NetworkHelper.RemoveUnusedNodes(network);
     }
 }
开发者ID:lishxi,项目名称:_SharpMap,代码行数:7,代码来源:BranchNodeTopology.cs


示例2: ModifyIsDirectedProperty

 public void ModifyIsDirectedProperty(INetwork network, bool isDirected)
 {
     if (network != null && network is BasicAdjList)
     {
         ModifyIsDirectedProperty(network as BasicAdjList, isDirected);
     }
 }
开发者ID:BgRva,项目名称:Blob1,代码行数:7,代码来源:SimpleAdjListDirectedModifier.cs


示例3: ToDataTable

        public DataTable ToDataTable(INetwork network)
        {
            if (network == null)
                throw new ArgumentNullException("network", "The input network must not be null.");
            if (!(network is IEdgeAttributes))
                throw new ArgumentException(string.Format("The input network must implement {0}.", typeof(IEdgeAttributes).Name), "network");
            IEdgeAttributes src = network as IEdgeAttributes;
            DataTable table = new DataTable("Edge data");
            AttributeListMgr mgr = src.EdgeAttributeMgr as AttributeListMgr;
            if (mgr == null)
                throw new ArgumentException("The EdgeAttributeMgr of the input network must not be null.", "network");

            string[] colNames = EnsureUniqueColNames(mgr);
            int ctr = 0;
            foreach (IAttributeList list in mgr.Lists)
            {
                table.Columns.Add(new DataColumn(colNames[ctr++], list.DataType));
            }

            if (table.Columns.Count>0)
                for (int i = 0; i < mgr.Depth; i++)
                {
                    table.Rows.Add(mgr.GetRow(i));
                }

            table.AcceptChanges();
            return table;
        }
开发者ID:BgRva,项目名称:Blob1,代码行数:28,代码来源:SimpleAdjListEdgeAttributeExtractor.cs


示例4: CellNet

        public CellNet(INetwork network, ModelVisual3D mophology, Dictionary<Guid, ICell> cells, Dictionary<Guid, ICellNet> childcellnet)
        {
            this.network = network;
            this.mophology = mophology;
            this.cells = cells;
            this.childcellnet = childcellnet;
            IsPushing = true;

            var transforms = new Transform3DGroup();
            Rotate = new RotateTransform3D(new QuaternionRotation3D());
            Translate = new TranslateTransform3D(network.Position.X, network.Position.Y, network.Position.Z);
            Scale = new ScaleTransform3D();
            transforms.Children.Add(Rotate);
            transforms.Children.Add(Translate);
            transforms.Children.Add(Scale);
            Mophology.Transform = transforms;

            var binding = new Binding()
            {
                Source = network,
                Path = new PropertyPath("Position"),
                Mode = BindingMode.OneWay
            };
            BindingOperations.SetBinding(this, CellNet.PositionProperty, binding);
        }
开发者ID:babaq,项目名称:Soul,代码行数:25,代码来源:CellNet.cs


示例5: GetProperties

 public string GetProperties(INetwork network)
 {
     var sb = new StringBuilder();
     if (network == null)
     {
         sb.AppendLine("network is null");
     }
     else
     {
         ListPropertiesOfNetworkBase(network, sb);
         if (network is IAdjList)
         {
             ListPropertiesOfAdjList((IAdjList)network, sb);
         }
         else
         {
             var isMatrix = network.GetType().GetInterfaces()
                                   .Where(t => t.IsGenericType)
                                   .Select(t => t.GetGenericTypeDefinition())
                                   .Any(t => t.Equals(typeof(IMatrix<>)));
             if (isMatrix)
                 ListPropertiesOfMatrix(network, sb);
         }
     }
     return sb.ToString();
 }
开发者ID:BgRva,项目名称:Blob1,代码行数:26,代码来源:NetworkPropertyRetrieverToPlainText.cs


示例6: CreateCopier

 /// <summary>
 /// Creates an instance of ICopyNetwork appropriate to the underlying 
 /// Type of <paramref name="network"/>.
 /// The returned object can be used to create a copy of the input network.
 /// </summary>
 /// <param name="network">The network to be copied.</param>
 /// <returns>An ICopyNetwork instance</returns>
 public ICopyNetwork CreateCopier(INetwork network)
 {
     ICopyNetwork tool = null;
     if (network != null)
     {
         if (network is BlueSpider.Blob.Regular.Network.AdjList.SimpleAdjList)
         {
             tool = new BlueSpider.Blob.Regular.Network.AdjList.SimpleAdjListCopier();
         }
         else if (network is AdjList)
         {
             tool = new AdjacentList.Y.AdjListCopier();
         }
         else if (network is Matrix.CSpace.DirectedNetworkMatrix)
         {
             tool = new Matrix.CSpace.MatrixCopier();
         }
         else if (network is Matrix.CSpace.UnDirectedNetworkMatrix)
         {
             tool = new Matrix.CSpace.MatrixCopier();
         }
         else if (network is BlueSpider.Blob.Regular.Network.Matrix.SimpleFullMatrix)
         {
             throw new NotImplementedException();
         }
         else if (network is BlueSpider.Blob.Regular.Network.Matrix.SimpleSymmetricMatrix)
         {
             throw new NotImplementedException();
         }
     }
     return tool;
 }
开发者ID:BgRva,项目名称:Blob1,代码行数:39,代码来源:CopyNetworkProvider.cs


示例7: DummyInputNetworkPort

 /// <summary>
 /// Initializes a new instance of the DummyInputNetworkPort class, This class maintains the dataObj
 /// as a member, does NOT use the backingStore of the pipe.
 /// </summary>
 /// <param name="parent"></param>
 /// <param name="inPipe"></param>
 /// <param name="dataObj"></param>
 /// <param name="isValid"></param>
 public DummyInputNetworkPort(IElement parent, INetworkPipe inPipe, INetwork dataObj, bool isValid)
 {
     _parent = parent;
     _inPipe = inPipe;
     _netObj = dataObj;
     _IsValid = isValid;
 }
开发者ID:BgRva,项目名称:Blob1,代码行数:15,代码来源:DummyInputNetworkPort.cs


示例8: World

 public World(INetwork network)
     : base(0, 0, 1000, 1000)
 {
     color = System.Drawing.Brushes.White;
     bigBrain = (FloatFastConcurrentNetwork)network;
     size = height;
 }
开发者ID:coastwise,项目名称:HyperSharpNEAT,代码行数:7,代码来源:World.cs


示例9: NetworkEvent

 private NetworkEvent(INetwork network, IEventType type, IEventSource source)
 {
     Network = network;
     Type = type;
     TimeStamp = DateTime.UtcNow;
     Source = source;
 }
开发者ID:Mavtak,项目名称:roomie,代码行数:7,代码来源:NetworkEvent.cs


示例10: NetworkDispatcher

 public NetworkDispatcher(ConcurrentQueue<Request> queue, INetwork network, ICache cache, IResponseDelivery delivery)
 {
     this.mQueue = queue;
     this.mNetwork = network;
     this.mCache = cache;
     this.mDelivery = delivery;
 }
开发者ID:huguodong,项目名称:Volley-For-Xamarin-Android,代码行数:7,代码来源:NetworkDispatcher.cs


示例11: SetOrderForBranch

        public static void SetOrderForBranch(INetwork network, IBranch branch)
        {
            // node is new if it is exclusive to branch
            var connectionsFromNodeCount = branch.Source.IncomingBranches.Count + branch.Source.OutgoingBranches.Count;
            var connectionsToNodeCount = branch.Target.IncomingBranches.Count + branch.Target.OutgoingBranches.Count;
            if (connectionsFromNodeCount == 1 && connectionsToNodeCount == 1)
            {
                // new branch, not connected (do not assign -1 since user might have assigned it when constructing object)
                return;
            }

            if(connectionsFromNodeCount > 2 || connectionsToNodeCount > 2)
            {
                branch.OrderNumber = -1;
                return;
            }
            if (connectionsFromNodeCount == 1 && connectionsToNodeCount == 2)
            {
                branch.OrderNumber = ComputeMaximumOrderForNode(network, branch.Target);
                return;
            }
            if (connectionsFromNodeCount == 2 && connectionsToNodeCount == 1)
            {
                branch.OrderNumber = ComputeMaximumOrderForNode(network, branch.Source);
                return;
            }
        }
开发者ID:lishxi,项目名称:_SharpMap,代码行数:27,代码来源:BranchOrderHelper.cs


示例12: CopyNetwork

        public INetwork CopyNetwork(INetwork source)
        {
            if (source == null)
                throw new ArgumentNullException("source", "The network to be copied is null.");
            if (!(source is IBasicAdjList))
                throw new ArgumentException(
                    string.Format("The network to be copied must implement {0}.", typeof (IBasicAdjList).Name),
                    "source");

            if (NewNetworkId == Guid.Empty)
                NewNetworkId = Guid.NewGuid();

            IBasicAdjList copy = null;
            IBasicAdjList src = source as IBasicAdjList;

            // copy the network; *Note this copies the network structure (nodes & edges) but
            // does not structure or populate the attributes
            using (var fac = new BasicAdjListFactory())
            {
                fac.IsDirected = src.IsDirected;
                fac.EnableNodeDataAttributes = (CopyNodeData );
                fac.EnableEdgeDataAttributes = (CopyEdgeData );
                copy = fac.CreateNetwork(NewNetworkId, src.NodeCount) as IBasicAdjList;
                copy.Name = src.Name != null ? string.Copy(src.Name) : null;
            }

            INode copySrcNode = null;
            INode copyDestNode = null;
            int srcNodeIndex = -1;
            int destNodeIndex = -1;
            IEdge copiedEdge = null;
            for (int i = 0; i < src.Edges.Count; i++)
            {
                srcNodeIndex = src.Edges[i].SourceNode.Index;
                destNodeIndex = src.Edges[i].DestinationNode.Index;
                copySrcNode = copy.Nodes[srcNodeIndex];
                copyDestNode = copy.Nodes[destNodeIndex];
                copiedEdge = copy.CreateEdge(copySrcNode, copyDestNode);
            }

            using (var fac = new DataAttributeCopierProvider())
            {
                if (CopyNodeData && src.NodeData != null)
                {
                    using (var copier = fac.GetCopier(src.NodeData))
                    {
                        copier.Copy(src.NodeData, copy.NodeData);
                    }
                }
                if (CopyEdgeData && src.EdgeData != null)
                {
                    using (var copier = fac.GetCopier(src.EdgeData))
                    {
                        copier.Copy(src.EdgeData, copy.EdgeData);
                    }
                }
            }

            return copy;
        }
开发者ID:BgRva,项目名称:Blob1,代码行数:60,代码来源:BasicAdjListCopier.cs


示例13: CreateWriter

        /// <summary>
        /// Creates and returns a writer.
        /// </summary>
        /// <param name="fileType">A <see cref="NetworkFileTypes"/> value specifying the intended output format.</param>
        /// <param name="network">The source INetwork to be written.</param>
        /// <returns>INetworkFileWriter</returns>
        public static INetworkFileWriter CreateWriter(NetworkFileTypes fileType, INetwork network)
        {
            INetworkFileWriter writer = null;

            if (network!=null)
            {
                switch (fileType)
                {
                    case NetworkFileTypes.Pajek_Net:
                        if (network is IBasicAdjList)
                            writer = new PajekBasicAdjListWriter();
                        break;
                    case NetworkFileTypes.GraphML:
                        if (network is IBasicAdjList)
                            writer = new GraphMlBasicAdjListWriter();
                        break;
                    case NetworkFileTypes.NetDraw_VNA:
                        if (network is IBasicAdjList)
                            writer = new VNABasicAdjListWriter();
                        break;
                    default:
                        writer = null;
                        break;
                }
            }

            return writer;
        }
开发者ID:BgRva,项目名称:Blob1,代码行数:34,代码来源:NetworkWriterFactory.cs


示例14: AgentBrain

        public int numBrains; // Schrum: Total number

        public AgentBrain(bool homogenous, int numAgents, SubstrateDescription substrateDescription, INetwork genome,
            bool normalizeANNWeights, bool adaptableANN, bool modulatoryANN, bool multi, int brains, bool evolveSubstrate, bool preferenceNeurons, bool forcedSituationalPolicyGeometry)
        {
            this.evolveSubstrate = evolveSubstrate;
            this.normalizeANNWeights = normalizeANNWeights;
            this.adaptableANN = adaptableANN;
            this.modulatoryANN = modulatoryANN;
            this.genome = genome;
            this.substrateDescription = substrateDescription;
            this.numRobots = numAgents;
            this.homogenous = homogenous;
            this.multipleBrains = multi;
            this.forcedSituationalPolicyGeometry = forcedSituationalPolicyGeometry;
            // Schrum: When preference neurons are used, the number of modules in the network is the
            // more reliable source of information. Especially if Module Mutation will allow more modules
            // to be created, each creating a new brain.
            this.numBrains = genome != null && preferenceNeurons ? genome.NumOutputModules : brains;
            this.preferenceNeurons = preferenceNeurons;

            //inputCounter = 0;
            teamInput = new float[numAgents * substrateDescription.InputCount];
            activated = new bool[numAgents];

            createBrains();

            robotListeners = new List<Robot>();
        }
开发者ID:val1kus,项目名称:agent_multimodal,代码行数:29,代码来源:AgentBrain.cs


示例15: RequestQueue

 public RequestQueue(ICache cache, INetwork network, int threadPoolSize, IResponseDelivery delivery)
 {
     this.mCache = cache;
     this.mNetwork = network;
     this.mDispatchers = new NetworkDispatcher[threadPoolSize];
     this.mDelivery = delivery;
 }
开发者ID:huguodong,项目名称:Volley-For-Xamarin-Android,代码行数:7,代码来源:RequestQueue.cs


示例16: BranchReorderAction

        public BranchReorderAction(INetwork network, int oldIndex, int newIndex) : base("Reorder branch position")
        {
            Network = network;
            OldIndex = oldIndex;
            NewIndex = newIndex;

            Branch = Network.Branches[oldIndex];
        }
开发者ID:lishxi,项目名称:_SharpMap,代码行数:8,代码来源:BranchReorderAction.cs


示例17: Message

 public Message(INetwork network, ILogSource source, IUser user, string message, bool highlight)
     : base(network, source, user)
 {
     this.User = user;
     this.NicknameContinuity = user.Nickname;
     this.MessageBody = message;
     this.Highlight = highlight;
 }
开发者ID:SilentPenguin,项目名称:Skyscraper,代码行数:8,代码来源:Message.cs


示例18: AgentBrain

        /// <summary>
        /// Constructs a new AgentBrain object from the specified parameters. This brain is designed to be used as a multiagent hivemind, but can also be used to control a single agent by setting numAgents equal to 1. 
        /// </summary>
        /// <param name="homogeneous">Is the team homogeneous? Agents in a homogeneous team all have identical copies of the same brain, while those in a heterogeneous team do not, instead each contributing to one central, distributed hive brain.</param>
        /// <param name="numAgents">Set to 1 for an individual agent, or >1 for a multiagent team.</param>
        /// <param name="substrateDescription">HyperNEAT substrate</param>
        /// <param name="genome">If using NEAT, this should be the already-decoded neural network. Otherwise, if using HyperNEAT, this should be the CPPN that encodes the neural network.</param>
        /// <param name="normalizeANNWeights"></param>
        /// <param name="adaptableANN"></param>
        /// <param name="modulatoryANN"></param>
        /// <param name="multi">Multiple brains with situational policies?</param>
        /// <param name="evolveSubstrate">Set to true to enable ES-HyperNEAT.</param>
        /// <param name="useNeatBrain">If false, the system will use HyperNEAT as the EA.</param>
        /// <param name="useCTRNNs">Set to true to use continuous time recurrent neural networks.</param>
        public AgentBrain(bool homogeneous, int numAgents, SubstrateDescription substrateDescription, INetwork genome,
            bool normalizeANNWeights, bool adaptableANN, bool modulatoryANN, bool multi, bool evolveSubstrate, bool useNeatBrain, bool useCTRNNs = false)
        {
            // Set instance variables
            EvolveSubstrate = evolveSubstrate;
            NormalizeANNWeights = normalizeANNWeights;
            AdaptableANN = adaptableANN;
            ModulatoryANN = modulatoryANN;
            Genome = genome;
            SubstrateDescription = substrateDescription;
            NumRobots = numAgents;
            Homogeneous = homogeneous;
            MultipleBrains = multi;
            NeatBrain = useNeatBrain;
            UseCTRNNs = useCTRNNs;

            // Initialiaze team arrays
            TeamInput = new float[numAgents * substrateDescription.InputCount];
            TeamInputOld = new float[numAgents * substrateDescription.InputCount];
            TeamOutput = new float[numAgents * substrateDescription.OutputCount];
            TeamOutputOld = new float[numAgents * substrateDescription.OutputCount];
            TeamHidden = new float[numAgents * 5];
            TeamHiddenOld = new float[numAgents * 5];
			RobotInput = new float[substrateDescription.InputCount];
			RobotInputOld = new float[substrateDescription.InputCount];
            Activated = new bool[numAgents];

            // Initialize the agents' brains
            createBrains();
            
            // Register listeners for the robots' neural network outputs
            RobotListeners = new List<Robot>();

            if (OutputComms)
            {
                // If the robots' input and output streams have already been initialized, reset them
                if (OutputsInitialized)
                {
                    for (int j = 0; j < numAgents; j++)
                    {
                        OutStreams[j].Close();
                        InStreams[j].Close();
                        OutStreams[j] = null;
                        InStreams[j] = null;
                    }
                }

                // Initialize the robots' input and output streams
                OutStreams = new List<StreamWriter>(numAgents);
                InStreams = new List<StreamWriter>(numAgents);
                for (int j = 0; j < numAgents; j++)
                {
                    OutStreams.Add(new StreamWriter("agentO" + j + ".txt"));
                    InStreams.Add(new StreamWriter("agentI" + j + ".txt"));
                }
                OutputsInitialized = true;
            }
        }
开发者ID:zaheeroz,项目名称:qd-maze-simulator,代码行数:72,代码来源:AgentBrain.cs


示例19: Predator

 public Predator(float x, float y, float w, float h,INetwork network)
     : base(x, y, w, h, network)
 {
     radius = 200;
     sensors = new float[5];
     angledelta = (float)Math.PI / sensors.Length;
     halfangledelta = angledelta / 2.0f;
     brain = (FloatFastConcurrentNetwork)network;
 }
开发者ID:coastwise,项目名称:HyperSharpNEAT,代码行数:9,代码来源:Predator.cs


示例20: ComputeMaximumOrderForNode

        // find the branch that has the highest order for all branches connected to this node, and return its order number.
        private static int ComputeMaximumOrderForNode(INetwork network, INode node)
        {
            if (node == null)
            {
                return -1;
            }

            return network.Branches.Where(c => c.Source == node || c.Target == node).Max(d => d.OrderNumber);
        }
开发者ID:lishxi,项目名称:_SharpMap,代码行数:10,代码来源:BranchOrderHelper.cs



注:本文中的INetwork类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# INetworkManager类代码示例发布时间:2022-05-24
下一篇:
C# INestedUnitNamespaceReference类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap