How to run smtLib file using Z3 on Ubuntu? - z3

For example I have a smtLib file 'encoding.smt'. Now I want to run this file by z3 (standalone exe) with a given timeout and memory allocation on a Ubuntu machine. Like :
$./z3 encoding.smt 240(sec) 6(GB)
I have downloaded ubuntu 32 bit zip file from Z3 download page. What I have to do now? There is a z3 application on the 'bin' folder. Shall I need to change any environment variable - if I want to write any Z3py script under Ubuntu ?
Can any one give me the steps for both (running .smt file by standalone Z3 with given timeout and memory and running .smt file from z3py script with given timeout and memory)
Thanks for your suggestion

These options are called timeout and memory_max_size respectively. In the python interface, they can be set as follows:
set_option(timeout='60')
set_option(memory_max_size='1000')
A list of (global and module) options can be obtained by running z3 -p. These options can also be set on the command line, e.g.,
z3 encoding.smt2 timeout=60 memory_max_size=1000

Related

How to set up Environment variable for using Jython in Weka

Instruction on how to set up Jython in weka, especially on setting Environment variable for accessing dataset files, made it clear and easy for windows user, but no information was given for Mac user.
I wonder how to set up Environment variable in Mac for Jython in weka to work.
Solution
After the installation of Jython and JFreeChart library from Weka Package manager;
go to home directory's terminal, enter nano .bash_profile
inside .bash_profile, add a line of code as below
export Weka_Data=User/Documents/Directory/Of/Your/Data
save and exit
inside terminal run source .bash_profile
Now, Environment variable for Jython in weka to access dataset is all set.

Erlang - Is it possible to make the messages that appear on erlang shell appear on linux shell too?

I have created a small test application and when on a linux machine I would like to see the messages that appear on the erlang shell to appear on the linux as well. I am not sure how it could be done, but is it possible?
I am running the application in detached mode(erlang shell).
EDIT:
I meant the message passing to the linux shell.
Example:
When I start my application using,
test application <start/stop>
I would get a message on the Linux shell Test Application has successfully started
But if I was like copying files, I would like the progress of the file copy to be displayed on the Linux shell like,
Copy successful. Number of files copied : 1
Copy successful. Number of files copied : 2
....
So is it possible to do the above using the message passing from Erlang to Linux?
I believe you can use some logger for this purposes. For example lager can redirect logs to several facilities at the same time, e.g. file and erlang console.
Other option is to use "run_erl", utility which comes with erlang distribution and allows "redirect the standard input and standard output streams so that all output can be logged".
Try erl -man run_erl or you can see can generate "release" with rebar, it will generate startup scripts which use "run_erl".

What Are Valid Characters In Jenkins Variable Names?

My build failed when I had a hyphen in a variable name but succeeded when I changed it to an underscore.
The error was this but I could see in the online Workspace browser that it was valid and as mentioned above it succeeded with an underscore!
15:55:25 + MY-DISTRO=/home/jenkins/workspace/build-prod/my-distro
15:55:25 /tmp/hudson6751264218812911564.sh: line 3: MY-DISTRO=/home/jenkins/workspace/build-prod/my-distro: No such file or directory
What are valid characters for Jenkins variables names and where is this documented?
Judging by the .sh extension of the temporary script in the log you pasted, I assume you used the Execute shell build step in Jenkins - so in this case "valid" variable names mean variables in a linux shell script (the exact shell type might vary based on local configuration) - see for example this thread about allowed names on linux.
In case you have a windows slave, and use the Execute Windows batch command build step, you would of course have to check rules for windows variable names.
Also note that variables used in other places as these and similar build steps could potentially follow completely different rules (though sometimes they overlap). For example: if a plugin uses the Token Macro Plugin for evaluating expressions, you would have to refer to environmental variables with ${ENV,var="VARIABLENAME"}.
Jenkins is java based. Most probably it accepts java variable convention. I suggest avoid using $ in variable names since unix based operating systems treat it differently.
What Atilla said, but avoid dots (.) as well.

How to change the version of python that pyscripter uses

I am a newb with python and just learning what to do.
I am using pyscripter and have been for a while whilst learning.
I am now going through an online course which is taught in 2.6, yet my pyscripter uses the latest.
I need to know how to change it to use an older version, I have seen replies about changing the PATH variable but not where it is or how to do it.
I have 3 versions of python on my machine, 25,26 and 33.
I don't know if this is the best way to do it, but those are the two ways I did it:
WAY 1 (The best of two)
Go to PyScripter>>Tools>>Options...>>Custom Parameters... and add the following values
1. PythonDir = C:\Program Files\CustomPythonInstallation
2. PythonExe = C:\Program Files\CustomPythonInstallation\python.exe
3. PythonVer = 3.3.3
Note: Adapt the Name = Value pairs above to your case.
And close the window with OK button.
Now select PyScripter>>Run>>Python Engine>>Remote and your are ready to go.
WAY 2 (The more temporary solution)
Go to PyScripter>>Run>>Configure External Run...
set the "Application:" field to your python.exe file
Close the window with OK button.
Make sure you run your scripts with PyScripter>>Run>>External Run (Alt+F9)
I hope this helped, good luck.
The easiest way I know (on Windows) is, having used the installer executable, I select from the Start menu's PyScripter folder whichever version of Python I want to run.
You can modify the PYTHONPATH (under Pyscripter>>Tools, for instance)
You can modify your External Python Interpreter with Pyscripter>>Modify Tools>>Python &Interpreter>>Modify
You can modify the default Python engine used with Pyscripter>>Options>>IDE Options>>Python Interpreter>>Python Engine Type
You can simply redirect Pyscripter to see the environment of a different Python distribution.
In Windows, do this by assigning PYTHONDLLPATH in the Pyscripter shortcut. You can r-click on the shortcut, access its properties and then set the target to:
[Pyscripter executable dir] --PYTHONDLLPATH [Python distribution dir]
See this image to help you out:
setting a shortcut target
For example, in my Win10 64-bit computer I have a Python 2.7.8 installation back from when I installed ArcGIS, which is automatically recognized by my 32-bit Pyscripter installation.
In the same computer, I also have Anaconda installed with two environments that feature two 64-bit Python distributions:
2.7.14 in "C:\ProgramData\Anaconda2"
3.6 in "C:\Users\bouzi\AppData\Local\conda\conda\envs\py3"
When I installed a 64-bit version of Pyscripter, that Pyscripter version couldn't even open, as it couldn't find the conda distributions. I had to point them to it by replacing the shortcut target to:
"C:\Program Files\PyScripterx64\PyScripter.exe" --PYTHONDLLPATH "C:\ProgramData\Anaconda2"
You can create three Pyscripter shortcuts that point to these different installations of Python within your system. It's probably not the optimal way to deal with this but it works, and allows you to combine Anaconda environments with Pyscripter.
You can also read more on opening non-standard python distributions with PyScripter from this link.
Run->Python Versions -> setup Python Versions -> Add... select folder
p.s.
python 3.7.3 - ok,
still python 3.10.5 could not be identified by PyScripter in such a way (actually works with WAY_1 Solution in this thread but pip install under such env. not succeed afterwards)

Install Z3 in Windows

I did download the file Z3 4.3.0 for Windows (64 bits) that is on site: http://z3.codeplex.com/releases.
When I try to run the file z3.exe which is in the bin folder. Prompt appears and disappears immediately. I needed to know how to run a file written in z3 through z3.exe file.
How can I do this? Or what is the best option to run z3 through Java?
z3.exe is a command line tool. To execute a SMT-LIB 2.0 file called file.smt2, you should execute the following command in the Command Prompt.
z3 file.smt2
If the directory containing z3.exe is not in your PATH environment variable, you will have to include the directory in the command above.
BTW, Z3 has not graphical user interface or environment. It is essentially a library for automated reasoning. z3.exe is a simple executable built using this library that allows us execute commands stored in a file.
You can also play with Z3 using the web interface available at rise4fun.
At rise4fun, we have a SMT-LIB front-end, and a Python based one.
Both of them have interactive tutorials.
Here are some useful resources to learn about SMT:
Z3 tutorial
Tutorial on SMT-LIB
Article describing SMT applications
SMT-Lib benchmarks
Stackoverflow: you can search Z3 related question by including [z3] in the search box.
Z3 has APIs for several programming languages: C, C++, .Net, Python and OCaml.
In the next release, we will also provide support for Java.
You can already play with the Java by using one of the nightly builds.
Go here for more information about Z3 nightly builds.
The nightly builds contain a Java example application using the Z3 API.

Resources