Error when using "solve;" command

Good afternoon,

Hello, I am currently having issues with ampl “solve” command. I am constantly getting an error when I am executing “solve” command, and it leads me to can’t open /private….(I attached a screenshot of the error message. I am not sure if it because of the file issue or some technical issues. I already spoke to my professor about this issue, and he has never seen this kind of error. Is there any advice that you can give me to fix this issue?


1 Like

When the solve command is executed, AMPL writes a problem file to the system temporary directory; then it hands off execution to the solver, which reads the file.

The error message you’re seeing says that AMPL was unable to write its problem file ( to the system temporary directory (/private/tmp/PKInstallSandbox.by2gbl/tmp/) on your computer. The reason could be that that directory doesn’t exist, or that you don’t have write permission for it.

To get around this problem, you can set the AMPL option TMPDIR to a directory that you know you can write; this will override the system temporary directory setting. For example, the following works on a lot of systems:

option TMPDIR '/tmp/';

Or, you can write temporary files to the same directory where AMPL is running, with the following setting:

option TMPDIR '.';

For a complete description, see the TMPDIR entry on the AMPL Options page.