Your First Optimization with globalMOO
This guide will take you from zero to your first working optimization in about 15 minutes. We'll create a simple but complete example that demonstrates the key features of globalMOO.
Try it interactively: Follow along with this guide in our Interactive Google Colab Notebook
What You'll Build
We'll optimize a simple function with two inputs to achieve desired outputs. This example will teach you:
How to set up authentication
How to create a model and project
How to run an optimization
How to interpret and use the results
Prerequisites
Python 3.10 or higher
A globalMOO API key (get one at https://api.globalmoo.ai/)
Basic Python knowledge
Step 1: Installation and Setup
Install the SDK (use the appropriate package manager for your language):
Create a new file and add the necessary imports and setup:
Or if you prefer to specify credentials directly:
Step 2: Define Your Function
Let's optimize a simple linear function with 3 inputs and 5 outputs:
Step 3: Create a Model and Project
Step 4: Run Initial Learning Cases
Step 5: Set Optimization Goals
Other available objective types include:
ObjectiveType.EXACT: Match exactly within L1 normObjectiveType.VALUE: Match within absolute error boundsObjectiveType.LESS_THAN: Keep output below targetObjectiveType.LESS_THAN_EQUAL: Keep output at or below targetObjectiveType.GREATER_THAN: Keep output above targetObjectiveType.GREATER_THAN_EQUAL: Keep output at or above targetObjectiveType.MINIMIZE: Minimize output down to targetObjectiveType.MAXIMIZE: Maximize output up to target
Step 6: Run the Optimization Loop
Complete Code
The complete code is available in the examples directory as linear_example.py.
What's Next?
Now that you have your first optimization working, you can:
Try different objective types (EXACT, VALUE, LESS_THAN, etc.)
Learn about different input types (integers, categories) in the tutorials
Explore more complex optimization scenarios
Check out the example gallery for real-world applications
Common Issues
Authentication errors
Check your API key in .env file or credentials
Ensure you're using the correct base URI
Optimization not converging
Try increasing max_iterations
Check if your target values are achievable
Consider relaxing your objective criteria
Need help?
Contact support@globalmoo.com
Check our documentation at https://docs.globalmoo.ai
Last updated