示例#1
0
    void eval(MonteCarloNode& n) {
        auto& b = n.board;
        auto sym = n.orientation;

        feats.fill(Features());
        oriented.fill(Features());
        extractFeatures(b,feats);
        dihedralTranspose(feats,oriented,sym);

        inVec.clear();
        convertToTCNNInput(oriented,inVec);

        result = &nn.fprop(inVec);
        std::vector<size_t> inds;
        inds.assign(n.moves.size(),0);

        double total = 0;
        for(size_t i = 0; i < n.moves.size(); ++i) {
            inds[i] = /*IX(n.moves[i]);*/IX(dihedral(n.moves[i],sym));
            total += (*result)[inds[i]];
        }

        for(size_t i = 0; i < n.moves.size(); ++i) {
            n.probabilities[i].store((*result)[inds[i]]/total);
        }

    }
示例#2
0
MediaController::Features MediaController::supportedFeatures() const
{
    if (!d || !d->media) {
        return Features();
    }
    IFACE Features();
    Features ret;
    if (iface->hasInterface(AddonInterface::AngleInterface)) {
        ret |= Angles;
    }
    if (iface->hasInterface(AddonInterface::ChapterInterface)) {
        ret |= Chapters;
    }
    if (iface->hasInterface(AddonInterface::NavigationInterface)) {
        ret |= Navigations;
    }
    if (iface->hasInterface(AddonInterface::TitleInterface)) {
        ret |= Titles;
    }
    if (iface->hasInterface(AddonInterface::SubtitleInterface)) {
        ret |= Subtitles;
    }
    if(iface->hasInterface(AddonInterface::AudioChannelInterface)) {
        ret |= AudioChannels;
    }
    return ret;
}
DBusTubeChannel::Private::Private(DBusTubeChannel *parent)
        : parent(parent),
          queuedContactFactory(new QueuedContactFactory(parent->connection()->contactManager(), parent))
{
    parent->connect(queuedContactFactory,
            SIGNAL(contactsRetrieved(QUuid,QList<Tp::ContactPtr>)),
            SLOT(onContactsRetrieved(QUuid,QList<Tp::ContactPtr>)));

    // Initialize readinessHelper + introspectables here
    readinessHelper = parent->readinessHelper();

    ReadinessHelper::Introspectables introspectables;

    ReadinessHelper::Introspectable introspectableDBusTube(
        QSet<uint>() << 0,                                                      // makesSenseForStatuses
        Features() << TubeChannel::FeatureCore,                                 // dependsOnFeatures (core)
        QStringList(),                                                          // dependsOnInterfaces
        (ReadinessHelper::IntrospectFunc) &Private::introspectDBusTube,
        this);
    introspectables[DBusTubeChannel::FeatureCore] = introspectableDBusTube;

    ReadinessHelper::Introspectable introspectableBusNamesMonitoring(
        QSet<uint>() << 0,                                                      // makesSenseForStatuses
        Features() << DBusTubeChannel::FeatureCore,                         // dependsOnFeatures (core)
        QStringList(),                                                          // dependsOnInterfaces
        (ReadinessHelper::IntrospectFunc) &Private::introspectBusNamesMonitoring,
        this);
    introspectables[DBusTubeChannel::FeatureBusNameMonitoring] = introspectableBusNamesMonitoring;

    readinessHelper->addIntrospectables(introspectables);
}
ConnectionManager::Private::ProtocolWrapper::ProtocolWrapper(
        const ConnectionManagerPtr &cm,
        const QString &objectPath,
        const QString &name, const QVariantMap &props)
    : StatelessDBusProxy(cm->dbusConnection(), cm->busName(), objectPath, FeatureCore),
      OptionalInterfaceFactory<ProtocolWrapper>(this),
      mReadinessHelper(readinessHelper()),
      mInfo(ProtocolInfo(cm, name)),
      mImmutableProps(props),
      mHasMainProps(false),
      mHasAvatarsProps(false),
      mHasPresenceProps(false),
      mHasAddressingProps(false)
{
    fillRCCs();

    ReadinessHelper::Introspectables introspectables;

    // As Protocol does not have predefined statuses let's simulate one (0)
    ReadinessHelper::Introspectable introspectableCore(
        QSet<uint>() << 0,                                           // makesSenseForStatuses
        Features(),                                                  // dependsOnFeatures
        QStringList(),                                               // dependsOnInterfaces
        (ReadinessHelper::IntrospectFunc) &ProtocolWrapper::introspectMain,
        this);
    introspectables[FeatureCore] = introspectableCore;

    mReadinessHelper->addIntrospectables(introspectables);
}
示例#5
0
TextChannel::Private::Private(TextChannel *parent)
    : parent(parent),
      textInterface(parent->interface<Client::ChannelTypeTextInterface>()),
      properties(parent->interface<Client::DBus::PropertiesInterface>()),
      readinessHelper(parent->readinessHelper()),
      getAllInFlight(false),
      gotProperties(false),
      messagePartSupport(0),
      deliveryReportingSupport(0),
      initialMessagesReceived(false)
{
    ReadinessHelper::Introspectables introspectables;

    ReadinessHelper::Introspectable introspectableMessageQueue(
        QSet<uint>() << 0,                                                      // makesSenseForStatuses
        Features() << Channel::FeatureCore,                                     // dependsOnFeatures (core)
        QStringList(),                                                          // dependsOnInterfaces
        (ReadinessHelper::IntrospectFunc) &Private::introspectMessageQueue,
        this);
    introspectables[FeatureMessageQueue] = introspectableMessageQueue;

    ReadinessHelper::Introspectable introspectableMessageCapabilities(
        QSet<uint>() << 0,                                                      // makesSenseForStatuses
        Features() << Channel::FeatureCore,                                     // dependsOnFeatures (core)
        QStringList(),                                                          // dependsOnInterfaces
        (ReadinessHelper::IntrospectFunc) &Private::introspectMessageCapabilities,
        this);
    introspectables[FeatureMessageCapabilities] = introspectableMessageCapabilities;

    ReadinessHelper::Introspectable introspectableMessageSentSignal(
        QSet<uint>() << 0,                                                      // makesSenseForStatuses
        Features() << Channel::FeatureCore,                                     // dependsOnFeatures (core)
        QStringList(),                                                          // dependsOnInterfaces
        (ReadinessHelper::IntrospectFunc) &Private::introspectMessageSentSignal,
        this);
    introspectables[FeatureMessageSentSignal] = introspectableMessageSentSignal;

    ReadinessHelper::Introspectable introspectableChatState(
        QSet<uint>() << 0,                                                                  // makesSenseForStatuses
        Features() << Channel::FeatureCore,                                                 // dependsOnFeatures (core)
        QStringList() << TP_QT_IFACE_CHANNEL_INTERFACE_CHAT_STATE,   // dependsOnInterfaces
        (ReadinessHelper::IntrospectFunc) &Private::enableChatStateNotifications,
        this);
    introspectables[FeatureChatState] = introspectableChatState;

    readinessHelper->addIntrospectables(introspectables);
}
//---------------------------------------------------------
bool CGrid_Classify_Supervised::On_Execute(void)
{
	//-----------------------------------------------------
	if( !Get_Features() )
	{
		Error_Set(_TL("invalid features"));

		return( false );
	}

	//-----------------------------------------------------
	CSG_Classifier_Supervised	Classifier;

	if( !Set_Classifier(Classifier) )
	{
		return( false );
	}

	//-----------------------------------------------------
	CSG_Grid	*pClasses	= Parameters("CLASSES")->asGrid();
	CSG_Grid	*pQuality	= Parameters("QUALITY")->asGrid();

	pClasses->Set_NoData_Value(0);
	pClasses->Assign(0.0);

	//-----------------------------------------------------
	Process_Set_Text(_TL("prediction"));

	int	Method	= Parameters("METHOD")->asInt();

	for(int y=0; y<Get_NY() && Set_Progress(y); y++)
	{
		#pragma omp parallel for
		for(int x=0; x<Get_NX(); x++)
		{
			int			Class;
			double		Quality;
			CSG_Vector	Features(m_pFeatures->Get_Count());

			if( Get_Features(x, y, Features) && Classifier.Get_Class(Features, Class, Quality, Method) )
			{
				SG_GRID_PTR_SAFE_SET_VALUE(pClasses, x, y, 1 + Class);
				SG_GRID_PTR_SAFE_SET_VALUE(pQuality, x, y, Quality  );
			}
			else
			{
				SG_GRID_PTR_SAFE_SET_NODATA(pClasses, x, y);
				SG_GRID_PTR_SAFE_SET_NODATA(pQuality, x, y);
			}
		}
	}

	//-----------------------------------------------------
	return( Set_Classification(Classifier) );
}
//---------------------------------------------------------
bool CGrid_Classify_Supervised::Set_Classifier(CSG_Classifier_Supervised &Classifier, CSG_Shapes *pPolygons, int Field)
{
	Process_Set_Text(_TL("training"));

	//-----------------------------------------------------
	TSG_Point	p;	p.y	= Get_YMin();

	for(int y=0; y<Get_NY() && Set_Progress(y); y++, p.y+=Get_Cellsize())
	{
		p.x	= Get_XMin();

		for(int x=0; x<Get_NX(); x++, p.x+=Get_Cellsize())
		{
			CSG_Vector	Features(m_pFeatures->Get_Count());

			if( Get_Features(x, y, Features) )
			{
				for(int iPolygon=0; iPolygon<pPolygons->Get_Count(); iPolygon++)
				{
					CSG_Shape_Polygon	*pPolygon	= (CSG_Shape_Polygon *)pPolygons->Get_Shape(iPolygon);

					if( pPolygon->Contains(p) )
					{
						Classifier.Train_Add_Sample(pPolygon->asString(Field), Features);
					}
				}
			}
		}
	}

	//-----------------------------------------------------
	if( Classifier.Train(true) )
	{
		Classifier.Save(Parameters("FILE_SAVE")->asString());

		return( true );
	}

	return( false );
}
Features 
Features::all()
{
   return Features();
}
KDevLanguageSupport::Features RubySupportPart::features()
{
  return Features(Classes | Functions | Variables | Declarations | Signals | Slots);
}
示例#10
0
KDevLanguageSupport::Features BashSupportPart::features()
{
	return Features(Variables | Functions);
}
示例#11
0
	PlayerInterface::Features PlayerInterface::features() const
	{
		return Features();
	}
示例#12
0
KDevLanguageSupport::Features PythonSupportPart::features()
{
    return Features(Classes | Functions);
}
示例#13
0
int main1()
{
char ch;
clrscr();
printf("\n");
textcolor(CYAN);
cprintf("         Solutions to Basic Electronics");
printf("\n\n");
textcolor(MAGENTA);
cprintf("                         - S.P.Prathyush");
printf("\n\n\n");
textcolor(WHITE);
cprintf("         Enter The Topic");
printf("\n\n\t 1.Half Wave Rectifier \n\t 2.Full Wave Rectifier \n\t 3.Bridge Rectifier \n\t 4.Transistor \n\t 5.Solve by Equations \n\t 6.Definitions \n\t 7.Question Paper Pattern \n\t 8.Syllabus \n\t 9.Reference");
gotoxy(40,7);
printf(" Special Features:");
gotoxy(40,9);
printf(" a.Formula List");
gotoxy(40,10);
printf(" b.Features");
gotoxy(40,11);
printf(" c.View Credits");
printf("\n\n\t");
textcolor(YELLOW);
gotoxy(35,23);
cprintf(" Press Q to Quit ");
printf("\n\n\t");
gotoxy(35,24);
cprintf(" Enter Your Choice : ");
textcolor(WHITE);
printf("");
date();
ch=getche();
switch(ch)
{
case '1':
HWR();
break;

case '2':
FWR();
break;

case '3':
Bridge();
break;

case '4':
Transistor();
break;

case '5':
Equations();
break;

case '6':
definitions();
break;

case '7':
pattern();
break;

case '8':
syllabus();
break;

case '9':
reference();
break;

case 'a':
Formula();
break;

case 'b':
Features();
break;

case 'c':
credits();
break;

case 'Q':
exit(ch-'Q');
break;

default:
printf("\n\n\t");
textcolor(RED+BLINK);
cprintf(" Invalid Choice");
invalid();
getch();
end1();
break;
}
return 0;
}
/**
 * Adds a single feature this factory will make ready on further constructed contacts.
 *
 * No feature removal is provided, to guard against uncooperative modules removing features other
 * modules have set and depend on.
 *
 * \param feature The feature to add.
 */
void ContactFactory::addFeature(const Feature &feature)
{
    addFeatures(Features(feature));
}