Example #1
0
/// type == 0, solve equations defined by paras....
//			   if paras == NULL, all are random points
//			   if paras != NULL, selective sampling
/// type > 0, params contains type number of inputs.....
/// type < 0, params contains the CLassifiers obtained last time.
int DisjunctiveLearner::selectiveSampling(int randn, int exen, int type, void* paras)
{
	if ((type != 0) && (exen > type))
		randn += exen - type;
#ifdef __PRT
	std::cout << "{";
#endif
	Solution input;
	for (int i = 0; i < randn; i++) {
		Equation::linear_solver(NULL, input);
#ifdef __PRT
		std::cout << input << "|";
#endif
		runTarget(input);
	}
	if (exen == 0) {
#ifdef __PRT
		std::cout << "}" << std::endl;
#endif
		return randn + exen;
	}

#ifdef __PRT
	std::cout << "+|";
#endif
	return randn + exen;
}
void MindTarget::runService() {
	// start sensors
	sensorArea -> startSensorArea();
	effectorArea -> startEffectorArea();

	// start poller
	sensorTracker -> startTracker();

	// call final target
	runTarget();
}
Example #3
0
void CommandLineFrontend::handleJobFinished(bool success, AbstractJob *job)
{
    try {
        job->deleteLater();
        if (!success) {
            qbsError() << job->error().toString();
            m_resolveJobs.removeOne(job);
            m_buildJobs.removeOne(job);
            if (m_resolveJobs.empty() && m_buildJobs.empty()) {
                qApp->exit(EXIT_FAILURE);
                return;
            }
            cancel();
        } else if (const auto setupJob = qobject_cast<SetupProjectJob * const>(job)) {
            m_resolveJobs.removeOne(job);
            m_projects.push_back(setupJob->project());
            if (m_observer && resolvingMultipleProjects())
                m_observer->incrementProgressValue();
            if (m_resolveJobs.empty())
                handleProjectsResolved();
        } else if (qobject_cast<InstallJob *>(job)) {
            if (m_parser.command() == RunCommandType)
                qApp->exit(runTarget());
            else
                qApp->quit();
        } else { // Build or clean.
            m_buildJobs.removeOne(job);
            if (m_buildJobs.empty()) {
                switch (m_parser.command()) {
                case RunCommandType:
                case InstallCommandType:
                    install();
                    break;
                case GenerateCommandType:
                    generate();
                    // fall through
                case BuildCommandType:
                case CleanCommandType:
                    qApp->exit(m_cancelStatus == CancelStatusNone ? EXIT_SUCCESS : EXIT_FAILURE);
                    break;
                default:
                    Q_ASSERT_X(false, Q_FUNC_INFO, "Missing case in switch statement");
                }
            }
        }
    } catch (const ErrorInfo &error) {
        qbsError() << error.toString();
        qApp->exit(EXIT_FAILURE);
    }
}
/**********************************************************
 * Uploads and runs the flashloader on the target
 * The flashloader is written directly to the start
 * of RAM. Then the PC and SP are loaded from the
 * flashloader image. 
 **********************************************************/
void uploadFlashloader(uint32_t *flImage, uint32_t size)
{
  int w;
  uint32_t addr;
  uint32_t tarWrap;
  
  uint32_t numWords = size / 4;
  if ( numWords * 4 < size ) numWords++;
   
  resetAndHaltTarget();
  
  /* Get the TAR wrap-around period */
  tarWrap = getTarWrap();
  
  printf("Uploading flashloader\n");
  
  /* Enable autoincrement on TAR */
  writeAP(AP_CSW, AP_CSW_DEFAULT | AP_CSW_AUTO_INCREMENT);
  
  for ( w=0; w<numWords; w++ ) 
  {
    /* Get address of current word */
    addr = RAM_START + w * 4;
    
    /* At the TAR wrap boundary we need to reinitialize TAR
     * since the autoincrement wraps at these */
    if ( (addr & tarWrap) == 0 )
    {
      writeAP(AP_TAR, addr);
    }
    
    writeAP(AP_DRW, flImage[w]);
  }
  
  writeAP(AP_CSW, AP_CSW_DEFAULT);
  
  printf("Booting flashloader\n");
  
  /* Load SP (Reg 13) from flashloader image */
  writeCpuReg(13, flImage[0]);
  
  /* Load PC (Reg 15) from flashloader image */
  writeCpuReg(15, flImage[1]);
    
  runTarget();
}
void setStartRunningMode(void)
{
    runTarget();
    resetTarget = 0;
    stopInterrupt = 0;
}