Run one pass of optimisation on the circuit and route for the given backend.

        :param dag: The circuit to optimise and route

        :return: The modified circuit
424508
def run(self, dag:DAGCircuit) -> DAGCircuit:
        

        circ = dagcircuit_to_tk(dag, _DROP_CONDS=self.DROP_CONDS,_BOX_UNKNOWN=self.BOX_UNKNOWN)
        circ, circlay = self.process_circ(circ)
        newdag = tk_to_dagcircuit(circ)
        newdag.name = dag.name 
        finlay = dict()
        for i, qi in enumerate(circlay):
            finlay[('q', i)] = ('q', qi)
        newdag.final_layout = finlay
        return newdag
742131
def run(*args)
      optparse(*args)

      options = {
        :env => :production,
        :host => @host,
        :port => @port
      }

      options.merge!(:server => @handler) if @handler

      App.run!(options)
    end
362606
def run_opt(self, popsize, numgen, processors,
                plot=False, log=False, **kwargs):
        
        self._params['popsize'] = popsize
        self._params['numgen'] = numgen
        self._params['processors'] = processors
        self._params['plot'] = plot
        self._params['log'] = log
        # allows us to pass in additional arguments e.g. neighbours
        self._params.update(**kwargs)
        self.halloffame = tools.HallOfFame(1)
        self.stats = tools.Statistics(lambda thing: thing.fitness.values)
        self.stats.register("avg", numpy.mean)
        self.stats.register("std", numpy.std)
        self.stats.register("min", numpy.min)
        self.stats.register("max", numpy.max)
        self.logbook = tools.Logbook()
        self.logbook.header = ["gen", "evals"] + self.stats.fields
        self._params['model_count'] = 0
        start_time = datetime.datetime.now()
        self.initialize_pop()
        for g in range(self._params['numgen']):
            self.update_pop()
            self.halloffame.update(self.population)
            self.logbook.record(gen=g, evals=self._params['evals'],
                                **self.stats.compile(self.population))
            print(self.logbook.stream)
        end_time = datetime.datetime.now()
        time_taken = end_time - start_time
        self._params['time_taken'] = time_taken
        print("Evaluated {0} models in total".format(
            self._params['model_count']))
        print("Best fitness is {0}".format(self.halloffame[0].fitness))
        print("Best parameters are {0}".format(self.parse_individual(
            self.halloffame[0])))
        for i, entry in enumerate(self.halloffame[0]):
            if entry > 0.95:
                print(
                    "Warning! Parameter {0} is at or near maximum allowed "
                    "value\n".format(i + 1))
            elif entry < -0.95:
                print(
                    "Warning! Parameter {0} is at or near minimum allowed "
                    "value\n".format(i + 1))
        if self._params['log']:
            self.log_results()
        if self._params['plot']:
            print('----Minimisation plot:')
            plt.figure(figsize=(5, 5))
            plt.plot(range(len(self.logbook.select('min'))),
                     self.logbook.select('min'))
            plt.xlabel('Iteration', fontsize=20)
            plt.ylabel('Score', fontsize=20)
506843
def _run(self) -> dict:
        
        if not self._quantum_instance.is_statevector:
            raise AquaError("Can only calculate state for QSE with statevector backends")
        ret = self._quantum_instance.execute(self.opt_circuit)
        self.ret = ret
        self._eval_count = 0
        self._solve()
        self._ret['eval_count'] = self._eval_count
        self._ret['eval_time'] = self._eval_time
        return self._ret
265097
def _run_parallel_process(self, start_path, stop_path, queue):
        
        process_num = int(current_process().name.split('-', 2)[1])
        self._run_process(start_path, stop_path, process_num)
        queue.put(self.consumer.put())
1095214
def run(self):
        
        logger.debug("Starting execution of {0}{1}".format(self, " (backwards)" if self.backward_execution else ""))
        self.setup_run()

        # data to be accessed by the decider state
        child_errors = {}
        final_outcomes_dict = {}
        decider_state = self.states[UNIQUE_DECIDER_STATE_ID]

        try:
            concurrency_history_item = self.setup_forward_or_backward_execution()
            self.start_child_states(concurrency_history_item, decider_state)

            # print("bcs1")

            #######################################################
            # wait for all child threads to finish
            #######################################################
            for history_index, state in enumerate(self.states.values()):
                # skip the decider state
                if state is not decider_state:
                    self.join_state(state, history_index, concurrency_history_item)
                    self.add_state_execution_output_to_scoped_data(state.output_data, state)
                    self.update_scoped_variables_with_output_dictionary(state.output_data, state)
                    # save the errors of the child state executions for the decider state
                    if 'error' in state.output_data:
                        child_errors[state.state_id] = (state.name, state.output_data['error'])
                    final_outcomes_dict[state.state_id] = (state.name, state.final_outcome)

            # print("bcs2")

            #######################################################
            # handle backward execution case
            #######################################################
            if self.backward_execution:
                # print("bcs2.1.")
                return self.finalize_backward_execution()
            else:
                # print("bcs2.2.")
                self.backward_execution = False

            # print("bcs3")

            #######################################################
            # execute decider state
            #######################################################
            decider_state_error = self.run_decider_state(decider_state, child_errors, final_outcomes_dict)

            # print("bcs4")

            #######################################################
            # handle no transition
            #######################################################
            transition = self.get_transition_for_outcome(decider_state, decider_state.final_outcome)
            if transition is None:
                # final outcome is set here
                transition = self.handle_no_transition(decider_state)
            # if the transition is still None, then the child_state was preempted or aborted, in this case return
            decider_state.state_execution_status = StateExecutionStatus.INACTIVE

            # print("bcs5")

            if transition is None:
                self.output_data["error"] = RuntimeError("state aborted")
            else:
                if decider_state_error:
                    self.output_data["error"] = decider_state_error
                self.final_outcome = self.outcomes[transition.to_outcome]

            # print("bcs6")

            return self.finalize_concurrency_state(self.final_outcome)

        except Exception as e:
            logger.error("{0} had an internal error: {1}\n{2}".format(self, str(e), str(traceback.format_exc())))
            self.output_data["error"] = e
            self.state_execution_status = StateExecutionStatus.WAIT_FOR_NEXT_STATE
            return self.finalize(Outcome(-1, "aborted"))
1056530
def run(self):
        '''
        
        '''
        self.utils = salt.loader.utils(self.opts, proxy=self.proxy)
        if salt.utils.platform.is_windows():
            # Calculate function references since they can't be pickled.
            if self.opts['__role'] == 'master':
                self.runners = salt.loader.runner(self.opts, utils=self.utils)
            else:
                self.runners = []
            self.funcs = salt.loader.minion_mods(self.opts, utils=self.utils, proxy=self.proxy)

        self.engine = salt.loader.engines(self.opts,
                                          self.funcs,
                                          self.runners,
                                          self.utils,
                                          proxy=self.proxy)
        kwargs = self.config or {}
        try:
            self.engine[self.fun](**kwargs)
        except Exception as exc:
            log.critical(
                'Engine \'%s\' could not be started!',
                self.fun.split('.')[0], exc_info=True
            )
1260872
def set_goal(self, x: int, y: int) -> None:
        
        lib.TCOD_dijkstra_compute(self._path_c, x, y)
1002646
def write_concrete_dag(self):
    
    if not self.__dag_file_path:
      raise CondorDAGError, "No path for DAG file"
    try:
      dagfile = open( self.__dag_file_path, 'w' )
    except:
      raise CondorDAGError, "Cannot open file " + self.__dag_file_path
    for node in self.__nodes:
      node.write_job(dagfile)
      node.write_vars(dagfile)
      if node.get_category():
        node.write_category(dagfile)
      if node.get_priority():
        node.write_priority(dagfile)
      node.write_pre_script(dagfile)
      node.write_post_script(dagfile)
      node.write_input_files(dagfile)
      node.write_output_files(dagfile)
    for node in self.__nodes:
      node.write_parents(dagfile)
    for category in self.__maxjobs_categories:
      self.write_maxjobs(dagfile, category)
    dagfile.close()
348529
def run(configobj=None):
    
    acscteforwardmodel(configobj['input'],
                       exec_path=configobj['exec_path'],
                       time_stamps=configobj['time_stamps'],
                       verbose=configobj['verbose'],
                       quiet=configobj['quiet'],
                       single_core=configobj['single_core']
                       )
154684
def _rank_optimize(self):
        
        assert self.dag
        for l in reversed(self.layers):
            for v in l:
                gv = self.grx[v]
                for x in v.N(-1):
                   if all((self.grx[y].rank>=gv.rank for y in x.N(+1))):
                        gx = self.grx[x]
                        self.layers[gx.rank].remove(x)
                        gx.rank = gv.rank-1
                        self.layers[gv.rank-1].append(x)
525140
function Gateway(opts) {

    this.controllers = []; // Hold controller objectHandler by device name
    this.activeClients = []; // Hold all active clients sort by uid

    // Add DebugTool to log messages
    this.uid  = "Gateway:" + opts.name;
    this.debug =  opts.debug;   
    
    // simple counter for job queue
    this.request = 1;
    
    // Database backend and user event handler are shared amont all servers
    this.event = new EventEmitter();
    this.opts     = opts;
    
    // Compute some opts and provide some defaults
    this.opts.name       = opts.name         || "Gateway-Track";
    this.opts.debug      = opts.debug        || 1;      // default 1
    this.opts.backend    = opts.backend      || "file"; // file-backend.js
    this.opts.inactivity = opts.inactivity   || 600;    // default 10mn
      
    // Call constructor
    this.Gateway (opts);
}
667184
def build(self) -> Dict[str, Union[str, DAG]]:
        
        dag_params: Dict[str, Any] = self.get_dag_params()
        dag: DAG = DAG(
            dag_id=dag_params["dag_id"],
            schedule_interval=dag_params["schedule_interval"],
            description=dag_params.get("description", ""),
            max_active_runs=dag_params.get(
                "max_active_runs",
                configuration.conf.getint("core", "max_active_runs_per_dag"),
            ),
            default_args=dag_params.get("default_args", {}),
        )
        tasks: Dict[str, Dict[str, Any]] = dag_params["tasks"]

        # create dictionary to track tasks and set dependencies
        tasks_dict: Dict[str, BaseOperator] = {}
        for task_name, task_conf in tasks.items():
            task_conf["task_id"]: str = task_name
            operator: str = task_conf["operator"]
            task_conf["dag"]: DAG = dag
            params: Dict[str, Any] = {k: v for k, v in task_conf.items() if k not in SYSTEM_PARAMS}
            task: BaseOperator = DagBuilder.make_task(operator=operator, task_params=params)
            tasks_dict[task.task_id]: BaseOperator = task

        # set task dependencies after creating tasks
        for task_name, task_conf in tasks.items():
            if task_conf.get("dependencies"):
                source_task: BaseOperator = tasks_dict[task_name]
                for dep in task_conf["dependencies"]:
                    dep_task: BaseOperator = tasks_dict[dep]
                    source_task.set_upstream(dep_task)

        return {"dag_id": dag_params["dag_id"], "dag": dag}
276634
def run(self):
        
        delay = None
        router = self.siteRouter
        for qmsg in self.store.query(_QueuedMessage,
                                     sort=_QueuedMessage.storeID.ascending):
            try:
                self._verifySender(qmsg.sender)
            except:
                self.routeAnswer(qmsg.sender, qmsg.target,
                                 Value(DELIVERY_ERROR, ERROR_BAD_SENDER),
                                 qmsg.messageID)
                log.err(Failure(),
                        "Could not verify sender for sending message.")
            else:
                router.routeMessage(qmsg.sender, qmsg.target,
                                    qmsg.value, qmsg.messageID)

        for answer in self.store.query(_AlreadyAnswered,
                                       sort=_AlreadyAnswered.storeID.ascending):
            self._deliverAnswer(answer)
        nextmsg = self.store.findFirst(_QueuedMessage, default=None)
        if nextmsg is not None:
            delay = _RETRANSMIT_DELAY
        else:
            nextanswer = self.store.findFirst(_AlreadyAnswered, default=None)
            if nextanswer is not None:
                delay = _RETRANSMIT_DELAY
        if delay is not None:
            return IScheduler(self.store).now() + timedelta(seconds=delay)
471323
def _run(self, circuit: circuits.Circuit,
             param_resolver: study.ParamResolver,
             repetitions: int) -> Dict[str, np.ndarray]:
        """"""
        param_resolver = param_resolver or study.ParamResolver({})
        resolved_circuit = protocols.resolve_parameters(circuit,
                                                        param_resolver)

        if circuit.are_all_measurements_terminal():
            return self._run_sweep_sample(resolved_circuit, repetitions)
        else:
            return self._run_sweep_repeat(resolved_circuit, repetitions)
180840
def run(self): # No "_" in the name, but nevertheless, running in the backed
        
        self.preRun_()
        self.running=True
        
        while(self.running):
            if (self.active): # activated: shared mem client has been reserved
                self.cycle_()
            else:
                if (self.verbose): print(self.pre, "sleep")
                time.sleep(0.2)
            self.handleSignal_()
            
        self.postRun_()
749281
protected function optimizeApplication()
    {
        $this->call('config:clear');
        $this->call('route:clear');
        $this->call('clear-compiled');

        if ($this->laravel->environment('production') && !$this->option('no-cache')) {
            $this->call('config:cache');
            $this->call('route:cache');
        }

        if (!$this->option('no-optimize')) {
            $this->call('antares:optimize');
        }
    }