-2

I am working on a project where i need to run a code thousands of times with different arguments. like

 gringo some_random_SAT.lp --const n=i |clasp 0

Hhere I need to keep changing i to from say 1 to 500 and take the information that some_random_SAT.lp outputs, then I need to do the same for a c++ code that I have. Writing all the data to a file. My question is how to do this.

I am not asking for some one to tell me how to do it all, I just would like to know a good book or some where to learn how to do similar things such as this.

I am not attached to python if perl would work better i can do that.

Im running Linux if that makes any difference.

Hai Vu
  • 37,849
  • 11
  • 66
  • 93
Riemann-bitcoin.
  • 71
  • 1
  • 2
  • 11

1 Answers1

0

Write a simple bash script to do that for you.

You could use a for loop to repeat the command multiple times with i incrementing each time.

To fetch the output (I guess saving it in a text file would suffice?) you can pipe the output of each execution to a file or even to a seperate file for each execution.

For Loops in bash

How to fetch the output and use i in the file name (if you want each output in a different file)

ThatBrianDude
  • 2,952
  • 3
  • 16
  • 42