Click here to Skip to main content
15,881,898 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear All, if any one can guide me about following project it would be really awesome,
there some devices that will work under some conditions like weather temperature, time, date and etc,
we want to develop a service for our customers to design their condition for their devices for example if weather is rainy and time is half past four irrigation system will be triggered,

for designing dynamic condition there is no problem , main problem is that we want to store all user condition statements in our servers and server check conditions in real time and if any condition was true send command to our following devices over our cloud system.Like IFTTT

here is now the question: is there any algorithm for fast checking thousand conditions for multiple user and devices,

is there any opensource alternative for IFTTT to see how their check millions conditions at time and respond fast at their exact time.

if any C# based or .net based sample it would be really great.

What I have tried:

Cloud server have done, dynamic condition maker have done using json, all condition store in server, currently it`s working, but i think if conditions increased and be complex my algorithm is not good to handle it, cause there is a loop to check all condition at a time ( conditions that affect current time )
Posted
Updated 27-Apr-20 20:42pm

I've always like the idea as storing the conditions / 'rules' as strings which can then be stored in a database, and then using Roslyn to evaluate them - this sort of gives the idea eval in C# – Roslyn (Microsoft CodeAnalysis CSharp Scripting NuGet Package) – Mario Mucalo's Blog[^]
 
Share this answer
 
Comments
RezaCsharp 28-Apr-20 4:53am    
is it possible to perform large amount of rules at a same time using this feature, I've read article, seems nice, but I've seen loop in the article , seems critical here, do you think is it fast enough to handle thousands rules or even million? consider there are many users that they can define their own rules
Garth J Lancaster 28-Apr-20 5:39am    
I don't honestly know - btw this might help as well

https://www.nrecosite.com/nrecoframework/common_library_net.aspx
https://github.com/nreco/lambdaparser

ok, so, what I would do at program start, is load and compile all the rules/expressions and store them pre-compiled maybe in a hash/dictionary, thus decreasing the time for the evaluate step. Then on a timed event or whatever, run though the 'rules' with the data

I think what you want is a Rule based engine[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900