Package main

Examples of main.Algorithm


     * Inicia la solucion del diseño
     * Prepara los parametros necesarios y los introduce al algoritmo para obtener una solucion.    
     */
    public boolean solveProblem(Stack<AuxiliarElement> futureObjects){
        Stack<AuxiliarElement> auxiliar;
        Algorithm alg;
        Solution sol;       
        int ret;
        auxiliar = (Stack)futureObjects.clone();
        if((x*y) < (areaOc*2)/3){           
            return false;
        }
        alg = new Algorithm();
        sol = new Solution(x, y, auxiliar);
        sol.setIdRoom(idRoom);
        int ndoors = 0;
        for(int i = 0; i < posDoor.length; i++){
            if(posDoor[i][0]==0){
                sol.placeDoor(posDoor[i][1]+20, 0, 50, 50, auxiliar.size()+(i+1));
            }else if(posDoor[i][1]==0){
                int stride = posDoor[i][0]+50;
                sol.placeDoor(stride, 3, 50, 50, auxiliar.size()+(i+1));
            }else if((posDoor[i][1]+50)==y){
                sol.placeDoor(posDoor[i][0]+20, 1, 50, 50, auxiliar.size()+(i+1));
            }else if((posDoor[i][0]+50)==x){
                int stride = posDoor[i][1]+50;
                sol.placeDoor(stride+20, 2, 50, 50, auxiliar.size()+(i+1));
            }
            ndoors = (i+1);
        }
        for(int i = 0; i < posWindow.length; i++){
            if(posWindow[i][0]==0){
                sol.placeWindow(posWindow[i][1], 0, 50, 50, auxiliar.size()+(i+ndoors+1));
            }else if(posWindow[i][1]==0){
                int stride = posWindow[i][0]+50;
                sol.placeWindow(stride, 3, 50, 50, auxiliar.size()+(i+ndoors+1));
            }else if((posWindow[i][1]+50)==y){
                sol.placeWindow(posWindow[i][0], 1, 50, 50, auxiliar.size()+(i+ndoors+1));
            }else if((posWindow[i][0]+50)==x){
                int stride = posWindow[i][1]+50;
                sol.placeWindow(stride, 2, 50, 50, auxiliar.size()+(i+ndoors+1));
            }
        }
        ret = alg.forwardCheck(futureObjects, sol,this.configurationController.getCjtRestrictionsController());
        futureObjects = (Stack)auxiliar.clone();       
        if (ret == 0){           
            alg.backtracking(futureObjects, sol, this.configurationController.getCjtRestrictionsController());
        }       
        actualElements = (Stack)auxiliar.clone();        
       
        return !sol.isFail();
    }
View Full Code Here

TOP

Related Classes of main.Algorithm

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.