Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I am recently working on a project aiming at evaluating whether an android app c

ID: 653061 • Letter: I

Question

I am recently working on a project aiming at evaluating whether an android app crashes or not. The evaluation process is

1.Collect the logs(which record the execution process of an app).
2.Generate formulas to predict the result
    (formulas is generated by GP)
3.Evaluate the logs by formulas


Now I can produce formulas, but for convenience for users, I want to translate formulas into form of natural language and tell users why crash happened.(I think it looks like "inverse natural language processing".)

To explain the idea more clearly, imagine you got a formula like this:

155 - count(onKeyDown) >= 148
It's obvious that if count(onKeyDown) > 7, the result of "155 - count(onKeyDown) >= 148" is false, so the log contains more than 7 onKeyDown event would be predicted "Failed".

I want to show users that if onKeyDown event appears more than 7 times(155-148=7), this app will crash.

However, the real formula is much more complicated, such as:

(< !( ( SUM( {Att[17]}, Event[5]) <= MAX( {Att[7]}, Att[0] >= Att[11]) OR SUM( {Att[17]}, Event[5]) > MIN( {Att[12]}, 734 > Att[19]) ) OR count(Event[5]) != 1 ) > (< count(Att[4] = Att[3]) >= count(702 != Att[8]) + 348 / SUM( {Att[13]}, 641 < Att[12]) mod 587 - SUM( {Att[13]}, Att[10] < Att[15]) mod MAX( {Att[13]}, Event[2]) + 384 > count(Event[10]) != 1))
I tried to implement this function by C++, but it's quite difficult, here's the snippet of code I am working right now.

Does anyone knows how to implement this function quickly?(maybe by some tools or research findings?)Any idea is welcomed: )

Thanks in advance.

Explanation / Answer

I'm not sure that C++ is the ideal tool for this project. This sounds a lot like Logic Programming. A friend of mine has been using Clojure's built in the core.logic library (I had previously mentioned Frenchy64, but that's someone using core.logic to add type-safety to clojure).

This looks like the kind of problem that Functional or Lisp-ish programming was made to solve - turning mathematical statements into code. This is not a procedural problem (like making a to-do list). You might have a look at Lisp, or any of its derivatives (Clojure, Haskell, Erlang, Scala, Scheme, etc.).

SICP is a great training resource for learning functional programming. Martin Odersky is using it as a basis for his Functional Programming in Scala free online course which started this week. I'm guessing though that Clojure is closest to your needs. I'll see if I can get my friend to comment.