def run_tests(self):
        is_input_consistent_str = 'consistent'
        if not self.is_input_consistent:
            is_input_consistent_str = 'in' + is_input_consistent_str

        print 'Start testing for %s input...\n' % is_input_consistent_str

        for dimension in self.dimensions:
            random_no_points_per_axis = np.random.randint(2, 12,
                                                          dimension).tolist()
            no_points_per_axis = ' '.join(
                [str(no) for no in random_no_points_per_axis])
            no_points_per_axis_display = ', '.join(
                [str(no) for no in random_no_points_per_axis])

            print '    Testing for dimension %d with [%s] points on axis...' % \
                (dimension, no_points_per_axis_display)

            for epsilon in self.epsilons:
                print '        Testing for epsilon: ', epsilon
                for from_poly in [True, False]:
                    input_gen = InputGenerator(PATH_TO_FILE,
                                               self.is_input_consistent,
                                               dimension,
                                               no_points_per_axis,
                                               rand_points_axis=True,
                                               from_poly=from_poly,
                                               eps=epsilon)
                    input_gen.generate_test_file()

                    # Silence the print statements to stdout.
                    with Utils.nostdout():
                        cons = Consistency(PATH_TO_FILE, input_gen, False,
                                           False, True)
                        result = cons.solve_LP_problem()

                    if result is not self.is_input_consistent:
                        raise RuntimeError(
                            'Counterexample found, aborting. See the file %s '
                            'for details.' % PATH_TO_FILE)

        print '\n...Finished testing. No counterexamples found.\n'
def main():
    (options, args) = command_line_arguments()
    validate_options(options)
    input_generator = None

    if options.gen_cons_input or options.gen_incons_input:
        input_generator = InputGenerator(options.input_file,
                                         options.gen_cons_input is not None,
                                         options.dimension,
                                         options.no_points_per_axis,
                                         options.rand_points_axis,
                                         options.from_poly, options.epsilon)
        input_generator.generate_test_file()

    cons = Consistency(options.input_file, input_generator,
                       options.plot_surfaces, options.plot_rand_heights,
                       options.verbose)

    # Run the LP algorithm to decide consistency.
    cons.solve_LP_problem()
def main():
    (options, args) = command_line_arguments()
    validate_options(options)
    input_generator = None

    if options.gen_cons_input or options.gen_incons_input:
        input_generator = InputGenerator(options.input_file,
                                         options.gen_cons_input is not None,
                                         options.dimension,
                                         options.no_points_per_axis,
                                         options.rand_points_axis,
                                         options.from_poly,
                                         options.epsilon)
        input_generator.generate_test_file()

    cons = Consistency(options.input_file,
                       input_generator,
                       options.plot_surfaces,
                       options.plot_rand_heights,
                       options.verbose)

    # Run the LP algorithm to decide consistency.
    cons.solve_LP_problem()
    def run_tests(self):
        is_input_consistent_str = 'consistent'
        if not self.is_input_consistent:
            is_input_consistent_str = 'in' + is_input_consistent_str

        print 'Start testing for %s input...\n' % is_input_consistent_str

        for dimension in self.dimensions:
            random_no_points_per_axis = np.random.randint(2, 12, dimension).tolist()
            no_points_per_axis = ' '.join([str(no) for no in random_no_points_per_axis])
            no_points_per_axis_display = ', '.join([str(no) for no in random_no_points_per_axis])

            print '    Testing for dimension %d with [%s] points on axis...' % \
                (dimension, no_points_per_axis_display)

            for epsilon in self.epsilons:
                print '        Testing for epsilon: ', epsilon
                for from_poly in [True, False]:
                    input_gen = InputGenerator(PATH_TO_FILE,
                                               self.is_input_consistent,
                                               dimension,
                                               no_points_per_axis,
                                               rand_points_axis=True,
                                               from_poly=from_poly,
                                               eps=epsilon)
                    input_gen.generate_test_file()

                    # Silence the print statements to stdout.
                    with Utils.nostdout():
                        cons = Consistency(PATH_TO_FILE, input_gen, False, False, True)
                        result = cons.solve_LP_problem()

                    if result is not self.is_input_consistent:
                        raise RuntimeError('Counterexample found, aborting. See the file %s '
                                           'for details.' % PATH_TO_FILE)

        print '\n...Finished testing. No counterexamples found.\n'