Skip navigation
ANNOUNCEMENT: community.oracle.com is currently Read only due to planned upgrade until 29-Sep-2020 9:30 AM Pacific Time. Any changes made during Read only mode will be lost and will need to be re-entered when the application is back read/write.

January 2018

# Logic Puzzle - OPA Determination with Probability

Posted by Paul Fowler Jan 31, 2018

A probability problem comes up in policy that needs frequent solving:

Do we immediately send police to a residence of suspected activity based on probability the situation will escalate?  Will a person likely skip bail? How likely is a benefit to be applicable after only a preliminary screening?

The challenge is that sometimes probability is involved.  We can't immediately send police to every event all the time.  We must sometimes be selective and our policy needs to allow for policy probability in some parts of our determinations.

Puzzle #5

The local department of criminal justice has provided the following statistics in determining the person’s probability of missing court (these statistics are made-up).  The overall probably of missing a court appointment is 45%.  Of those who miss court, 40% are in the local community, 80% had an outstanding warrant, and 10% had a job.

Allowing for uncertainty and collecting 1) whether a person is a member of the community, 2) has an outstanding warrant, and/or 3) has as job, write an OPA policy that implements the following:

As any FYI, my collection screen looks like this:

The solution to this problem is attached with a more "generic" structure for solving problems of "likelihood".

The solution is simple in that a one page word document sets up the math.  A spreadsheet contains the list of question attributes used in screens to refine the final probability.  Questions which refine the probability can be added into the spreadsheet.  You can have 2-3 questions such as in this puzzle, or you can have several hundred.

A theoretical introduction to the solution can be found here: https://www.askiitians.com/iit-jee-algebra/probability/bayes-theorem.aspx

There are also many good youtube videos on Bayes reasoning: https://www.google.com/search?q=youtube+bayes+theorem&oq=youtube+bayes+theorem&aqs=chrome..69i57j69i64.3865j0j7&sourceid…

I will have a future blog post where I start to discuss intersection with AI and specifically with Machine Learning.

# OPA Architecture Map 1.0

Posted by Paul Fowler Jan 10, 2018

Since this is an architecture blog, I should post some architecture assistance, huh?

I attached a PDF with embedded links.  This OPA architecture map is meant to only be a starting point for architects.

Every element in the attached documents has URL links to documentation so that the elements can be studied.

I figure an hour with this map, and most experienced IT architects will have the logical OPA technical architecture concepts understood.

Disclaimers:

• I don't work for Oracle and this is not authoritative.
• I recognize the architecture view is not a standard architectural view by any stretch.
• Components and Interactions shown are not necessarily everything available.
• This map was created in a morning, so feel free to add comments to this blog about mistakes I made.

# Selecting Pseudo-Random in OPA + an OPA game...

Posted by Paul Fowler Jan 6, 2018

Today's post is a bit unique and should leave some OPA developers at Oracle scratching their heads and asking "why?"  My answer - "why not?"

Have you ever wanted to select questions at random to ask during an OPA interview, in order to test knowledge?  Can you think of any other reason to have OPA generate Pseudo-Random numbers?  I did - I quickly wrote a game using OPA.

Sure, you could use Rulescript, an API, or Javascript to get random numbers, but I chose to implement the common Linear Congruent Generator for random numbers using OPA itself.  I use the same routine and parameters as the Java libs, Posix, etc...  So, I think this is a pretty good random number generator.

My "Random Numbers" project is attached and also the classic game of "Bagels" from the 1978 issue of ATARI magazine.   I implemented the game using OPA and the random number generator so that example random number generator usage can be explored.  Plus - its a game.

The random numbers project from this blog is easily included in other projects as an "inclusion".

There is a "Random Number Initialization.docx" rule file that has the following parameter settings for the random number generator.  These example settings would generate 100 random values between 1-10,000 inclusive.  It puts the values into "the random number value" in the random number entity.  You are expected to change these settings for your project.  The other rule file contains my random number generator logic and shouldn't be touched unless you know what you are doing.

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Random number settings.  Separate from the rules, in case I want to change the random number engine…

These next 4 values can be overridden to provide more / less random numbers and range… the rndm seed defaults to a value from the date / time.

the seed = the rndm time seed

the rndm number count = 100

the rndm range low = 1

the rndm range high = 10000

if the following statement is "the random values are unique", then the rndm number count must be less than the random number range.  This generates non-repeating numbers.

This next statement must be either:

• the random values are unique
• the random values are not unique

the random values are unique

By date: By tag: