Optimal Power Pacing
The Optimal Cycling Project is a new & open source software program that provides the most sophisticated power pacing optimization for cyclists in time trial type races. It takes in the course profile of a race, the critical power curve of the cyclist, along with many other environment conditions and is able to consistently and efficiently generate the optimal power output of a cyclist.
A frequently asked question by time trialists and triathletes is how to correctly pace in a race to obtain the best possible time. The Optimal Cycling Project enables detail oriented athletes, coaches, and researchers to understand and help verify how to pace using power in a consistent and systematic way. It enables one to more quickly understand a race course before setting foot on it and to help demystify pacing.
The current version is Optimal Cycling V0.9.1 and is a cross-platform command line tool shown above. A graphical user interface is in development. You can view the current source code for the project online at http://code.google.com/p/optimalcycling/source/browse/#svn%2Ftrunk.
Some Examples of What It Can Do
What Sets the Optimal Cycling Project Apart
The key thing that sets the Optimal Cycling Project apart is that it pays attention to details. For example, whereas many previous papers and attempts at power pacing assumed steady state power and no acceleration, the Optimal Cycling Project does not make these assumptions that can adversely affect the results. Optimal Cycling generates the optimal power output WITH varying power AND acceleration throughout, as well as taking into account things such as hills and wind. The coding and math are much harder when such details are taken into account, but the end result is a more realistic and accurate answer. Optimal Cycling also enables you to create power optimizations for detailed courses, even if you want hundred or thousands of points in your simulation. This means that you can optimize power down to a course resolution of 10 or even 5 metres.
To optimize the power output, we have to use a suitable power metric that provides realistic results. A new & unique algorithm named CCAP (stands for Change Corrected Average Power) was the result of this effort. It takes into account the non-linearity of the effort required from high power outputs and also the power rate of the result. A new & unique algorithm was required to be developed because there were shortcomings in common power metrics, such as average power and general mean type metrics (like Normalized Power) where they could produce chaotic spikes in power.
To read more detailed information about the CCAP algorithm, please see http://optimalcycling.com/power-pacing/power-metrics/. More will be written about the power metric algorithms in the near future.
Another way that the Optimal Cycling Project raises the bar is that it is scalable and efficient. The core logic of Optimal Cycling is written in OpenCL, which enables it to run on multicore/GPGPU systems with relative ease. The algorithms used are optimized for parallel processing and speed since generating an optimal power output can be a very compute intensive task that can take hours for detailed simulations.
The solver in Optimal Cycling is a custom written version of differential evolution and the algorithm is modified with smoothing operators for much faster and consistent convergence. Many different function minimization methods were tested to arrive at the current algorithm. They include simulated annealing, particle swarming, Nelder-Mead, quasi-Newton, and genetic algorithms. The current solver has been tested up to 10,000 points on a single course.
Optimal Cycling is built using a combination of C# (.NET/Mono) and OpenCL. C# is used for the file I/O because it is easy to code in and it is cross platform thanks to the .NET framework in Windows and the open source Mono framework for Linux and MacOS systems. The C# code portion interfaces with the CLOO library (also written in C#), to enable the cross platform use of OpenCL. The core logic of Optimal Cycling is written in OpenCL because it provides relatively easy multicore/GPGPU processing. This enables Optimal Cycling to efficiently scale and parallelize the most compute intensive portions of the program.
The core logic of Optimal Cycling is written in such a way that you can take the OpenCL code and compile it on regular C/C++ compilers. This enables it to be ported to systems where OpenCL is not available with a little bit of work. However, my recommendation is that the OpenCL compiled version be used because it has much higher performance.
The current version of Optimal Cycling has Windows 32 and 64-bit native versions of the core code compiled into DLL libraries. This is for demonstration only to show that it can be done.
The Optimal Cycling Project is open source and is available under the Lesser General Public License (LPGL). The goal is to enable ease of use while continuously improving the project algorithms. To view the code of the Optimal Cycling Project online, visit the project Google Code page at http://code.google.com/p/optimalcycling/. The project is currently written using Microsoft Visual Studio 2008 Professional on Windows 7 64-bit.
To compile the project successfully as provided, you will need either Microsoft Visual Studio 2008 Professional or higher, or you will need Microsoft Visual Studio 2010 Professional or higher. Alternatively, you can use any version of Microsoft Visual Studio 2008/2010 or MonoDevelop if you delete the OptimalCyclingC_Lib_x64 and OptimalCyclingC_Lib_x86 projects from the code. These two projects are only needed if you want to compile Optimal Cycling into native machine code instead of to OpenCL.
To download the most up to date version of Optimal Cycling, please visit http://code.google.com/p/optimalcycling/downloads/list. New releases will be announced on the project homepage at http://www.optimalcycling.com.
Optimal Cycling is cross platform, so it should run on both Windows and Linux/MacOS systems provided you have:
Windows XP: Install .NET Framework 2.0 + AMD ATI Stream SDK/OpenCL enabled Nvidia drivers
Windows Vista/7: Install AMD ATI Stream SDK/OpenCL enabled Nvidia drivers
Linux: Install the Mono Framework + AMD ATI Stream SDK/OpenCL enabled Nvidia drivers
MacOS: Snow Leopard or higher is required for the OpenCL support. You will also need to install the Mono Framework.
.NET Framework 2.0 (Windows XP): http://www.microsoft.com/downloads/en/details.aspx?FamilyID=0856eacb-4362-4b0d-8edd-aab15c5e04f5
Mono Framework (Linux/MacOS): http://www.go-mono.com/mono-downloads/download.html
AMD ATI Stream SDK (OpenCL for CPU and ATI GPUs): http://developer.amd.com/gpu/ATIStreamSDK/downloads/Pages/default.aspx
Nvidia OpenCL GPU Drivers: http://developer.nvidia.com/object/opencl-download.html
If you have trouble installing, please send an e-mail to email@example.com.
How to Run Optimal Cycling
-Version, Software version
-Help, Usage info
-ComputeInfo, Display available compute platforms/devices
-OutputCLLib, Force a recompile of the kernel. Use if upgrading drivers.
-Dir, [Req.] Specify directory with data
-Template, [Opt.] Create template data in Dir and exits
-Clean, [Opt.] Deletes the intermediate files in Dir and runs
-CleanOnly, [Opt.] Deletes the intermediate files in Dir and exits
-CPIndex, [Opt.] Specify which compute platform index to use. Default: 0
-CDIndex, [Opt.] Specify which compute device index to use. Default: 0
-NumExec, [Opt.] Number of “threads” to use. Default: 16 (CPU), 64 (GPU)
-UseNativeCPU, Not for general use. For demoing native Win32 build.
Find out what OpenCL hardware you have:
Run an optimization from the beginning:
OptimalCyclingCMD.exe -Dir:”C:\User\OptimalCycling_V_0_9_0\Examples\CCAP_1000m” -clean
Omit -clean above to resume an interrupted optimization.
Specify which OpenCL device to use:
OptimalCyclingCMD.exe -Dir:”C:\User\OptimalCycling_V_0_9_0\Examples\CCAP_1000m” -clean -CPIndex:0 -CDIndex:0 -NumExec: 16
Output an empty template for data:
OptimalCyclingCMD.exe -Dir:”C:\User\OptimalCycling_V_0_9_0\Examples\Empty” -Template
Note that you must have .Net/Mono + OpenCL drivers installed to run Optimal Cycling.
For a more detailed tutorial on how to get up and running your first power pacing optimization with Optimal Cycling, visit Getting Started.
For a list of references for the Optimal Cycling Project, please see the About-License page or the About-License.txt file in all downloads of Optimal Cycling.
Optimal Cycling V0.9.0 is the first public release of the project. It is currently a command line tool and this version is meant for developers and technically minded athletes, coaches, and researchers. The goal of the first release is to garner feedback about the project as well as troubleshoot installation issues that may arise for users on various computers.
Current project priorities (in no particular order):
-Increase the level of documentation for the project on the project website to foster a greater understanding of how Optimal Cycling works without having to read through all the source code.
-Increase the number of power optimization examples on the project website to show the capabilities of the program.
-Release a graphical user interface in addition to the current command line interface for ease of use.
-Thorough and automated unit testing.
Please note that this document will be split up as more documentation is released to enable ease of use.