Skip to content

Inability to solve multiple constraints on value. #1165

@KrystilizeNevaDies

Description

@KrystilizeNevaDies

Describe the bug

Cannot resolve multiple constraints on a single symbol.

To Reproduce

Steps to reproduce the behavior:

        EvalEngine engine = EvalEngine.get();

        ISymbol t = F.symbol("t");

        IExpr constraintsExpr = F.Solve(
                F.And(
                        F.Greater(t, F.num(1.3)),
                        F.GreaterEqual(t, F.num(0)),
                        F.LessEqual(t, F.num(1))
                ),
                F.List(t)
        );

        System.out.println("Constraints: " + constraintsExpr);
        System.out.println("Solved Constraints: " + engine.evaluate(constraintsExpr));

And the output:

Constraints: Solve(t>1.3&&t>=0.0&&t<=1.0,{t})
Solve: The system cannot be solved with the methods available to Solve.
Solved Constraints: Solve(t>1.3&&t>=0.0&&t<=1.0,{t})

Expected behavior

Successful Solve (t can be proved to be in impossible bounds, even without knowing the exact value of t beforehand)

Expected (correct) result expression:

Constraints: Solve(t>1.3&&t>=0.0&&t<=1.0,{t})
Solved Constraints: False

Java

  • Version [e.g. Java 21]
  • OS [Windows 10]

I'm very new to symbolic math engines so it's very possible that I made an obvious and/or dumb error. I did try to use IExpr t = F.Element(F.symbol("t"), F.Reals); but there was another error so I'm not sure if that is the correct path.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions