These are chat archives for nightscout/intend-to-bolus
So, while I am programming the mathematical models for the AP project in C++, a (nonlinear) model predictive control, which is basically a complex algorithm that adaptively solves for the proper insulin dose, needs to be present. Although there is an "open-source" option (see: http://www.nonlinearmpc.com/ ), MATLAB is known to engineers (and engineering students) as the industry standard, and is used in all sorts of environments, including refineries.
The good news is that both options can be used, individually (not in tandem). MATLAB runs C++ code, so I will still continue to program in C++. However, choosing to use C++ absolutely requires numerical methods to solve for solutions, instead of symbolic math (approximations--somewhat disadvantageous--but less processor intensive), which is less convenient, but I don't think it will be much harder to implement.
A MATLAB license for a single user, with my intents of use, costs ~$2000 (super-ouch!), but I know this is the way to go, even though implementing all of this is going to be super expensive. But, it is for my health, and I have a complicated medical situation and MATLAB is trusted in risky environments all the time.
Also, something not expected...I was intending on running MATLAB in the cloud on the Amazon EC2 platform, which is pretty solid. However, I knew that in order to use the Model Predictive Control Toolbox, that I would have to get a MATLAB Distributed Computing Server license, among other things. I was anticipating that to be no big deal. I literally just found out that even for my intended use that it would cost thousands upon thousands of dollars for use.
I have a student license for MATLAB with access to a bunch of toolboxes (I really only need the Model Predictive Control Toolbox, technically), so I guess I will be hosting my server in the cloud from my house, for personal use. Obviously I have to have constant uptime, but I am pretty much always at home so I am not too worried. FWIW, MATLAB is $200 for strictly "personal" use.