Maximum number of generations to process * @genomes Number of genomes per generation * * @return nn New NeuralNetwork * */ public static function create($generations=null, $genomes=null){ /* Propagate instance creation */ return new NeuralNetworkCore($generations, $genomes); } /* LOADS A NEURAL NETWORK FROM STORAGE * * @storage Path to storage * * @return nn Loaded NeuralNetwork * */ public static function load($storage=null){ /* (1) Checks argument */ if( is_null($storage=NeuralNetworkCore::getStorage($storage)) ) throw new \Exception('Wrong NeuralNetwork loader\'s argument.'); /* (2) If files doesn't exist, raise error */ if( !$storage['nn']['exists'] ) throw new \Exception('Loaded storage have file(s) missing.'); /* (3) Unserialize last NeuralNetwork */ $last_network = FileManager::read($storage['nn']['filename']); /* (4) Creates and fill instance */ $instance = new NeuralNetworkCore(0, 0); $instance->unserialize($last_network); /* (5) Returns instance */ return $instance; } } ?>