Package com.barrybecker4.optimization.parameter.types

Examples of com.barrybecker4.optimization.parameter.types.Parameter


        for ( i = 0; i < samples.getNumValues(); i++ ) {
            int[] index = samples.getIndexFromRaw( i );
            NumericParameterArray nextSample = this.copy();

            for ( int j = 0; j < nextSample.size(); j++ ) {
                Parameter p = nextSample.get( j );
                double increment = (p.getMaxValue() - p.getMinValue()) / samplingRate;
                p.setValue(p.getMinValue() + increment / 2.0 + index[j] * increment);
            }

            globalSamples.add(nextSample);
        }
        return globalSamples;
View Full Code Here


     * @return the random nbr.
     */
     public NumericParameterArray getRandomNeighbor(double radius) {
         NumericParameterArray nbr = this.copy();
         for ( int k = 0; k < params_.length; k++ ) {
             Parameter param = nbr.get(k);
             param.tweakValue(radius, MathUtil.RANDOM);
         }

         return nbr;
     }
View Full Code Here

     * @return get a completely random solution in the parameter space.
     */
    public NumericParameterArray getRandomSample() {
         NumericParameterArray nbr = this.copy();
         for ( int k = 0; k < params_.length; k++ ) {
             Parameter newPar = nbr.get(k);
             newPar.setValue(newPar.getMinValue() + MathUtil.RANDOM.nextDouble() * newPar.getRange());
             assert (newPar.getValue() < newPar.getMaxValue() && newPar.getValue() > newPar.getMinValue()):
                     "newPar "+newPar.getValue()+" not between "+newPar.getMinValue()+" and  "+newPar.getMaxValue();
         }

         return nbr;
    }
View Full Code Here

     * Does first time initialization.
     * @param params we assume there is only two.
     */
    public void addPoint(ParameterArray params) {

        Parameter xParam = params.get(0);
        Parameter yParam = (params.size() > 1) ? params.get(1):  params.get(0);

        if (rangeX == null) {
            rangeX = new Range(xParam.getMinValue(), xParam.getMaxValue());
            rangeY = new Range(yParam.getMinValue(), yParam.getMaxValue());
        }

        rawPoints_.add(new Point2d(xParam.getValue(), yParam.getValue()));
    }
View Full Code Here

     * Does first time initialization.
     * @param params we assume there is only two.
     */
    public void addPoint(ParameterArray params) {

        Parameter xParam = params.get(0);
        Parameter yParam = params.get(1);

        if (rangeX == null) {
            rangeX = new Range(xParam.getMinValue(), xParam.getMaxValue());
            rangeY = new Range(yParam.getMinValue(), yParam.getMaxValue());
        }

        rawPoints_.add(new Point2d(xParam.getValue(), yParam.getValue()));
    }
View Full Code Here

     * Draw one of the tile paths which takes one of three forms.
     */
    public void drawPath(Graphics2D g2, int pathNumber, TilePlacement tilePlacement,
                         Point position, double size) {

        HexTile tile = tilePlacement.getTile();
        int pathStartIndex = getPathStartIndex(tile, pathNumber);

        int i = pathStartIndex + 1;

        PathColor pathColor = tile.getEdgeColor(pathStartIndex);
        while (pathColor != tile.getEdgeColor(i++)) {
            assert(i<6): "Should never exceed 6";
        }

        int pathEndIndex = i-1;
        int diff = pathEndIndex - pathStartIndex;
View Full Code Here

        this.numTiles = numTiles;
    }

    public TantrixBoard initialPosition() {
        //MathUtil.RANDOM.setSeed(1);
        return new TantrixBoard(new HexTiles().createRandomList(numTiles));
    }
View Full Code Here

    public boolean isGoal(TantrixBoard position) {
        return position.isSolved();
    }

    public TilePlacementList legalMoves(TantrixBoard position) {
        return new MoveGenerator(position).generateMoves();
    }
View Full Code Here

        HexTile tile = tilePlacement.getTile();
        int pathStartIndex = getPathStartIndex(tile, pathNumber);

        int i = pathStartIndex + 1;

        PathColor pathColor = tile.getEdgeColor(pathStartIndex);
        while (pathColor != tile.getEdgeColor(i++)) {
            assert(i<6): "Should never exceed 6";
        }

        int pathEndIndex = i-1;
View Full Code Here

     */
    private int getPathStartIndex(HexTile tile, int pathNumber) {
        Set<PathColor> set = new HashSet<PathColor>();
        int i = 0;
        do {
            PathColor c = tile.getEdgeColor(i++);
            set.add(c);
        } while (set.size() <= pathNumber);
        return i-1;
    }
View Full Code Here

TOP

Related Classes of com.barrybecker4.optimization.parameter.types.Parameter

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.