suresh_chinthy
suresh_chinthy

Reputation: 377

Output the solved time and date in minizinc with assert function

Imagine I have below code and it would output the assert statement since the condition is not met.

int: x =40;
var int:y;

constraint y=x;

Now imagine I am getting the value for x from a data file where user can enter any value from their end. But I am limiting user to enter only positive figures to x.(X cannot be negative figures).

constraint assert(x>=0,"Please enter a positive value to X");

solve satisfy;

Imagine user input -2 so it will output the above statement.I need to print the date and time with above statement.(At least time).Is there any method to do that in minizinc.

Upvotes: 0

Views: 597

Answers (1)

hakank
hakank

Reputation: 6854

(I'll convert my comment as an answer, so you can accept it if you want.)

There is no built-in function in MiniZinc for doing this. A suggestion is that you run this via a wrapper (e.g. the Python MiniZinc package, see below) to catch the error and then print date and time.

The Python MiniZinc package is here: https://minizinc-python.readthedocs.io/en/latest/getting_started.html

Upvotes: 2

Related Questions