Setup Instructions


General Setup

1) Obtain read/write permissions to access /ERL_devel by submitting a CLASSE IT service request.

2) Checkout a working copy of the injector optimization repository using the command:

svn co https://accserv.lepp.cornell.edu/svn/trunk/ERL_devel/inopt

This will add a directory call inopt to your workspace. You can also view the svn tree here:

https://accserv.lepp.cornell.edu/cgi-bin/view.cgi/trunk/ERL_devel/inopt

3) Checkout a working copy of the distgen particle generator using the command:

svn co https://accserv.lepp.cornell.edu/svn/trunk/ERL_devel/distgen/

This will add a directory called distgen to your workspace. Make sure to run the command "make"

4) Add GPT and Distgen to your PATH. This can be easily done by editing your bashrc file and adding the following lines:

export PATH="$PATH:/nfs/erl/online/sim/gpt310x64/bin/"

export PATH="$PATH:/home/el535/distgen/bin/"

(remember to replace /home/el535/ with your own path to your inopt copy.)

You should now be able to run GPT and Distgen as executables at the command line.

5) Obtain Python3. You can use any copy of Python3 as long as you add it to your PATH. Cbeta has an easily accessible installation of Python3.6 that can be used by adding the following lines to your bashrc file:

source /nfs/erl/online/opt/python3_SL7/setup_python3

source /opt/rh/rh-python36/enable

6) While in your bashrc file, you should also point python (via your PYTHONPATH) to the python code in the injector optimization by adding the line:

export PYTHONPATH=$PYTHONPATH:/home/el535/inopt/

(remember to replace /home/el535/ with your own path to your inopt copy.)

Setup Needed for every Injector

Note: * denotes the specific example you are working in

1)Change the var_param file in the "inopt/examples/*/optconf" directory. Located in the var_param file is a section of code labeled Problem Definition:

var param.JPG

You need to make sure that python_bin is the correct version of python that you obtained and that you change run_directory so that it points to the directory of *

2)In "inopt/examples/* ", open "test.*.eval.txt" and replace template_dir and temp_dir to your own directory.

test.dcgun.JPG

(remember to replace /home/el535/ with your own path to your inopt copy.)

Changing Parameters

Number of Generations

In "inopt/examples/*/optconf", open var_param. In the secion Variator Set-Up, there should a parameter called "maxgen" that deturmines the number of generations.

NumGen.JPG

Objectives, Constraints, Decisions

In "inopt/examples/*/optconf/docs", there will be example objective, constraints and decision files. The names of the files need to match what is inputed into var_param:var param.JPG

Note that the units used in these files are already definined in the Distgen.in or GPT.in files located in the "template" directiory or the func_eval.py file located in the specific example directory in which you are working.

For changing constraints/objectives, make sure to change the merit function "user_merit_fun(variables,data)" in func_eval.py in your working directory.

Adding Parameters

Change "number_decision_variables" in var_param to match the new number of decisions variables that you are using: NumGen.JPG

For adding constraints/objectives, make sure to add the parameters to the merit function "user_merit_fun(variables,data)" in func_eval.py in your working directory.

Running the Optimizer

1) Go to /inopt/examples/*. Start the optimization by running the command:

./how_to_run.txt

You should see the following output:

nohup: appending output to 'nohup.out'

2) If you want to see the progress of the optimization, run the command:

tail -f var_diag.log

Injector Optimization Home

Topic attachments
I Attachment Action Size DateSorted ascending Who Comment
NumGen.JPGJPG NumGen.JPG manage 14 K 03 Mar 2019 - 18:44 UnknownUser  
test.dcgun.JPGJPG test.dcgun.JPG manage 22 K 03 Mar 2019 - 18:44 UnknownUser  
var_param.JPGJPG var_param.JPG manage 32 K 03 Mar 2019 - 18:44 UnknownUser  
This topic: PhotocathodeBrightBeams/Private > WebHome > InjectorOptimization > GeneralSetup
Topic revision: 08 May 2019, el535
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding CLASSE Wiki? Send feedback