/ [CNS] / [Comp Sci Dept] / [R J Botting] >> [andor] >> index
[Index] [Contents] [Source] [Notation] [Copyright] [Comment] [Search ]
Wed Jun 13 17:11:33 PDT 2007

This part of my site contains partly baked ideas (PBI).
Disclaimer. CSUSB and the CS Dept have no responsibility for the content of this page.

# Extended And/Or Table Tools

## 2007-06-13 Wed Jun 13 17:06 New test of conbining two tables

[ test2.cpp ]

Also updates to [ andor.cpp ] (code) [ 20070611.html ] (documentation)

## 2007-06-13 Wed Jun 13 13:06 Separated and improved code

[ andor.cpp ] [ test.andor.cpp ]

## 2007-06-12 Tue Jun 12 10:06 Generated initial documentation of classes and types

[ 20070611.html ]

1. 14:06 [ andor.png ]
2. 16:06 [ theory.html ]

## 2007-06-11 Mon Jun 11 09:06 Test case from Page 252 of Horstmann

Here is the Extended And/or Table for Horstman's example of tax formula:
3. tax = rate *(income - over) + base, where rate, over, and base depend on the marital status and the income:
VariableValues
statussinglesinglesinglemarriedmarriedmarried
rate152831152831
income0..2144921450..5189951900..*0..357993580..6649986500..*
base03217.5011743.500537019566
over0214505190003580086500

This [ horst252.dat ] AndOr table is an excellent motivation for developing Extended AndOr Tables.

## 2007-06-05 Tue Jun 5 11:06 Made source code public

Forgot to set the permissions on the source code files below.... just fixed it.

## 2007-06-05 Tue Jun 5 10:06 Added sortRows operation to AndOrTable

` void AndOrTable::sortRows()`
` {`
` 	sort(row.begin(), row.end(), lessthan);`
` }`
`    void sortRows();`

The lessthan function compares the conditions in two rows:

` bool lessthan(const AndOrTableRow &a, const AndOrTableRow & b)`
` {`
` 	return a.getCondition() < b.getCondition();`
` }`

This made me make the two getters "const" member functions:

`    Value getValue(int i)const{assert(i>=0);assert (i<value.size()); return value[i];}`
and
`    string getCondition()const{return condition;}`

Code with test [ andor070605sort.cpp ]

To do list:

1. save and load tables into a file
2. Clear a table of rows
3. Append a table after anther one
4. Assignment operator (clear and append)
5. Copy constructor ( just appends the old table to the new empty one )
6. Extend definition of Value to include 'O' indicating an impossible option of both T and F at the same time. (a complete lattice or cpo [ Lattice_%28order%29 ] ).
7. Define operator and on Values and also operator or on Values
8. Define the 'and' operator on rows with same condition.
9. Define merge -- append and sort, then 'and' the rows, then delete impossible columns.

10. Better user interface: the AndOr Calculator.

11. Examples of use to make deductions, check consistency, and solve puzzles.

12. Start extended AndOr Table: Value now becomes an abstract class with {O,F,T,X} as a special case...

## 2007-06-04 Mon Jun 4 14:06 New test program for AndOrTable P^Q PvQ P->Q

[ andor070604.cpp ]