3

Imagine I ran a .mzn with .dzn and got an output in IDE as follows:

Supplier01,100,100,100,100,100,100,100,100,100,100,100,100
Supplier02,200,200,200,200,200,200,200,200,200,200,200,200
Supplier03,40,49,359,834,1067,1377,334,516,761,1001,1251,1583
Supplier04,500,500,500,500,500,500,500,500,500,500,500,500
Supplier05,161,200,200,200,200,200,200,200,200,200,200,200
Supplier06,500,500,500,500,500,500,500,500,500,500,500,500
----------
==========

Is there any way that I can generate this output in a .txt or .csv file in a preferred location on my computer? I know that we can perform this in command prompt, but is there any way we can do using the IDE it self?

Dekker1
  • 5,565
  • 25
  • 33
suresh_chinthy
  • 377
  • 2
  • 12

1 Answers1

2

The MiniZinc IDE currently does not include functionality to export solutions for other applications.

The current expectation is that if you want to integrate MiniZinc with other applications that you would use something like MiniZinc Python, iMiniZinc, or the command line tools, to facilitate the connection. In your case using MiniZinc Python or iMiniZinc might be a good solution since Python can generate csv files using the csv module. If you want to see and interact with the solution as well as outputting the csv file, then iMiniZinc can provide the right tooling in Jupyter Notebook to do both.

If you are very happy with the MiniZinc IDE and you want to continue using it, then the other option would to just minimize the inconvenience. Your output statement already provides the solution in csv style. So the only remaining part is making the file. The MiniZinc IDE can open .csv files. So my suggestion would in this case be to create an empty .csv file, open it in the IDE. Once you get the solution from your instance in the output window, then you copy directly into the file.

Dekker1
  • 5,565
  • 25
  • 33
  • I wrote quite a lot of documentation with examples on the usage of MiniZinc Python: https://minizinc-python.readthedocs.io/en/latest/. It should be relatively straightforward to combine this with the CSV package in Python: https://docs.python.org/3/library/csv.html. If you want to use MiniZinc from the command line, then you should read through the documentation here: https://www.minizinc.org/doc-2.4.3/en/command_line.html – Dekker1 Apr 21 '20 at 00:23