A full, stochastic analysis of the Generic Fuel Cycle Resource Exchange formulation
Python C++ Other
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.



A stochastic analysis framework for supported problems, originally used to analyze the Generic Fuel Cycle Resource Exchange formulation in Cyclus. Both local execution and remote execution via HTCondor are supported.

Cyclopts utilizes its Python layer to generate the run-control parameters for a given Cyclus resource exchange. It's C++ layer makes the corresponding calls to Cyclus to instantiate and execute the exchange. The Python-C++ communication is made possible by using xdress to generate Cython wrappers from the C++ source code. Pretty neat!

You can find the full documentation at mattgidden.com/cyclopts.



Cyclopts has the following dependencies:

  1. CMake (>= 2.8.5)
  2. HDF5
  3. Cyclus (1.0)
  4. CDE
  5. Python 2.7
  6. NumPy (>= 1.8.0)
  7. SciPy
  8. Cython (>= 0.19.1)
  9. PyTables
  10. PyNE

Additionally, building the documentation requires:

  1. Sphinx
  2. SciSphinx

Install Command

With its dependencies installed, Cyclopts can be installed as any other python package.

For installing in system space:

$ python setup.py install

For installing in user space:

$ python setup.py install --user

Building the Docsumentation

Building the documentation is easy

$ cd docs && make html

You can then view them by pointing your favorite browser at docs/build/html/index.html.

Publishing Documentation

To publish updated the docs, you must have a local copy of gidden.github.io and push rights to the repo on github. It's likely that you don't!

If you do, however, its as easy as

$ cd docs && make html && make publish

Basic Workflow Strategy

For a given exchange, all parameters and values are defined in the Python layer using POD, STL containers, or simple structs. The C++ layer is responsible for translating those data into a Cyclus exchange graph and solver, executing the solve, and dumping graph and solution data to an output database using the tools available in Cyclus. The python layer will manage which database is actually written to (i.e., whether to write to a new database or add to an existing one). The python layer can then manage any analysis as required on the database(s).


Implementation differences w.r.t. the Cyclus Exchange Graph

  • default capacity constraint values are added at the end of the respective constrait coefficient and rhs value lists

Adding C++ Files

Adding *.h/*.cc files takes a number of steps in order to hook them into the xdress workflow.

This mini-tutorial assumes that you have some header/implementation file pair, mycpp.h and mycpp.cc. Of course start off by git add ing them. The CMakeLists.txt file in cyclopts/cpp will automatically add them to the build system.

Next, update xdressrc.py. If there is a class definition in mycpp*, then add a line to the classes array, e.g., apiname('MyClass', 'cpp/mycpp.*', incfiles='mycpp.h'). If there are external functions defined, then add a line to the functions array.

Run xdress in the cyclopts project directory. A number of *.pxd and *.pyx files will be generated; git add them.

Next, inform the Python-portion of the build system that a new module should be compiled. For the mycpp example, the following lines would be added to the end of the CMakeLists.txt file in cyclopts/cyclopts.

# mycpp
                            PROPERTIES CYTHON_IS_CXX TRUE)
cython_add_module(mycpp mycpp.pyx ${CYCLOPTS_SRC})
target_link_libraries(mycpp dl ${LIBS})

mycpp will now compile as a module of the cyclopts package when you run setup.py. For example, you can grab an instance of MyClass:

# mycpp
from cyclopts.mycpp import MyClass

inst = MyClass()

Remote Connections

Remote connections use the Paramiko library and automatically looks for the following private keys in ~/.ssh/: id_rsa and chtckey. If either has no password, remote launching of Cyclopts jobs can be accomplished.