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 Error('Wrong NeuralNetwork loader\'s argument.'); /* (2) If files doesn't exist, raise error */ if( !$storage[0]['exists'] || !$storage[1]['exists'] || !$storage[2]['exists'] ) throw new Error('Loaded storage have file(s) missing.'); /* (3) Unserialize last NeuralNetwork */ $last_network = FileManager::read($storage[0]['filename']); /* (4) Creates and fill instance */ $instance = new NeuralNetworkCore(0, 0); $instance->unserialize($last_network); /* (5) Returns instance */ return $instance; } } ?>