Executes all local searches in the pipeline, where the best solution of the previous search is used as initial
solution for the next search. When the entire pipeline has been executed, the search step is complete and the
search terminates.
974682
@Override
    protected void searchStep() {
        // execute pipeline
        pipeline.stream().forEachOrdered(l -> {
            // attach listener
            l.addSearchListener(pipelineListener);
            // set initial solution (copy!)
            l.setCurrentSolution(Solution.checkedCopy(getCurrentSolution()));
            // run local search
            l.start();
            // get best solution found by search l
            SolutionType bestSol = l.getBestSolution();
            Evaluation bestSolEvaluation = l.getBestSolutionEvaluation();
            Validation bestSolValidation = l.getBestSolutionValidation();
            // if not null and different from current solution (i.e. improved):
            // update current and best solution accordingly
            if(bestSol != null && !bestSol.equals(getCurrentSolution())){
                updateCurrentAndBestSolution(bestSol, bestSolEvaluation, bestSolValidation);
            }
            // remove listener
            l.removeSearchListener(pipelineListener);
        });
        // pipeline complete: stop search
        stop();
    }
21638
@Override
    protected void searchStep() {
        // get random move
        Move<? super SolutionType> move = getNeighbourhood().getRandomMove(getCurrentSolution(), getRandom());
        // got move ?
        if(move != null){
            // accept if improvement
            if(isImprovement(move)){
                // accept move
                accept(move);
            } else {
                // no improvement
                reject(move);
            }
        } else {
            // no move/neighbour reported by neighbourhood
            stop();
        }
    }
1044228
def _local_search(problem, fringe_expander, iterations_limit=0, fringe_size=1,
                  random_initial_states=False, stop_when_no_better=True,
                  viewer=None):
    '''
    
    '''
    if viewer:
        viewer.event('started')

    fringe = BoundedPriorityQueue(fringe_size)
    if random_initial_states:
        for _ in range(fringe_size):
            s = problem.generate_random_state()
            fringe.append(SearchNodeValueOrdered(state=s, problem=problem))
    else:
        fringe.append(SearchNodeValueOrdered(state=problem.initial_state,
                                             problem=problem))

    finish_reason = ''
    iteration = 0
    run = True
    best = None

    while run:
        if viewer:
            viewer.event('new_iteration', list(fringe))

        old_best = fringe[0]
        fringe_expander(fringe, iteration, viewer)
        best = fringe[0]

        iteration += 1

        if iterations_limit and iteration >= iterations_limit:
            run = False
            finish_reason = 'reaching iteration limit'
        elif old_best.value >= best.value and stop_when_no_better:
            run = False
            finish_reason = 'not being able to improve solution'

    if viewer:
        viewer.event('finished', fringe, best, 'returned after %s' % finish_reason)

    return best
526661
private void afterBatch(BatchBackend backend) {
		IndexedTypeSet targetedTypes = searchFactoryImplementor.getIndexedTypesPolymorphic( rootIndexedTypes );
		if ( this.optimizeAtEnd ) {
			backend.optimize( targetedTypes );
		}
		backend.flush( targetedTypes );
	}
585663
public function execute()
    {
        // step 1 - 5
        $this->startStemmingProcess();

        // step 6
        if ($this->dictionary->contains($this->getCurrentWord())) {
            $this->result = $this->getCurrentWord();
        } else {
            $this->result = $this->originalWord;
        }
    }
991664
@Override
    public void execute() {
        try {
            String str = editor.readLine("Find:");
            editor.findNext(str);
            FindContext.setLastSearch(str);
        } catch (IOException e) {
            //noop
        }
    }
398572
def execute(self):
        
        self._state_machine.transition_to_execute()
        for action in self._actions:
            self._executed_actions.append(action)
            self.execute_with_retries(action, lambda a: a.execute())
        self._state_machine.transition_to_execute_complete()
1152994
@Override
    public void run() {
        synchronized (this) {
            // Save current event pipeline and currently handled event
            // because a SynchronousEventPipeline can be called while
            // handling an event (from another event processor).
            InternalEventPipeline currentPipeline = FeedBackPipelineFilter
                .getAssociatedPipeline();
            EventBase<?> currentEvent = newEventsParent.get();
            try {
                super.run();
            } finally {
                newEventsParent.set(currentEvent);
                FeedBackPipelineFilter.setAssociatedPipeline(currentPipeline);
            }
        }
    }
1043553
private void complete() {
		if (stopped) {
			return;
		}

		log.info("Spidering process is complete. Shutting down...");
		this.stopped = true;
		if (httpSender != null) {
			this.getHttpSender().shutdown();
			httpSender = null;
		}

		// Notify the controller to clean up memory
		controller.reset();

		// Issue the shutdown command on a separate thread, as the current thread is most likely one
		// from the pool
		new Thread(new Runnable() {
			@Override
			public void run() {
				if (threadPool != null) {
					threadPool.shutdown();
				}
				// Notify the listeners -- in the meanwhile
				notifyListenersSpiderComplete(true);
				controller.reset();
				threadPool = null;
			}
		}, "ZAP-SpiderShutdownThread-" + id).start();
	}
1040159
def complete(self):
        
        # Boolean to store the completeness of the analyses
        allcomplete = True
        # Clear the list of samples that still require more sequence data
        self.incomplete = list()
        for sample in self.runmetadata.samples:
            if sample.general.bestassemblyfile != 'NA':
                try:
                    # If the sample has been tagged as incomplete, only add it to the complete metadata list if the
                    # pipeline is on its final iteration
                    if sample.general.incomplete:
                        if self.final:
                            self.completemetadata.append(sample)
                        else:
                            sample.general.complete = False
                            allcomplete = False
                            self.incomplete.append(sample.name)
                except AttributeError:
                    sample.general.complete = True
                    self.completemetadata.append(sample)
            else:
                if self.final:
                    self.completemetadata.append(sample)
                else:
                    sample.general.complete = False
                    allcomplete = False
                    self.incomplete.append(sample.name)
        # If all the samples are complete, set the global variable for run completeness to True
        if allcomplete:
            self.analysescomplete = True
869608
private boolean performLineSearch() {
		// if true then it can't iterate any more
		if( lineSearch.iterate() ) {
			// see if the line search failed
			if( !lineSearch.isConverged() ) {
				if( firstStep ) {
					// if it failed on the very first step then it might have been too large
					// try halving the step size
					initialStep /= 2;
					if( initialStep != 0 ) {
						invokeLineInitialize(fx, maxStep);
						return false;
					} else {
						if( verbose != null && verboseLevel != 0 ) {
							verbose.println("Initial step reduced to zero");
						}
						return terminateSearch(false);
					}
				} else {
					return terminateSearch(false);
				}
			} else {
				firstStep = false;
			}

			// update variables
			double step = lineSearch.getStep();

			// save the new x
			System.arraycopy(function.getCurrentState(),0,x.data,0,N);
			// compute the change in the x
			for( int i = 0; i < N; i++ )
				s.data[i] = step * searchVector.data[i];
			updated = true;

			// convergence tests
			// function value at end of line search
			double fstp = lineSearch.getFunction();

			if( verbose != null ) {
				double actualStep = NormOps_DDRM.fastNormF(s);
				double ftest_val = Math.abs(fstp-fx)/Math.abs(fx);
				double gtest_val = Math.abs(derivAtZero);

				verbose.printf("%-4d  %9.3E  %10.3E  %9.3E  %9.3E  %9.3E  %6.3f\n",
						iterations, fstp, fstp - fx,actualStep,ftest_val,gtest_val, maxStep);
			}

			// see if the actual different and predicted differences are smaller than the
			// error tolerance
			if( Math.abs(fstp-fx) <= ftol*Math.abs(fx) || Math.abs(derivAtZero) < gtol ) {
				if( verbose != null ) {
					verbose.println("converged after line search.");
				}
				return terminateSearch(true);
			}

			if( fstp > fx ) {
				throw new RuntimeException("Bug! Worse results!");
			}

			// current function value is now the previous
			fx = fstp;

			// start the loop again
			mode = 0;
		}
		return false;
	}
739370
private void cancelSearch()
  {
    // don't spin forever when canceled
    searchView.getControlPanel().getQueryPanel().setCountIndicatorEnabled(false);

    Map<QueryUIState.QueryType, Future<?>> exec = state.getExecutedTasks();
    // abort last tasks if running
    if (exec.containsKey(QueryUIState.QueryType.COUNT)
      && !exec.get(QueryUIState.QueryType.COUNT).isDone())
    {
      exec.get(QueryUIState.QueryType.COUNT).cancel(true);
    }
    if (exec.containsKey(QueryUIState.QueryType.FIND)
      && !exec.get(QueryUIState.QueryType.FIND).isDone())
    {
      exec.get(QueryUIState.QueryType.FIND).cancel(true);
    }

    exec.remove(QueryUIState.QueryType.COUNT);
    exec.remove(QueryUIState.QueryType.FIND);

  }
396588
void complete()
    {
        _file=_stack[_top].getFileName()+":"+_stack[_top].getLineNumber();
        _method=_stack[_top].getClassName()+"."+_stack[_top].getMethodName();
        _depth=_stack.length-_top;
        _thread = Thread.currentThread().getName();
    }
116208
public void finish() throws IOException {
		boolean success = false;

		try {
			checkInProduceState();

			for (ResultSubpartition subpartition : subpartitions) {
				subpartition.finish();
			}

			success = true;
		}
		finally {
			if (success) {
				isFinished = true;

				notifyPipelinedConsumers();
			}
		}
	}
487617
def transition_to_execute_complete(self):
        """"""
        assert self.state in [AQStateMachineStates.execute]
        self.state = AQStateMachineStates.execute_complete
1209077
public function execute() {
        $areaid = $this->get_custom_data();

        try {
            \core_search\manager::clean_up_non_existing_area($areaid);
        } catch (\core_search\engine_exception $e) {
            mtrace('Search is not configured. Skip deleting index for search area ' . $areaid);
        }
    }
437615
public void step() throws IOException {
        if (closed) {
            throw new ClosedChannelException();
        }
        if (input.position() == header.length) {
            if (command == null) {
                command = CommandFactory.create(input);
            }

            if (command.complete()) {
                command.process();
                protocolHandler.execute(command, this);
                command = null;
                input.rewind();
            }
        }
    }