2

I have some papers which describe some computer algorithms. My algorithms have some input, output, static (global) variables, comments ... something like the following algorithm, however I borrowed it from a book about artificial intelligence and I am not sure that is the style for a paper

function SIMPLE-REFLEX-AGENT(percept) returns an action 
    static: rules, a set of condition-action rules
    state← INTERPRET-INPUT(percept) 
    rule← RULE-MATCH(state, rules) 
    action← RULE-ACTION[rule] 
return action

What is the standard notation to insert such algorithms into a paper?

2

To the best of my knowledge, there is no standard notation for algorithms across computer science fields. However, looking through previous editions of the venue you plan to send your paper to should give you a good impression for how algorithms are typically denoted.

That being said, most papers I know just use a very simple procedural notation, basically pseudo-code in a simplified structural programming language. The reason is likely that such a notation has the least "hidden assumptions" in contrast to what your average computer scientist will know and expect. Contrary, your example seems ripe with symbols and expressions that are certainly not globally understood outside of AI. Using a "compact, expressive" notation loses much of its appeal if you then need to spend half a page to formally define your notation.

1

Personally, I strongly recommend not using pseudocode, but instead choosing a language where you can express your real code tersely enough that you can simply publish your actual code in your paper.

The reason for this is that writing code is hard, and so pretty much all code has bugs in it when first written or translated from another language. Normally, we debug our code in various ways, including running it against tests or applying static analysis tools. For pseudocode, however, you can't do this, and so unless you're dealing with a very simple algorithm, there's a high likelihood of introducing a bug during your translation from your validated code or math into pseudocode.

If you must use pseudocode, however, just look at other publications in your field and choose a similar style. In particular, there are a number of good LaTeX packages for pseudocode, which you are likely to find useful for this purpose.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.