AMPL Pages
AMPL Resources
AMPL.com
AMPL Support Forum
AMPL Download Portal
AMPL Development Resources
AMPL + Python 🐍
Hands-On Optimization in Python
AMPL Model Colaboratory
AMPL on Streamlit Cloud
amplpy: Python API
Open Source Projects
rAMPL: R API
AMPL Plugins
AMPL GSL
amplpyfinance
Solver Callbacks
MP: Solver Interface Framework
Licenses & Pricing
AMPL & Solvers pricing
Free AMPL For Teaching
Free AMPL Community Edition
Social Media
LinkedIn
Twitter / X
C++ API
Introduction
Initial Setup
Quick Start
Class structure
C++ API Reference
C++ API Examples
AMPL Resources
AMPL Resources
AMPL Portal
AMPL Portal
AMPL Support Forum
AMPL Support Forum
AMPL Pages
AMPL Pages
AMPL Resources
AMPL.com
AMPL Support Forum
AMPL Download Portal
AMPL Development Resources
AMPL + Python 🐍
Hands-On Optimization in Python
AMPL Model Colaboratory
AMPL on Streamlit Cloud
amplpy: Python API
Open Source Projects
rAMPL: R API
AMPL Plugins
AMPL GSL
amplpyfinance
Solver Callbacks
MP: Solver Interface Framework
Licenses & Pricing
AMPL & Solvers pricing
Free AMPL For Teaching
Free AMPL Community Edition
Social Media
LinkedIn
Twitter / X
Follow us on
Twitter
and
LinkedIn
to get the latest updates from the dev team!
On this page
Contents
AMPL C++ API
¶
Contents
¶
Introduction
What is AMPL API?
Who can use AMPL API
System requirements
About this manual
Initial Setup
Installation
Initial test
Development
Deployment
Quick Start
Complete listing
Needed headers and AMPL environment creation
Load a model from file
Solve a problem
Get an AMPL entity in the programming environment (get objective value)
Modify model data (assign values to parameters)
Get numeric values from variables
Get arbitrary values via ampl expressions
Delete the AMPL object to free the resources
Class structure
AMPL class
Modelling entities classes
Relation between entities and data
Note on variables suffixes
C++ API Reference
AMPL classes
Algebraic entities classes
Exceptions
C++ API Examples
Example 1: First steps
Example 2: Get and set AMPL options
Example 3: Get and set data through DataFrames
Example 4: Operate with multidimensional data
Example 5: Assign all data to a model and solve it
Example 6: Build an efficient frontier
Example 7: Simple heuristic
next
Introduction