To help demonstrate how a user can convert a VBA model built within Excel to the Solver SDK Platform Java language, attached are two items: productMixVBA.xlsm and productMix.java.
The .xlsm contains a Macro that builds and solves a model in the workbook with comments throughout. A user can execute the Macro with the Run Macro button in the workbook and the code should be "public" and available to view and modify if desired. The Solver reference must be set in your VBA references.
The .java contains the Java code necessary to build a .class file that can be "executed" via command line to solve the same model that is solved in the .xlsm. There are comments throughout the code.
The SDK version solves to a slightly different answer. This is due to mechanical precision available within the SDK that is not available within Excel. Rounded off, the solutions are the same. No "manual" rounding was done in the Java code.
You must have the Solver SDK installed and the JDK (8xxx or newer should suffice, we can not guarantee compatibility with older versions of the JDK) installed to test the .java file.
The Java code should be convertible to any other supported language in the SDK (C, C++, C#, R, Python, MATLAB, VB.Net) with some minor modifications.
The model example is very simple and does not demonstrate all parameters/capabilities of the SDK. Please review the Solver SDK User Guide and Reference Guide (available in the Help folder of your install path) for more information.
There are a multitude of pre-built examples for the different supported languages of the Solver SDK. For more complex examples in code only (no workbook comparison) please review the examples in the Examples folder of your SDK install path.
If you run into any issues with the SDK or have further questions about conversion from VBA to SDK, we will do our best to help. Please direct inquiries to email@example.com.