How I can make sure my code is keep running? hey I am running an optimization model in AMPL. It is huge model and I know it is gonna take a lot to be solved. How I can make sure my model keep running even when the screen become lucked? 
I did the following as well,

I installed coffeine and it is in enable mode.

I typed  caffeinate in terminal .

How I can make sure it is keeping running?
A simple way would be install a GUI app. A good one is KeepingYouAwake. This app is a GUI front-end to caffeinate command. It's very simple to install and configure, and keeps your computer from sleeping.

You can install it via Homebrew by running:

brew cask install keepingyouawake

If you don't have Homebrew installed, you can follow the instructions to install it on it's homepage:

https://brew.sh