Package org.uncommons.maths.random

Examples of org.uncommons.maths.random.Probability


      selectionLabel = new JLabel("Selection Strategy: ");
      innerPanel.add(selectionLabel);
     
      SelectionStrategy<?>[] selectionStrategies = {new RankSelection(), new RouletteWheelSelection(),
                                                    new StochasticUniversalSampling(),
                                                    new TournamentSelection(new Probability(0.95)),
                                                    new TruncationSelection(0.5)};
     
      selectionCombo = new JComboBox(selectionStrategies);
      selectionCombo.setRenderer(new DefaultListCellRenderer() {
        @Override
View Full Code Here


      selectionLabel = new JLabel("Selection Strategy: ");
      innerPanel.add(selectionLabel);
     
      SelectionStrategy<?>[] selectionStrategies = {new RankSelection(), new RouletteWheelSelection(),
                                                    new StochasticUniversalSampling(),
                                                    new TournamentSelection(new Probability(0.95)),
                                                    new TruncationSelection(0.5)};
     
      selectionCombo = new JComboBox(selectionStrategies);
      selectionCombo.setRenderer(new DefaultListCellRenderer() {
        @Override
View Full Code Here

      selectionLabel = new JLabel("Selection Strategy: ");
      innerPanel.add(selectionLabel);

      SelectionStrategy<?>[] selectionStrategies = {
          new RankSelection(), new RouletteWheelSelection(),
          new StochasticUniversalSampling(), new TournamentSelection(new Probability(0.95)),
          new TruncationSelection(0.5)};

      selectionCombo = new JComboBox(selectionStrategies);
      selectionCombo.setRenderer(new DefaultListCellRenderer() {
        @Override
View Full Code Here

    public static Node evolveProgram(Map<double[], Double> data)
    {
        TreeFactory factory = new TreeFactory(2, // Number of parameters passed into each program.
                                              4, // Maximum depth of generated trees.
                                              Probability.EVENS, // Probability that a node is a function node.
                                              new Probability(0.6d)); // Probability that other nodes are params rather than constants.
        List<EvolutionaryOperator<Node>> operators = new ArrayList<EvolutionaryOperator<Node>>(3);
        operators.add(new TreeMutation(factory, new Probability(0.4d)));
        operators.add(new TreeCrossover());
        operators.add(new Simplification());
        TreeEvaluator evaluator = new TreeEvaluator(data);
        EvolutionEngine<Node> engine = new GenerationalEvolutionEngine<Node>(factory,
                                                                             new EvolutionPipeline<Node>(operators),
View Full Code Here

        return new SwingBackgroundTask<Biomorph>()
        {
            @Override
            protected Biomorph performTask()
            {
                EvolutionaryOperator<Biomorph> mutation = random ? new RandomBiomorphMutation(new Probability(0.12d))
                                                                 : new DawkinsBiomorphMutation();
                InteractiveSelection<Biomorph> selection = new InteractiveSelection<Biomorph>(console,
                                                                                              renderer,
                                                                                              populationSize,
                                                                                              1);
View Full Code Here

   
    @Test
    public void testDefaultValue()
    {
        Probability defaultValue = new Probability(0.75d);
        ProbabilityParameterControl control = new ProbabilityParameterControl(defaultValue);
        assert control.getNumberGenerator().nextValue().equals(defaultValue) : "Wrong initial value.";
    }
View Full Code Here

    public void testDefaultValueTooLow()
    {
        new ProbabilityParameterControl(Probability.EVENS,
                                        Probability.ONE,
                                        2,
                                        new Probability(0.45d)); // Should throw an IllegalArgumentException.
    }
View Full Code Here

    public void testDefaultValueTooHigh()
    {
        new ProbabilityParameterControl(Probability.ZERO,
                                        Probability.EVENS,
                                        2,
                                        new Probability(0.55d)); // Should throw an IllegalArgumentException.
    }
View Full Code Here

     * Minimum must be less than maximum.
     */
    @Test(expectedExceptions = IllegalArgumentException.class)
    public void testMinimumHigherThanMaximum()
    {
        new ProbabilityParameterControl(new Probability(0.7d),
                                        new Probability(0.6d),
                                        2,
                                        new Probability(0.7d)); // Should throw an IllegalArgumentException.
    }
View Full Code Here

    @Test(dependsOnMethods = "testDefaultValue",
          groups = "display-required")
    public void testSlider()
    {
        Probability defaultValue = new Probability(0.75d);
        ProbabilityParameterControl control = new ProbabilityParameterControl(defaultValue);

        JFrame frame = new JFrame();
        frame.add(control.getControl(), BorderLayout.CENTER);
        FrameFixture frameFixture = new FrameFixture(robot, frame);
View Full Code Here

TOP

Related Classes of org.uncommons.maths.random.Probability

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.