コード例 #1
0
ファイル: subset.cs プロジェクト: philstopford/DesignLibs_GPL
    private static void subset_weight_test()

    //****************************************************************************80
    //
    //  Purpose:
    //
    //    SUBSET_WEIGHT_TEST tests SUBSET_WEIGHT.
    //
    //  Licensing:
    //
    //    This code is distributed under the GNU LGPL license.
    //
    //  Modified:
    //
    //    07 January 2016
    //
    //  Author:
    //
    //    John Burkardt
    //
    {
        Console.WriteLine("");
        Console.WriteLine("SUBSET_WEIGHT_TEST");
        Console.WriteLine("  SUBSET_WEIGHT returns the weight of a subset.");

        const int n    = 5;
        int       seed = 123456789;

        int[] s = Subset.subset_random(n, ref seed);
        typeMethods.i4vec_transpose_print(n, s, "  Subset S:");

        int weight = Subset.subset_weight(n, s);

        Console.WriteLine("");
        Console.WriteLine("  Weight = " + weight + "");
    }