Git Product home page Git Product logo

infernal-engine's People

Contributors

dependabot[bot] avatar formix avatar gitter-badger avatar m0xx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

infernal-engine's Issues

Add the `load` method

The load method will take one object as a parameter named model.

Within that object:

  • values will be added as facts at their corresponding context and name.
  • functions will be added as rules at their corresponding context and name.

Add a switch to keep detailed track of changes during inference

  1. The switch could be turned on or off any time during an engine object life time.
  2. When the switch is on, each changes shall be logged into an internal array.
  3. Each call to infer() shall reset the array before inference take place.

This is a proposed structure for a change entry:

{
    "rule": "/rule/full/name",
    "fact": "/fact/full/name",
    "oldValue": 5,
    "newValue": 12.5
}

Refactor for ECMASCRIPT 6 proxying, async/await, etc

Within a rule, the this keyword shall be set to a proxy to be able to build the fact context using the following syntax:

this.$ refers to the root context.
this._ refers to the parent context.
this._ctx returns the current context name. Ex.: "/engine/cylinders" for a rule named "/engine/cylinders/validateSize".
this.name returns the current rule name. Ex: "/engine/cylinders/validateSize".
this.whatever gets or sets the value of the whatever fact in the current context.
this.child.grandchild gets or sets the value of the grandchild fact from the current context's child.
Example 1: if a rule is in the "/engine/cylinders" context, doing this.
.torque allows to get or set the "/engine/torque" fact.

Example 2: from the same rule in the "/engine/cylinders" context, doing this.$.engine.torque would do the same as above.

Add a `notify` method to inform the engine that a variable changed

Some changes are not caught by the set method. For example, modifying an array content do not require that the set method being called. The notify method shall let the programmer inform that such a change happened.

This method could be used to reevaluate rules related to the given fact.

Improves README.md

  1. Keep usage examples in README.md.
  2. Add a link to official documentation inside wiki pages
  3. Add a comprehensive changelog to the wiki

Refactor fact fetching and changes using annotations

Model example:

let model = {

  sum : {
    a : 0,
    b : 0,
    result : 0,
    execute : (next, a, b) => { // defaults to local facts
      let r = a + b;
      return next(null, { "result" : r });
    }
  },

  mult: {
    a : 0,
    b : 0,
    result : 0,
    execute : (next, a, b) => {
      let r = a * b;
      return next(null, {"result" : r});
    }
  },

  finalResult: 0,

  computeFinalResult: (next, /*@ /mult/result */ mult, /*@ /sum/result */ sum) => {
    r = mult - sum;
    return next(null, {"/finalResult" : r});
  }

}

Still a viable solution?

I don't see any current updates to this project so I am curious if it is OK for me to use if for an Ionic Framework mobile application?

Improve rule parsing to recognize lambda expression

The current pattern works with most lambda except when the lambda has only one parameter. The rule parsing logic should branch if it detects a fat arrow or not and use a specific regex to parse parameters in each case.

The getFacts() method returns arrays as object

This is a sample of what the getFacts() returned:

{
  "modelName": "Shimano",
  "size": {
    "value": "Small",
    "options": {
      "0": "",
      "1": "Small",
      "2": "Medium",
      "3": "Large"
    }
  },
  "title": "Small Shimano"
}

Arrays shall not be changed to object.

examples and Usage

This looks great and like it should solve my problem, if I can work out how to use it.
But I am having difficulty working that out.

Problem:
expert query system to ask questions and get responses and determine final set of parameters to make an object.
E.g. Rules:

  1. Item cannot be longer than 44 or less than 20
  2. options for curved edges [None, 1,2,3]
  3. if item is > 36 then curved edge option must not be 3
  4. option for extra holes [None, 4,5,6]
  5. if option 2 then valid holes are [None, 4]
  6. if option 2 and option 4 then length must be <24

How do I wrap this so I can ask a Q, then work out which Q to ask next ?
and so on - so I always have a correct and valid state ?
And have I omitted to ask you something that needs to be asked in order to do this ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.