AMPL

AMPL (A Mathematical Programming Language) ist eine mathematische Modellierungssprache, die von Robert Fourer, David Gay und Brian W. Kernighan an den Bell Laboratories entwickelt wurde. Sie erlaubt die Formulierung mathematischer Modelle in abstrakter, der algebraischen Notation naher Form. Mit AMPL können viele Optimierungsprobleme formuliert werden.

Da AMPL diese Probleme nicht direkt löst, sondern in eine Form übersetzt, die ein Optimierungsalgorithmus versteht, benötigt AMPL passende Solver, um funktionieren zu können.

Genügend schwierige Probleme wie globale Optima, nichtlineare Mixed-Integer-Probleme usw. brauchen daher spezielle Solver.

Beispiel

Es ist das folgende mathematische Modell gegeben:

Variablen:
  • x 1 {\displaystyle x_{1}} : Anzahl von Produkt 1
  • x 2 {\displaystyle x_{2}} : Anzahl von Produkt 2
Zielfunktion:
  • Maximiere z = 400 x 1 + 50 x 2 {\displaystyle z=400x_{1}+50x_{2}}
Nebenbedingungen:
  • 0 x 1 70 {\displaystyle 0\leq x_{1}\leq 70} (Bereich von x 1 {\displaystyle x_{1}} )
  • 0 x 2 500 {\displaystyle 0\leq x_{2}\leq 500} (Bereich von x 2 {\displaystyle x_{2}} )
  • 25 x 1 + 10 x 2 5000 {\displaystyle 25x_{1}+10x_{2}\leq 5000} (Beschränkung für Ressource 1)
  • 100 x 1 + 20 x 2 8000 {\displaystyle 100x_{1}+20x_{2}\leq 8000} (Beschränkung für Ressource 2)

Eine äquivalente Formulierung in AMPL könnte so aussehen:

 # Variablen:
 var x1 integer;
 var x2 integer;

 # Zielfunktion:
 maximize z: 400*x1 + 50*x2;

 # Nebenbedingungen:
 subject to Bereich_x1: 0 <= x1 <= 70;
 subject to Bereich_x2: 0 <= x2 <= 500;
 subject to Ressource1: 25*x1 + 10*x2 <= 5000;
 subject to Ressource2: 100*x1 + 20*x2 <= 8000;

 # wenn man dieses Problem loesen will
 # braucht man nur noch
 solve;
 # der Maximierer wird mit
 display x1, x2;
 # angezeigt

Siehe auch

  • AIMMS
  • GAMS
  • GLPK – Open-Source-Alternative zum proprietären AMPL
  • MPL
  • OPL Studio

Literatur

  • Robert Fourer, David Gay, Brian Kernighan: AMPL: a modeling language for mathematical programming. Duxbury Resource Center, ISBN 0-534-38809-4
  • AMPL Homepage