Class: CAS::BoxConditionUpperClosed

Inherits:
BoxCondition show all
Defined in:
lib/functions/fnc-box-conditions.rb

Overview

Implements the box condition with lower bound open and upper closed

“‘ a < f(x) ≤ b “`

Instance Attribute Summary

Attributes inherited from BoxCondition

#lower, #upper, #x

Attributes inherited from Condition

#x, #y

Instance Method Summary collapse

Methods inherited from BoxCondition

#==, #args, #depend?, #diff, #initialize, #inspect, #simplify, #subs, #to_code, #to_s

Methods inherited from Condition

#==, #args, #depend?, #diff, #initialize, #inspect, #simplify, #subs, #to_code, #to_s

Constructor Details

This class inherits a constructor from CAS::BoxCondition

Instance Method Details

#call(fd) ⇒ Object

Function call will evaluate box condition to evaluate relation

* **argument**: `Hash` with feed dictionary
* **returns**: `Trueclass` or `Falseclass`


262
263
264
265
# File 'lib/functions/fnc-box-conditions.rb', line 262

def call(fd)
  x_call = @x.call(fd)
  return ((@lower.call(fd) < x_call) and (x_call <= @upper))
end

#representativeObject

Saves some required elements



250
251
252
253
254
255
# File 'lib/functions/fnc-box-conditions.rb', line 250

def representative
  @lower_cond = @lower_str = "<"
  @upper_cond = "<="
  @upper_str  = ""
  self
end