|
View:
New views
8 Messages
—
Rating Filter:
Alert me
|
|
|
UnboundLeafException for a relation that is in the Bounds objectDear Users,
I am working with Kodkod and I create Bounds and Constraints dynamically at runtime. I get an UnboundLeafException for a relation, that is in the Bounds object. I checked this with the bounds.relations() function. Do you have any suggestions why I nevertheless get this Exception ? It's not easy to add a Code Example, because it is a long piece of code. Thanks and Regards Christian |
|
|
Re: UnboundLeafException for a relation that is in the Bounds objectOn Wed, 14 May 2008, chrissoalloyuser wrote:
> > I am working with Kodkod and I create Bounds and Constraints > dynamically at runtime. I get an UnboundLeafException for a relation, > that is in the Bounds object. I checked this with the > bounds.relations() function. Do you have any suggestions why I > nevertheless get this Exception ? > > It's not easy to add a Code Example, because it is a long piece of code. > Thanks and Regards > Christian UnboundLeafException should only occur if you forget to add the relation to the Bounds you are using. If you suspect there is a bug, please email the complete code to Emina Torlak (emina AT mit.edu) Sincerely, Felix Chang Alloy4 Developer |
|
|
Re: UnboundLeafException for a relation that is in the Bounds objectDear Chris,
This should not be happening if all of your relations are bound properly. However, I can't tell why you are getting the exception without seeing the code. Can you try reducing your example to a small test case that demonstrates the bug? Sincerely, Emina On May 14, 2008, at 1:17 PM, chrissoalloyuser wrote: > Dear Users, > > I am working with Kodkod and I create Bounds and Constraints > dynamically at runtime. I get an UnboundLeafException for a relation, > that is in the Bounds object. I checked this with the > bounds.relations() function. Do you have any suggestions why I > nevertheless get this Exception ? > > It's not easy to add a Code Example, because it is a long piece of > code. > > Thanks and Regards > Christian > > > |
|
|
Re: UnboundLeafException for a relation that is in the Bounds objectDear Emina,
well, I will try to isolate the problem to a small example. I assume that it has something to do with the way i am adding all the relations into a map. Normally you define the relations as "final", but in my application i can not do that. Maybe it has something to do with it. Regards Christian --- In alloy-discuss@..., Emina Torlak <emina@...> wrote: > > Dear Chris, > > This should not be happening if all of your relations are bound > properly. However, I can't tell why you are getting the exception > without seeing the code. Can you try reducing your example to a > small test case that demonstrates the bug? > > Sincerely, > Emina > > > On May 14, 2008, at 1:17 PM, chrissoalloyuser wrote: > > > Dear Users, > > > > I am working with Kodkod and I create Bounds and Constraints > > dynamically at runtime. I get an UnboundLeafException for a relation, > > that is in the Bounds object. I checked this with the > > bounds.relations() function. Do you have any suggestions why I > > nevertheless get this Exception ? > > > > It's not easy to add a Code Example, because it is a long piece of > > code. > > > > Thanks and Regards > > Christian > > > > > > > |
|
|
Re: Re: UnboundLeafException for a relation that is in the Bounds objectDear Chris,
If you cannot isolate the problem, you can send me the entire program. Sincerely, Emina On May 14, 2008, at 2:32 PM, chrissoalloyuser wrote: > Dear Emina, > > well, I will try to isolate the problem to a small example. I assume > that it has something to do with the way i am adding all the relations > into a map. > Normally you define the relations as "final", but in my application i > can not do that. Maybe it has something to do with it. > > Regards > Christian > > --- In alloy-discuss@..., Emina Torlak <emina@...> wrote: > > > > Dear Chris, > > > > This should not be happening if all of your relations are bound > > properly. However, I can't tell why you are getting the exception > > without seeing the code. Can you try reducing your example to a > > small test case that demonstrates the bug? > > > > Sincerely, > > Emina > > > > > > On May 14, 2008, at 1:17 PM, chrissoalloyuser wrote: > > > > > Dear Users, > > > > > > I am working with Kodkod and I create Bounds and Constraints > > > dynamically at runtime. I get an UnboundLeafException for a > relation, > > > that is in the Bounds object. I checked this with the > > > bounds.relations() function. Do you have any suggestions why I > > > nevertheless get this Exception ? > > > > > > It's not easy to add a Code Example, because it is a long piece of > > > code. > > > > > > Thanks and Regards > > > Christian > > > > > > > > > > > > > > |
|
|
Re: UnboundLeafException for a relation that is in the Bounds objectDear Emina,
thanks for your offering, but I think I found the problem. I searched at the wrong place the whole time. The problem occurred because of duplicated constraints. Accidentally i invoked the following code 2 times. for(Iterator<EClass> CLASS_ITER = superTypes.iterator(); CLASS_ITER.hasNext();) { EClass currentSuperClass = CLASS_ITER.next(); Formula newFormula = relations.get(currentEClass.getName()).in(relations.get(currentSuperClas\ s.getName())); //System.out.println("Problem Formula: " + newFormula.toString()); plmConstraints.add(newFormula); } I use the EMF reflection API to retrieve all Supertypes of a class, and add the corresponding kodkod constraints. At the end I use kodkod.util.nodes.Nodes.and(...) to combine all Formualas and give it to the solver. I did not know, that duplicate Formulas can create an exception. Maybe here is something wrong ? Regards Christian --- In alloy-discuss@..., Emina Torlak <emina@...> wrote: > > Dear Chris, > > If you cannot isolate the problem, you can send me the entire program. > > Sincerely, > Emina > > On May 14, 2008, at 2:32 PM, chrissoalloyuser wrote: > > > Dear Emina, > > > > well, I will try to isolate the problem to a small example. I assume > > that it has something to do with the way i am adding all the > > into a map. > > Normally you define the relations as "final", but in my application i > > can not do that. Maybe it has something to do with it. > > > > Regards > > Christian > > > > --- In alloy-discuss@..., Emina Torlak emina@ wrote: > > > > > > Dear Chris, > > > > > > This should not be happening if all of your relations are bound > > > properly. However, I can't tell why you are getting the exception > > > without seeing the code. Can you try reducing your example to a > > > small test case that demonstrates the bug? > > > > > > Sincerely, > > > Emina > > > > > > > > > On May 14, 2008, at 1:17 PM, chrissoalloyuser wrote: > > > > > > > Dear Users, > > > > > > > > I am working with Kodkod and I create Bounds and Constraints > > > > dynamically at runtime. I get an UnboundLeafException for a > > relation, > > > > that is in the Bounds object. I checked this with the > > > > bounds.relations() function. Do you have any suggestions why I > > > > nevertheless get this Exception ? > > > > > > > > It's not easy to add a Code Example, because it is a long piece > > > > code. > > > > > > > > Thanks and Regards > > > > Christian > > > > > > > > > > > > > > > > > > > > > > |
|
|
Re: Re: UnboundLeafException for a relation that is in the Bounds objectDear Chris,
I'm glad you found the source of the problem, but there is probably something else going on there as well. A duplicated constraint will not cause an exception. For example, you can replace the line final Solution sol = solver.solve(show, model.bounds(m,p)); in examples.CeilingsAndFloors with the line final Solution sol = solver.solve(Nodes.and(show, show, show), model.bounds(m,p)); and everything will work as before (despite the "show" formula being repeated 3 times). Sincerely, Emina On May 14, 2008, at 3:48 PM, chrissoalloyuser wrote: > Dear Emina, > thanks for your offering, but I think I found the problem. > I searched at the wrong place the whole time. The problem occurred > because of duplicated constraints. > Accidentally i invoked the following code 2 times. > > for(Iterator<EClass> CLASS_ITER = superTypes.iterator(); > CLASS_ITER.hasNext();) { > EClass currentSuperClass = CLASS_ITER.next(); > Formula newFormula = relations.get > (currentEClass.getName()).in(relations.get(currentSuperClass.getName > ())); > //System.out.println("Problem Formula: " + > newFormula.toString()); plmConstraints.add > (newFormula); > } > I use the EMF reflection API to retrieve all Supertypes of a class, > and add the corresponding kodkod constraints. At the end I use > kodkod.util.nodes.Nodes.and(...) to combine all Formualas and give > it to the solver. > > I did not know, that duplicate Formulas can create an exception. > Maybe here is something wrong ? > > Regards > Christian > > --- In alloy-discuss@..., Emina Torlak <emina@...> wrote: > > > > Dear Chris, > > > > If you cannot isolate the problem, you can send me the entire > program. > > > > Sincerely, > > Emina > > > > On May 14, 2008, at 2:32 PM, chrissoalloyuser wrote: > > > > > Dear Emina, > > > > > > well, I will try to isolate the problem to a small example. I > assume > > > that it has something to do with the way i am adding all the > relations > > > into a map. > > > Normally you define the relations as "final", but in my > application i > > > can not do that. Maybe it has something to do with it. > > > > > > Regards > > > Christian > > > > > > --- In alloy-discuss@..., Emina Torlak emina@ wrote: > > > > > > > > Dear Chris, > > > > > > > > This should not be happening if all of your relations are bound > > > > properly. However, I can't tell why you are getting the > exception > > > > without seeing the code. Can you try reducing your example to a > > > > small test case that demonstrates the bug? > > > > > > > > Sincerely, > > > > Emina > > > > > > > > > > > > On May 14, 2008, at 1:17 PM, chrissoalloyuser wrote: > > > > > > > > > Dear Users, > > > > > > > > > > I am working with Kodkod and I create Bounds and Constraints > > > > > dynamically at runtime. I get an UnboundLeafException for a > > > relation, > > > > > that is in the Bounds object. I checked this with the > > > > > bounds.relations() function. Do you have any suggestions why I > > > > > nevertheless get this Exception ? > > > > > > > > > > It's not easy to add a Code Example, because it is a long > piece of > > > > > code. > > > > > > > > > > Thanks and Regards > > > > > Christian > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > |
|
|
Re: UnboundLeafException for a relation that is in the Bounds objectDear Emina,
you are right. I found out, that i have accidentally invoked the method, which adds all the relations to the Map, two times :( That makes abolutely sense. Well, so there is no bug in the Kodkod API ;-) Regards Christian --- In alloy-discuss@..., Emina Torlak <emina@...> wrote: > > Dear Chris, > > I'm glad you found the source of the problem, but there is probably > something else going on there as well. A duplicated constraint will > not cause an exception. For example, you can replace the line > > final Solution sol = solver.solve(show, model.bounds(m,p)); > > in examples.CeilingsAndFloors with the line > > final Solution sol = solver.solve(Nodes.and(show, show, show), > model.bounds(m,p)); > > and everything will work as before (despite the "show" formula being > repeated 3 times). > > Sincerely, > Emina > > On May 14, 2008, at 3:48 PM, chrissoalloyuser wrote: > > > Dear Emina, > > thanks for your offering, but I think I found the problem. > > I searched at the wrong place the whole time. The problem occurred > > because of duplicated constraints. > > Accidentally i invoked the following code 2 times. > > > > for(Iterator<EClass> CLASS_ITER = superTypes.iterator(); > > CLASS_ITER.hasNext();) { > > EClass currentSuperClass = CLASS_ITER.next(); > > Formula newFormula = relations.get > > (currentEClass.getName()).in(relations.get(currentSuperClass.getName > > ())); > > //System.out.println("Problem Formula: " + > > newFormula.toString()); plmConstraints.add > > (newFormula); > > } > > I use the EMF reflection API to retrieve all Supertypes of a class, > > and add the corresponding kodkod constraints. At the end I use > > kodkod.util.nodes.Nodes.and(...) to combine all Formualas and give > > it to the solver. > > > > I did not know, that duplicate Formulas can create an exception. > > Maybe here is something wrong ? > > > > Regards > > Christian > > > > --- In alloy-discuss@..., Emina Torlak <emina@> wrote: > > > > > > Dear Chris, > > > > > > If you cannot isolate the problem, you can send me the entire > > program. > > > > > > Sincerely, > > > Emina > > > > > > On May 14, 2008, at 2:32 PM, chrissoalloyuser wrote: > > > > > > > Dear Emina, > > > > > > > > well, I will try to isolate the problem to a small example. I > > assume > > > > that it has something to do with the way i am adding all the > > relations > > > > into a map. > > > > Normally you define the relations as "final", but in my > > application i > > > > can not do that. Maybe it has something to do with it. > > > > > > > > Regards > > > > Christian > > > > > > > > --- In alloy-discuss@..., Emina Torlak emina@ wrote: > > > > > > > > > > Dear Chris, > > > > > > > > > > This should not be happening if all of your relations are bound > > > > > properly. However, I can't tell why you are getting the > > exception > > > > > without seeing the code. Can you try reducing your example to a > > > > > small test case that demonstrates the bug? > > > > > > > > > > Sincerely, > > > > > Emina > > > > > > > > > > > > > > > On May 14, 2008, at 1:17 PM, chrissoalloyuser wrote: > > > > > > > > > > > Dear Users, > > > > > > > > > > > > I am working with Kodkod and I create Bounds and Constraints > > > > > > dynamically at runtime. I get an UnboundLeafException for a > > > > relation, > > > > > > that is in the Bounds object. I checked this with the > > > > > > bounds.relations() function. Do you have any suggestions why I > > > > > > nevertheless get this Exception ? > > > > > > > > > > > > It's not easy to add a Code Example, because it is a long > > piece of > > > > > > code. > > > > > > > > > > > > Thanks and Regards > > > > > > Christian > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > |
| Free Forum Powered by Nabble | Forum Help |