-2

Please somebody help me with this error Thanks, i Using the JaCoP Library, It´s a transport Problem and i need find the OptimalSearch it's constraints programming

    Exception in thread "main" java.lang.NullPointerException
    at JaCoP.core.IntVar.singleton(IntVar.java:378)
    at JaCoP.core.IntVar.putModelConstraint(IntVar.java:301)
    at JaCoP.constraints.SumWeight.impose(SumWeight.java:301)
    at JaCoP.core.Store.impose(Store.java:851)
    at transporte.Transporte.model(Transporte.java:73)
    at transporte.Transporte.main(Transporte.java:86)
Java Result: 1

http://pastebin.com/ZV4j234S Example Class

http://pastebin.com/at7nfAwE Transport Class

vitaut
  • 49,672
  • 25
  • 199
  • 336
  • I'm not sure you will find somebody willing to go through almost 1,000 lines of code. Can't you post the relevant part of your code only? – assylias Feb 11 '13 at 15:04
  • Sorry man, Example it´s a Help Class the really implements class it's transport less code lines, i'm would thanks if you can help me. – carlosCeron Feb 11 '13 at 15:07
  • Check the SearchOptimal in the Example Class, and the model Method in the transport class, Thanks. – carlosCeron Feb 11 '13 at 15:09
  • According to the stacktrace `Transporte.java:73`, line 73 calls impose, but that's not true in the code you linked. – Geoffrey De Smet Feb 12 '13 at 11:23

1 Answers1

0

The Proble was solve with the correct instance of the variable cost Ex:

i write the code that:

IntVar cost = new IntVar(); <--- The Bad Instance IntVar cost = new IntVar(store, "Costo", 0, 10000); <-- The correct instance

0 and 10000 are variables and can change the values.