430 likes | 444 Views
Fuzzy Logic and its Application to Web Caching. By P.M.Pavan Kiran. What is fuzzy logic?. A type of logic that recognizes more than simple true and false values. With fuzzy logic, propositions can be represented with degrees of truthfulness and falsehood. A Simple Example.
E N D
Fuzzy Logic and its Application to Web Caching By P.M.Pavan Kiran
What is fuzzy logic? A type of logic that recognizes more than simple true and false values. With fuzzy logic, propositions can be represented with degrees of truthfulness and falsehood.
A Simple Example The Statement Today is sunny can be • 100% true if there are no clouds • 80% true if there are a few clouds • 50% true if it's hazy and • 0% true if it rains all day
Classical Set young = { x P | age(x) 20 } characteristic function: 1 : age(x) 20 0 : age(x) > 20 { myoung(x) = young(x) A=“young” 1 0 x [years]
Fuzzy Set Fuzzy Logic Element x belongs to set A with a certain degree of membership: (x)[0,1] Classical Logic Element x belongs to set A or it does not: (x){0,1} A(x) A(x) A=“young” A=“young” 1 1 0 0 x [years] x [years]
Types of Membership Functions Trapezoid: <a,b,c,d> (x) 1 0 a b c d x Triangular: <a,b,d> Singleton: (a,1) and (b,0.5) (x) (x) 1 1 0 0 a b d x a b x
Operators on Fuzzy Sets Union Intersection AB(x)=max{A(x),B(x)} AB(x)=min{A(x),B(x)} A(x) B(x) A(x) B(x) 1 1 0 0 x x AB(x)=min{1,A(x)+B(x)} AB(x)=A(x) B(x) A(x) B(x) A(x) B(x) 1 1 0 0 x x
Fuzzy Sets & Linguistic Variables • A linguistic variable combines several fuzzy sets. • linguistic variable : temperature • linguistics terms (fuzzy sets) : { cold, warm, hot } (x) cold warm hot 1 0 20 60 x [C]
Fuzzy Rules • causal dependencies can be expressed in form of if-then-rules • general form:if <antecedent> then <consequence> • example:if temperature is cold and oil is cheapthen heating is high linguistic variables linguistic values/terms (fuzzy sets)
Fuzzy Rule Base Heating Temperature : cold warm hot Oil price: cheap normal expensive high high medium high medium low medium low low if temperature is cold and oil price is low then heating is high if temperature is hot and oil price is normal then heating is low
Fuzzy Knowledge Base fuzzy knowledge base Fuzzy Data-Base: Definition of linguistic input and output variables Definition of fuzzy membership functions (x) cold warm hot 1 20 60 0 x [C] Fuzzy Rule-Base: if temperature is cold and oil price is cheap then heating is high ….
An Example In order to illustrate some basic concepts in Fuzzy Logic, consider a simplified example of a thermostat controlling a heater fan illustrated in Figure 1. The room temperature detected through a sensor is input to a controller which outputs a control force to adjust the heater fan speed.
Conventional Thermostat • A conventional thermostat works like an on-off switch (Figure 2). • If we set it at 78oF then the heater is activated only when the temperature falls below 75oF . • When it reaches 81oF the heater is turned off. As a result the desired room temperature is either too warm or too hot.
Fuzzy Thermostat • A fuzzy thermostat works in shades of gray where the temperature is treated as a series of overlapping ranges. • For example, 78oF is 60% warm and 20% hot. The controller is programmed with simple if-then rules that tell the heater fan how fast to run. • As a result, when the temperature changes the fan speed will continuously adjust to keep the temperature at the desired level.
Designing a Fuzzy Controller • Our first step in designing such a fuzzy controller is to characterize the range of values for the input and output variables of the controller • Then we assign labels such as cool for the temperature and high for the fan speed, and we write a set of simple English-like rules to control the system. .
Design Contd….. • Inside the controller all temperature regulating actions will be based on how the current room temperature falls into these ranges and the rules describing the system behavior. The controller's output will vary continuously to adjust the fan speed
The Rule Base • The temperature controller described above can be defined in four simple rules: • IF temperature IS cold THEN fan_speed IS high • IF temperature IS cool THEN fan_speed IS medium • IF temperature IS warm THEN fan_speed IS low • IF temperature IS hot THEN fan_speed IS zero
The Process A fuzzy controller works similar to a conventional system: it accepts an input value, performs some calculations, and generates an output value. This process is called the Fuzzy Inference Process and works in three steps illustrated in Figure 3: • (a) Fuzzification where a crisp input is translated into a fuzzy value, • (b) Rule Evaluation, where the fuzzy output truth values are computed, and • (c) Defuzzification where the fuzzy output is translated to a crisp value.
Fuzzification • During the fuzzification step the crisp temperature value of 78oF is input and translated into fuzzy truth values. • For this example, 78oF is fuzzified into warm with truth value 0.6 (or 60%) and hot with truth value 0.2 (or 20%).
Rule Evaluation • For 78oF only the last two of the four rules will fire. • IF temperature IS warm THEN fan_speed IS low with truth value 0.6 • IF temperature IS hot THEN fan_speed IS zero with truth value 0.2
Defuzzification • During the defuzzification step the 60% low and 20% zero labels are combined using a calculation method called the Center of Gravity (COG) in order to produce the crisp output value of 13.5 RPM for the fan speed
The Rule Base • rule 1: IF temperature IS cool AND pressure IS weak, THEN throttle is P3. • rule 2: IF temperature IS cool AND pressure IS low, THEN throttle is P2. • rule 3: IF temperature IS cool AND pressure IS ok, THEN throttle is Z. • rule 4: IF temperature IS cool AND pressure IS strong, THEN throttle is N2.
Why Web Caching? • It is widely recognized that slow web sites are primary source of user dissatisfaction. • Web Caching is a mechanism widely employed to reduce the latency to retrieve web pages.
What is web Caching? • The idea of web caching is to store popular web objects “closer” to the user who requests them such that they can be retrieved faster. Caching also has the effect of reducing the load on the web servers and traffic over network.
Web Caching • Web caching can be implemented at different levels • They are 1.Client 2.Server 3.Network
Web Caching • The web server and web browser are responsible for caching at server and client side respectively. Proxy servers are used for caching at the network level. • A proxy server acts as an intermediary between clients and web servers.
Proxy server • Many organizations use proxy servers in front of their LANs to save network bandwidth and speed up web page requests serving them locally. • Upon receiving requests from multiple clients the proxy server checks from its cache whether the page is already present.
Proxy Server • In Case of a cache miss the proxy server forwards the request to the web server. Once the page is returned by the server, the proxy sends it back to the client and stores a copy in the local cache for further requests. • If the cache is full one or more pages have to be evicted from the cache.
The Replacement Policies • The efficiency and performance of proxy caches depend on their design and management. Replacement policies play a key role for effectiveness of caching. • The goal of these policies is to make best use of the available resources by dynamically selecting the pages to cached or evictes.
The fuzzy Database for web caching • 1. Identification of the input output variables. • 2. Definition of the membership functions. • 3. Construction of the rule base.
The Variables • The proper choice of process state input variable is essential to the characterization of the operation of a fuzzy system. • Three variables as input are chosen, they being • Size, Frequency of access, Access recency, i.e time elapsed since the last access.
The Variables • The output variable is probability of replacement. • The membership functions of each of these variables is plotted from the analysis of various proxy servers and their workloads.
The process • Measurement of the values of the input data from the server. • Fuzzification • Inference from fuzzy rules using Max-Min Inference. • Defuzzification using the COG method.
The End Thank You