private static void subsetsumswap_test()

    //****************************************************************************80
    //
    //  Purpose:
    //
    //    SUBSETSUMSWAP_TEST tests SUBSETSUM_SWAP.
    //
    //  Licensing:
    //
    //    This code is distributed under the GNU LGPL license.
    //
    //  Modified:
    //
    //    27 July 2011
    //
    //  Author:
    //
    //    John Burkardt
    //
    {
        const int N = 7;

        int[] a =
        {
            12, 8, 11, 30, 8, 3, 7
        }

        ;
        int i;

        int[]     index       = new int[N];
        const int sum_desired = 17;

        Console.WriteLine("");
        Console.WriteLine("SUBSETSUMSWAP_TEST");
        Console.WriteLine("  SUBSETSUM_SWAP seeks a solution of the subset");
        Console.WriteLine("  sum problem using pair swapping.");
        Console.WriteLine("");
        Console.WriteLine("  The desired sum is " + sum_desired + "");

        int sum_achieved = Subset.subsetsum_swap(N, ref a, sum_desired, ref index);

        Console.WriteLine("");
        Console.WriteLine("    A(I), INDEX(I)");
        Console.WriteLine("");

        for (i = 0; i < N; i++)
        {
            Console.WriteLine("  " + a[i].ToString().PadLeft(5)
                              + "  " + index[i].ToString().PadLeft(5) + "");
        }

        Console.WriteLine("");
        Console.WriteLine("  The achieved sum is " + sum_achieved + "");
    }