Skip to content

Question nondeterministic constant field #144

@ArnoStrouwen

Description

@ArnoStrouwen

Does the constant field of a Node only come into play for leaf nodes?
It seems nondeterministic for branch nodes when playing around with it in the REPL.

julia> using DynamicExpressions
       
       operators = OperatorEnum(1 => (inv,), 2 => (+,))
       t1 = Node{Float64}(feature=1) + Node{Float64}(feature=2) 
       t1.constant
false

julia> using DynamicExpressions
       
       operators = OperatorEnum(1 => (inv,), 2 => (+,))
       t1 = Node{Float64}(feature=1) + Node{Float64}(feature=2) 
       t1.constant 
false

julia> t2 = Node{Float64}(op=0x1, children=(Node{Float64}(feature=1), Node{Float64}(feature=2)))
       t2.constant
true

julia> using DynamicExpressions
       
       operators = OperatorEnum(1 => (inv,), 2 => (+,))
       t1 = Node{Float64}(feature=1) + Node{Float64}(feature=2) 
       t1.constant
false

julia> t2 = Node{Float64}(op=0x1, children=(Node{Float64}(feature=1), Node{Float64}(feature=2)))
       t2.constant
false

Is the correct deterministic way for determining if a node is operator/constant/feature, to use has_operators and then has_constants?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions