how to execute a jacop?

Hi fnds,do anybody know how to execute the java constraint program in netbeans 6.8? i searched in google but i could not find out..

Replies

  • Manish Goyal
    Manish Goyal
    Sory didn't get you
    what do you mean by java constraint program?
  • Reya
    Reya
    The constraint programming approach is to search for the values of all the unknown variables in which the large no of constraints should be satisfied at the same time.JaCoP library provides
    the constraint programming implemeted in java..And so it is called as java constraint program.
  • Manish Goyal
    Manish Goyal
    have you set the class path?
  • Reya
    Reya
    what for class path here?do v have to mention the class path in netbeans?
  • Reya
    Reya
    I have included the JaCoP library in netbeans..But still i get the error in the first line(import JaCoP -3.0-RC1.*; )of my prog.
  • Manish Goyal
    Manish Goyal
    Tell me exactly the error message it is showing ,if it is showing message like

    package doesnot exist then I think there is problem related to classpath otherwise there may be some syntax related problem

    Try this
    import JaCop.*;
    or import JaCop.core.*;
  • Reya
    Reya
    i didnt get the error as package doesnt exists..

    import JaCoP-3.0-RC1.*;
    import java.util.*;
    public class Main {
    static Main m = new Main ();
    public static void main (String[] args) {
    FDstore store = new FDstore(); // define FD store
    int size = 4;
    // define FDVs
    FDV[] v = new FDV[size];
    for (int i=0; i v = new FDV(store, "v"+i, 1, size);
    // define constraints
    store.impose( new XneqY(v[0], v[1]) );
    store.impose( new XneqY(v[0], v[2]) );
    store.impose( new XneqY(v[1], v[2]) );
    store.impose( new XneqY(v[1], v[3]) );
    store.impose( new XneqY(v[2], v[3]) );
    // search for a solution and print results
    ArrayList list = new ArrayList();
    for(FDV var : v) list.add(var);
    boolean result = Solver.searchOne(store, list, new SearchOne(),new IndomainMin(), new Delete());
    if ( result )
    System.out.println("Solution: " + list + "\n*** Yes");
    else
    System.out.println("*** No");
    }
    }

    error message:

    E:\Documents and Settings\SSN\My Documents\NetBeansProjects\JavaApplication15\src\javaapplication15\Main.java:8: '.' expected
    import JaCoP-3.0-RC1.*;
    E:\Documents and Settings\SSN\My Documents\NetBeansProjects\JavaApplication15\src\javaapplication15\Main.java:8: expected
    import JaCoP-3.0-RC1.*;
    2 errors
    E:\Documents and Settings\SSN\My Documents\NetBeansProjects\JavaApplication15\nbproject\build-impl.xml:413: The following error occurred while executing this line:
    E:\Documents and Settings\SSN\My Documents\NetBeansProjects\JavaApplication15\nbproject\build-impl.xml:199: Compile failed; see the compiler error output for details.
    BUILD FAILED (total time: 0 seconds)

    where that dot should come in the first statement?i could not recognise..
  • Reya
    Reya
    can anyone help me?
  • Manish Goyal
    Manish Goyal
    I don't have any idea about syntax and classes of JaCop library

    So i picked a program from net and it is working fine on my PC
    check whether the code that i given below is working fine or not

    if not then the problem is with class path

    import JaCoP.core.*; 
    import JaCoP.constraints.*; 
    import JaCoP.search.*; 
     
    public class Main { 
     
        static Main m = new Main (); 
     
        public static void main (String[] args) { 
            Store store = new Store();  // define FD store 
            int size = 4; 
            // define finite domain variables 
            IntVar[] v = new IntVar[size]; 
            for (int i=0; i search = new DepthFirstSearch(); 
            SelectChoicePoint select = 
                new InputOrderSelect(store, v, 
                                             new IndomainMin()); 
            boolean result = search.labeling(store, select); 
     
            if ( result ) 
                System.out.println("Solution: " + v[0]+", "+v[1] +", "+ 
                                                  v[2] +", "+v[3]); 
            else 
                System.out.println("*** No"); 
        } 
    }            T
  • Reya
    Reya
    working perfectly😀thank u so much dear😀

You are reading an archived discussion.

Related Posts

Hi all, The name is Rao, Pavan Rao. I'm a Production Engineer by graduation but a Software QA Test engineer by profession. Don't ask how I got there. It's a...
I have a HTC Desire handset obtained from Europe recently through a friend. The device is an original and has not been modded / broken in any manner. I also...
larceny (n): Theft; robbery The strict legal definition of larceny is theft without breaking in, or without the use of force. Grand larceny is major theft. To be larcenous is...
malapropism (n): Humorous misuse of a word that sounds similar to the word intended but has a ludicrously different meaning In Richard Sheridan's 1775 play. The Rivals, a character named...
newfangled (adj): new, untested nirvana (n): A blissful, painless, worry free state According to Buddhist theology, you reach nirvana once you have purged your soul of hatred, passion, and self-delusion....