• 大小: 296KB
    文件类型: .rar
    金币: 2
    下载: 1 次
    发布日期: 2021-06-11
  • 语言: C#
  • 标签: TSP  

资源简介

c#进行了可视化编程,采用对话框的形式,能够随机生成测试数据和生成数据规模,对测试结果进行图示,显示函数曲线,并能够保存测试数据!!

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Collections;
using System.Threading;
using System.IO;

namespace Trade
{
    struct StrNode 
    {
        public int n;
        public int[] num;
        public int time;
        public int count;
        public string strLine;

    }

    struct StrPara 
    {

        public int[] num;
        public int index;
        public int n;
    
    }
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }


        int value;  //prograssBar的值
        ArrayList list = new ArrayList();  //保存strNode结构体列表

        int int_TestCount;
        int int_MinNum;
        int int_MaxNum;
        int int_ThreadCount;

      #region 生成随机数据
        private void button1_Click(object sender EventArgs e)
        {
            try
            {
                int_TestCount = Convert.ToInt32(toolStripTextBox1.Text);
                int_MinNum = Convert.ToInt32(toolStripTextBox3.Text);
                int_MaxNum = Convert.ToInt32(toolStripTextBox4.Text);
                listView1.Items.Clear();
                list.RemoveRange(0 list.Count);
                Random d = new Random(DateTime.Now.Second);

               // int n = 100;
                for (int i = 0; i < int_TestCount; i++)
                {
                    fnRandom(d);
                }

                progressBar1.Maximum = int_TestCount;
                progressBar1.Minimum = 0;
                progressBar1.Value = 0;
            }
            catch (System.Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

          //  fnShowData();
        }

        private void fnRandom(Random d )
        {
         
             int n = d.Next(int_MinNum int_MaxNum+1);
              
             int []  num = new int[n n];

            for (int i = 0; i < n; i++)
            {
                for (int j = 0; j < n; j++)
                {
                    if (i == j)
                    {
                        num[i j] = 100;
                    }
                    else if (i < j)
                    {
                        num[i j] = d.Next(1 21);
                    }
                    else
                    {
                        num[i j] = num[j i];
                    }

                }
            }
            StrNode  node = new StrNode();
            node.n = n;
            node.num = num;
            list.Add(node);


            ListViewItem item = new ListViewItem(listView1.Items.Count.ToString());
            item.SubItems.Add(n.ToString());
            item.SubItems.Add(fnNodetoString(numn));
            listView1.Items.Add(item);
        }

        private 

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件      14430  2013-05-21 15:09  Trade\Trade\bin\Debug\13-05-21.txt

     文件      13988  2013-05-21 14:07  Trade\Trade\bin\Debug\13-07-21.txt

     文件      13144  2013-05-21 14:09  Trade\Trade\bin\Debug\13-09-21.txt

     文件     113926  2013-05-21 11:38  Trade\Trade\bin\Debug\Debug.rar

     文件      27136  2013-05-24 16:14  Trade\Trade\bin\Debug\Trade.exe

     文件      42496  2013-05-24 16:14  Trade\Trade\bin\Debug\Trade.pdb

     文件      14328  2013-05-24 16:16  Trade\Trade\bin\Debug\Trade.vshost.exe

     文件        490  2009-06-11 05:14  Trade\Trade\bin\Debug\Trade.vshost.exe.manifest

     文件     303104  2007-06-02 00:02  Trade\Trade\bin\Debug\ZedGraph.dll

     文件          0  2013-05-21 14:03  Trade\Trade\bin\Debug21.txt

     文件      12546  2013-05-24 16:14  Trade\Trade\Form1.cs

     文件      27661  2013-05-24 16:13  Trade\Trade\Form1.Designer.cs

     文件       6012  2013-05-24 16:13  Trade\Trade\Form1.resx

     文件        942  2013-05-21 11:23  Trade\Trade\Form2.cs

     文件       2405  2013-05-21 11:23  Trade\Trade\Form2.Designer.cs

     文件       5814  2013-05-21 11:23  Trade\Trade\Form2.resx

     文件       1955  2013-05-21 14:17  Trade\Trade\Form3.cs

     文件       7292  2013-05-21 14:17  Trade\Trade\Form3.Designer.cs

     文件       5814  2013-05-21 14:17  Trade\Trade\Form3.resx

     文件       5188  2013-05-22 11:18  Trade\Trade\obj\Debug\ResolveAssemblyReference.cache

     文件        608  2013-05-24 16:16  Trade\Trade\obj\Debug\Trade.csproj.FileListAbsolute.txt

     文件        963  2013-05-24 16:13  Trade\Trade\obj\Debug\Trade.csproj.GenerateResource.Cache

     文件      27136  2013-05-24 16:14  Trade\Trade\obj\Debug\Trade.exe

     文件        180  2013-05-24 16:13  Trade\Trade\obj\Debug\Trade.Form1.resources

     文件        180  2013-05-21 14:00  Trade\Trade\obj\Debug\Trade.Form2.resources

     文件        180  2013-05-21 14:17  Trade\Trade\obj\Debug\Trade.Form3.resources

     文件      42496  2013-05-24 16:14  Trade\Trade\obj\Debug\Trade.pdb

     文件        180  2013-05-21 14:00  Trade\Trade\obj\Debug\Trade.Properties.Resources.resources

     文件        486  2013-05-20 14:32  Trade\Trade\Program.cs

     文件       1342  2013-05-20 14:32  Trade\Trade\Properties\AssemblyInfo.cs

............此处省略19个文件信息

评论

共有 条评论