// Devuelve la función que da los operadores aplicables, creándola por primera vez si no existiera public static ApplicableOperatorsFunction GetApplicableOperatorsFunction() { if (applicableOperatorsFunction == null) { applicableOperatorsFunction = new SlidingPuzzleApplicableOperatorsFunction(); } return(applicableOperatorsFunction); }
// Crea un problema partiendo de todos sus componentes public Problem(object iSetup, ApplicableOperatorsFunction aoFunction, TransitionModel tModel, GoalTest gTest, StepCostFunction scFunction) { this.InitialSetup = iSetup; this.ApplicableOperatorsFunction = aoFunction; this.TransitionModel = tModel; this.GoalTest = gTest; this.StepCostFunction = scFunction; }
// Construye un resolutor de dimensiones (rows) por (columns), como mínimo debe ser de 1x1 // No necesita el puzle en sí, pues eso lo recibirá después public SlidingPuzzleSolver(uint rows, uint columns) { if (rows == 0) { throw new ArgumentException(string.Format("{0} is not a valid rows value", rows), "rows"); } if (columns == 0) { throw new ArgumentException(string.Format("{0} is not a valid columns value", columns), "columns"); } aoFunction = SlidingPuzzleFunctionFactory.GetApplicableOperatorsFunction(); tModel = SlidingPuzzleFunctionFactory.GetTransitionModel(); gTest = new SlidingPuzzleGoalTest(rows, columns); }
// Crea un problema partiendo de todos sus componentes, menos la función de coste de paso donde se usará una por defecto public Problem(object iSetup, ApplicableOperatorsFunction aoFunction, TransitionModel tModel, GoalTest gTest) : this(iSetup, aoFunction, tModel, gTest, new DefaultStepCostFunction()) { }