State transition algorithm