Code Monkey home page Code Monkey logo

solverl's Issues

MinizincSolver.solve_sync errors out with `--verbose` extra flags

In the process of trying to debug why I couldn't get MiniZinc to produce results for me, I enabled the --verbose extra flag for MinizincSolver.solve_sync/4.

The reason this seems to be failing is because eventually the MinizincModel.model_info/2 tries to decode the mzn_output with Jason, but fails to do so because the --verbose flag(s) will add extra output that makes the data no longer decodeable.

What's your take on how this should be handled by solverl?

Question: failing to find solutions when run via `solverl`, but finding solutions within 200ms through CLI or IDE

Thank you for the work put into this library! This is not an issue per-se, so please close and redirect me elsewhere if you'd be willing to discuss this question elsewhere but not here.

I just started using both MiniZinc and solverl, and I'm having a hard time understanding the following:

My model is capable of finding at least one solution within some hundreds of milliseconds when I either use the MiniZinc IDE or the minizinc CLI tool, but when I run the exact same model with the exact same data through MinizincSolver.solve_sync/4, I end up getting no solutions until I hit a timeout (in my tests, 10-30 seconds).

I'm using the default solver for solverl (MinizincSolver.solve_sync(@minizinc_model_path, data, time_limit: 10 * 1000) which I've read is Gecode. For the CLI, I specificy that explicitly: minizinc --solver Gecode model.mzn data.dzn. Specifying the model explicitly for solverl also seems to have no effect.

Is there something that solverl does that requires significantly more time to perform the same task as the CLI or IDE, or am I missing some configuration that I should enable?

Or, perhaps the root question really is: how can I best ensure that what solverl does is 1:1 what the CLI tool does?

See the full output of a run through solverl:

{:ok,
 %{
   compilation_info: %{
     compilation_timestamp: ~U[2023-10-31 08:40:55.570868Z],
     compiled: true,
     fzn_output: "\n% Generated FlatZinc statistics:",
     fzn_stats: %{
       evaluatedReifiedConstraints: 70,
       flatBoolConstraints: 35,
       flatBoolVars: 70,
       flatIntConstraints: 161,
       flatIntVars: 74,
       flatTime: 0.0697168,
       method: "minimize",
       paths: 0
     }
   },
   solutions: [],
   summary: %{
     compilation_timestamp: ~U[2023-10-31 08:40:55.570868Z],
     compiled: true,
     exit_reason: :normal,
     fzn_output: "\n% Generated FlatZinc statistics:",
     fzn_stats: %{
       evaluatedReifiedConstraints: 70,
       flatBoolConstraints: 35,
       flatBoolVars: 70,
       flatIntConstraints: 161,
       flatIntVars: 74,
       flatTime: 0.0697168,
       method: "minimize",
       paths: 0
     },
     last_solution: %{data: %{}, index: 0, stats: %{}, timestamp: nil},
     minizinc_stderr: "",
     model_info: [
       model_file: "/var/folders/00/5gvc3ynn52j41yl126dv6tch0000gq/T/tmp.XX9XxzJE.mzn",
       globals: [],
       has_output_item: true,
       included_files: [],
       pars: %{},
       method: :minimize,
       vars: %{"days" => %{"dim" => 2, "type" => "int"}},
       type: "interface"
     ],
     solution_count: 0,
     solver: "org.gecode.gecode",
     solver_stats: %{
       failures: 1654407,
       initTime: 0.018027,
       nSolutions: 0,
       nodes: 3308827,
       peakDepth: 41,
       propagations: 74521316,
       propagators: 169,
       restarts: 0,
       solutions: 0,
       solveTime: 9.91307,
       variables: 144
     },
     status: :unknown,
     time_elapsed: "10.07 s"
   }
 }}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.