Giter VIP home page Giter VIP logo

Comments (4)

cyderize avatar cyderize commented on May 28, 2024

Hi,

Ah yes, the timeout is a mistake in the documentation, it should be 'time-limit': 10000.
The other problem with num-solutions is a bug in the upstream MiniZInc/libminizinc built-in interface to Gecode.

I will push some fixes for these shortly.

As a workaround for now, you can use:

const model = new MiniZinc.Model();
model.addFile('test.mzn', 'var 1..3: x;');
const solve = model.solve({
  options: {
    'time-limit': 10000, // timeout was a typo in the docs
    '-n': 100, // num-solutions should work in the next version of MiniZinc
    solver: 'gecode'
  }
});
solve.on('solution', solution => {
  console.log(solution.output.json);
});
solve.then(result => {
  console.log(result.status);
});

With regards to the lack of an error message, that's because this particular error seems to get printed to stderr rather than a proper message (I'll see if I can fix that too).

It may be useful to do

solve.on('stderr', console.log);

So that any stderr output is visible in the browser console.

from minizinc-js.

volisoft avatar volisoft commented on May 28, 2024

Thank you for your response. I can confirm that the workaround parameters are accepted by the solver.
Output from "stderr" is especially helpful.

Just one note, it seems like the time limit parameter is not respected. When I run complex model with short time limit (I tried a range from 5 to 10000) solver runs until completion disregarding the time limit.

from minizinc-js.

cyderize avatar cyderize commented on May 28, 2024

As far as I can tell, the time limit does seem to be respected at least by Gecode, Chuffed and HiGHS.

For example, see this playground with 'time-limit': 5000.

CBC does seem like it's not actually stopping though - I'll have a look at that and see if I can figure out what's going on.

from minizinc-js.

volisoft avatar volisoft commented on May 28, 2024

Confirmed, time-limit is respected. There was an issue in my code. Thank you for your help!

from minizinc-js.

Related Issues (2)

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.