This is my arithmetic inequality expression in prolog:
2*X + 3*Y > 4*Z
I used the unity term manipulator like this:
Expr =.. [Op, Lhs, Rhs]
And now I have Lhs = 2*X + 3*Y, Rhs as 4*Z and Op as >
Everything fine till now.
What I want is to construct a delayed goal using the IC library in Eclipse Prolog for this expression.
Example, I want a newly created variable to assigned like this:
Eq = (Lhs #Op Rhs) %meaning, Eq = (2*X + 3*Y #> 4*Z)
Now, since the required inequality (in this case >), is stored in Op, though I use Eq = (Lhs #Op Rhs), eclipse is returning error.
How do i create this delayed constraint, when my operator is to be taken from the variable Op?
Thank You.
You could use facts to define the relations:
Or use
concat_atom/2:E.g.:
Note that this only works for the basic equality/inequality operators. You cannot add
#to just any operator and expect it to work as a constraint!