⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sim1.cpp

📁 neural network 一个演示原理的代码
💻 CPP
字号:
#include "stdafx.h"
#include "aine.h"
#include "ne-neuron.h"
#include "ne-data.h"

using namespace aine;

extern ofstream tron;

static double Inverse( const double v )
{
	return v > 1.0 ? 0.0 : 1.0;
}

/*	Prediction

	This simple is prediction is based upon the following.
	Every day I return to my appartment and there I decide what to do for cooking...
	I strongly believe that what shall be cooked has already been processed by me and I only have the illusion of an already made choice
	Let us analyse the context and verify what kind of functionality  we may have
*/
void SimFood( void )
{
	/*	what can I do for cookingthe evening?
		RegularMeal: Normal warm meal: meat - potatoes/rice/pasta - vegetable.
		Eggs and sandwich.
		toasts.
		warm a prepared meal.
		go out to the restaurant.

		Some prerequisite are activated for
		RegularMeal - need to take the meat out of the fridge or have bought meat
			But if the need is too high I can still prepare a spagetti carbonara...
		Eggs - need to have some eggs in the frige
		toasts: did I bought some bread  lately? do I also have someting to put on?
		WarmingMeal: do I have one? can or not?
		Restaurant: do I want to go out?
	*/
	Neuron RegularMeal;
	Neuron WarmingMeal;
	Neuron Carbonara;

	//	Inputs
	Neuron Tired;
	Neuron Meeting;
	Neuron BadWeather;
	Neuron UnfrozenMeat;
	Neuron HaveEggs;
	Neuron HaveBread;
	Neuron AmILate;
	
	/*	What is funtion of what? what are we linking?
		When the full learning procedure will be activated, 
		We will just declare the neurons and let the system establish himself the links.
		As we do not have any certainty, we will alway be satisfied of the resulting net.
	*/

	//	I eat regular if I am not tired...
	Tired.ConnectWith( &RegularMeal );
	Tired.axon[0]->SetCallBack( Inverse );

	//	I can eat regular as I have unfrozen the meat.
	UnfrozenMeat.ConnectWith( &RegularMeal );

	//	I eat regular if I am not late at home... This one is restrictive and with some fuzzy values
	AmILate.ConnectWith( &RegularMeal );
	AmILate.axon[0]->SetCallBack( Inverse );
	AmILate.ConnectWith( &Tired );

	//	I had meeting so I increase the fact of being tired...
	Meeting.ConnectWith( &Tired );
	//	But also The fact of having no meeting will decrease it...
	Meeting.ConnectTo( &Tired );
	Meeting.axon[1]->SetCallBack( Inverse );
}

/*
	The idea behind this is:
	we implement a simple neural system for music volume control
	The inputs are:
	1. Location: we have 7 rooms (office - dining room - kitchen - living room - bed room - bath room - toilet)
	2. We have heat detector in each of the room (justification for the music to be played).
	3. We have motion detector (are they moving?)
	4. We have sound detector (are they talking or giving us orders?)
	5. We have light detector - plus one outside detector.
	6. We have temperature detector outside.
	7. We have rain detector outside.

	The output is:
	1. Choose the correct music.
	2. Adjust the sound properly
	3. Put the sound in te correct room(s)

	Let us first resolve each of the issue separately knowing:
	1. The music choice is dependant of the external conditions (temperature - rain - light)
	2. The place to play the music is function of the presence of someone in the room
		We will add later on a nice feature: we will give connection to the rooms so when we are nearly in the middle of two we will play in both.
	3. The sound depend of the following: amount of people in the room, their motions, embiant noise, discussion but also if we are the morning, evening, night or day.
*/

	
void simMusic( void )
{
	//	The temperature may be considered as cold , average or warm
	//	Rain is seen as heavy - lite - no rain
	//	light is day - sunny - cloudy - night


}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -