Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: hello ,have a good day all , i need some answers of these questions...

  1. #1
    Junior Member
    Join Date
    May 2013
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default hello ,have a good day all , i need some answers of these questions...

    1. Operator effect definition:
    oi,j ((a1 , a2 , . . . , a12 )) = (b1 , b2 , . . . , b12 )
    k = 1, 2, . . . , 12
    if (a1 , a2 , . . . , a12 ) ∈ dom(oi,j )
    bk =
    ak + j
    ak + 120
    if ∃l(al > ak ) ∨ (ak + ai = 0)
    otherwise
    Exercise 4. Create the Java implementation for the function above as a body of a void function!
    We suppose that a1 , a2 , . . . , a12 are integers, and they are accessible in the function body as a[1], a[2],
    . . ., a[12], and b1 , b2 , . . . , b12 are integers, and they are accessible in the function body as b[1], b[2], . . .,
    b[12].

    answer :

    2.

    Set of operators:
    O = {o1,2 , o1,3 , o2,1 , o2,3 , o3,1 , o3,2 }
    Domain of operators:
    dom(oi,j ) = {(a1 , a2 , . . . , a12 ) ∈ N12 | ∀k((k = j) ⊃ (ak + i > aj )) ∧ ∃k∃l(a1 = ak ∗ al )}
    Exercise 3. Create the Java implementation for the preconditions above as a body of a boolean
    function! We suppose that a1 , a2 , . . . , a12 are integers, and they are accessible in the function body as a[1],
    a[2], . . ., a[12].

    answer :

    3.

    Set of goal states:
    G = {(a1 , a2 , . . . , a12 ) ∈ N12 | ∀i∃j((ai + aj > 20) ⊃ (ai ∗ aj < 200))}
    Exercise 2. Create the Java implementation for the goal condition above as a body of a boolean
    function! We suppose that a1 , a2 , . . . , a12 are integers, and they are accessible in the function body as a[1],
    a[2], . . ., a[12]

    answer :

    4.

    ∀i(∃j((aj < ai ) ∨ (aj = 1000)) ⊃ (ai > 0) ∨ ∃j(aj = 50))
    where i ∈ {1, 2, . . . , 6} and j ∈ {1, 2, . . . , 6}
    Exercise 1. Create the Java implementation for the formula above as a body of a boolean
    function! We suppose that a1 , a2 , . . . , a6 are integers, and they are accessible in the function body as a[1],
    a[2], . . ., a[6].

    answer :

    5.

    1.all i exists j a[i] > a[j] or a[1] = a[4]

    all i ( exists j ( (a[j] < a[i]) or not (a[j] = 1000) ) implies ( a[i] > 0 or exists j ( a[j] = 50 ) ) )

    implementation in java :

    ------------------------------------------------------------------------------------------------


    Complete the Java implementation of the Breadth-first search

    Exercise 1. Initialize the database.
    Exercise 2. Construct the solution as an operator list.
    Exercise 3. Complete the code of the extension.

    public interface Problem {
    State startState();
    Collection<Operator> operators();
    }
    public interface State {
    boolean isGoal();
    }
    public interface Operator {
    boolean isApplicable(State s);
    State apply(State s);

    }

    public abstract class Solver {
    private static class Node {
    State state;
    Operator creator;
    Node parent;
    int deep;
    public Node(State state, Operator op, Node parent ) {
    this.deep = parent == null ? 0 : parent.deep + 1;
    this.creator = op;
    this.parent = parent;
    this.state = state;
    }

    }
    public List<Operator> run(Problem p) {
    LinkedList<Node> closedNodes = new LinkedList<Node>();
    LinkedList<Node> openNodes = new LinkedList<Node>();
    /* Exercise 1: Initialize the database. */

    while ( ! openNodes.isEmpty() ) {
    Node node = openNodes.removeFirst();
    if ( node.state.isGoal() ) {
    LinkedList<Operator> solution = new LinkedList<Operator>();
    /* Exercise 2: Construct the solution as an operator list. */

    return solution;
    }
    closedNodes.add(node);
    for ( Operator op : p.operators() ) {
    if ( op.isApplicable(node.state) ) {
    State newState = op.apply(node.state);
    /* Exercise 3: Complete the code of the extension

    * (use the search function below when necessary). */
    }
    }
    }
    return null;
    }
    private static Node search(List<Node> nodeList, State state) {
    for ( Node node : nodeList )
    if ( state.equals(node.state) )
    return node;
    return null;
    }
    }


  2. #2
    Super Moderator jps's Avatar
    Join Date
    Jul 2012
    Posts
    2,642
    My Mood
    Daring
    Thanks
    90
    Thanked 263 Times in 232 Posts

    Default Re: hello ,have a good day all , i need some answers of these questions...

    Welcome sahin11
    Please see the Announcements page for the use of code tags when posting code to the forum.
    If you have some questions of your own, and not those of your assignment, please post them.

Similar Threads

  1. Today is a very good day and I'm in a good mood
    By AHefphern in forum The Cafe
    Replies: 0
    Last Post: May 15th, 2013, 03:10 AM
  2. eclipse interview questions and answers
    By saggammahesh in forum Java IDEs
    Replies: 1
    Last Post: April 17th, 2012, 02:07 AM
  3. Yes or No answers,
    By tyb97 in forum What's Wrong With My Code?
    Replies: 9
    Last Post: September 18th, 2011, 05:57 PM
  4. Is My answers correct??
    By Java.Coder() in forum What's Wrong With My Code?
    Replies: 6
    Last Post: December 28th, 2010, 06:22 AM
  5. Good Morning/Day/Afternoon/Evening/Night
    By K0209 in forum Member Introductions
    Replies: 3
    Last Post: January 4th, 2010, 11:26 AM