示例#1
0
  void RobotSetup::initializeRobot()
  {
    assert(continuousSolver_ == nonlinearSolver_);

    delete branchingMethod_;

    continuousSolver_->deleteObjects();
    continuousSolver_->findIntegersAndSOS(false);
    setPriorities();
    addNWays();
    Ipopt::SmartPtr<StrongBranchingSolver> strong_solver = NULL;
    nonlinearSolver_->SetStrongBrachingSolver(strong_solver);
    BonNWayChoose* chooseVariable = new BonNWayChoose(*this,
                                                      nonlinearSolver_);
    branchingMethod_ = chooseVariable;
    branchingMethod_->setNumberStrong(intParam_[NumberStrong]);

  }
示例#2
0
int main(void) {
	int i;
	char buff1[3];
	char buff2[3];
	initDisplay();
	initSomGenerator();
	initTimer0();
	initRC5();
	resetTimer0();
	initRTC();
	initRIT();
	setPriorities();

	int lastAlarmToggle = 0;

	char alarmBit;

	//////////////////////////////////
	char* test = generateSom();
	char som[10];
	strcpy(som, test);
	free(test);

	//////////////////////////////////

//	char arr[3];
//	readRAM(arr, 0x08);
//	delay(500);
//	alarmBit = arr[2];
//	clear();



	int arr2[3];
 	//int arr[3] = {0x00, 0x24, 0x12};
	//setTime(arr);

	readTime(arr2, 0x00);
 	if(arr2[2] < 10){
 		sprintf(buff1, "0%d", arr2[2]);
 	} else {
 		sprintf(buff1, "%d", arr2[2]);
 	}

 	if(arr2[1] < 10){
 		sprintf(buff2, "0%d", arr2[1]);
 	} else {
 		sprintf(buff2, "%d", arr2[1]);
 	}

	//Set the last known values in RIT.c
	lastValues[0] = arr2[0];
	lastValues[1] = arr2[1];
	lastValues[2] = arr2[2];

	sprintf(output, "%s:%s", buff1, buff2);

//    printf("%d\n", arr2[0]);
//    printf("%d\n", arr2[1]);
//    printf("%d\n", arr2[2]);
	//Main loop
	while (1) {


		while (!isTimeForAlarm(alarmBit) && (getCommand(commandCount - 1) != 15 && getCommand(commandCount - 1) != 11)) {
			//This is the main loop, all we do here is print the current time to the display since the current time is updated through the RIT and the EINT takes care of the remote control
			//Prints the current time
			printToDisplay(output);
		}

		if (getCommand(commandCount - 1) == 15) {
			//Goes into the set alarm state
			addAlarmState();
		}

		if (getCommand(commandCount - 1) == 11 && commandCount != lastAlarmToggle) { // '11' needs to be replaced with an other number, because it's an temporary button
			//Toggle alar state
			alarmBit = !alarmBit;
			toggleAlarmState(alarmBit);
			lastAlarmToggle = commandCount;
			//Give the user some feedback(Tell them wether they set or unset the alarm)
			for(i=0; i<200; i++){
				asm("nop");
				if(alarmBit == 1){
					printToDisplay("  +  ");
				} else {
					printToDisplay("  -  ");
				}

			}
		}

		if (isTimeForAlarm(alarmBit)) {
			//Goes into the alarm state
			alarmState();
			resetAlarmTime();

		}
		printToDisplay(output);
	}
	return 0;
}