Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/GAP/pkg/nconvex/examples/   (GAP Algebra Version 4.15.1©)  Datei vom 28.11.2024 mit Größe 1 kB image not shown  

Quelle  linear_program.g   Sprache: unbekannt

 
Spracherkennung für: .g vermutete Sprache: Unknown {[0] [0] [0]} [Methode: Schwerpunktbildung, einfache Gewichte, sechs Dimensionen]

LoadPackage( "NConvex" );

#! @Chunk linear_program
#! $\newline$
#! To illustrate the using of this operation, let us solve the linear program:
#! $\\P(x,y)= 1-2x+5y$, with $\newline$
#! $100\leq x \leq 200 \newline$
#! $80\leq y\leq 170 \newline$
#! $y \geq -x+200\newline\newline$
#! We bring the inequalities to the form $b+AX\geq 0$, we get:
#! $\newline -100+x\geq 0 \newline$
#! $200-x \geq 0 \newline$
#! $-80+y \geq 0 \newline$
#! $170 -y \geq 0 \newline$
#! $-200 +x+y \geq 0 \newline$
#! @Example
P := PolyhedronByInequalities( [ [ -10010 ], [ 200, -10 ],
[ -8001 ], [ 1700, -1 ], [ -20011 ] ] );;
max := SolveLinearProgram( P, "max", [ 1, -25 ] );
#! [ [ 100170 ], 651 ]
min := SolveLinearProgram( P, "min", [ 1, -25 ] );
#! [ [ 20080 ], 1 ]
VerticesOfMainRatPolytope( P );
#! [ [ 100100 ], [ 100170 ], [ 12080 ], [ 20080 ], [ 200170 ] ]
#! @EndExample
#! So the optimal solutions are $(x=100,y=170)$ with maximal value $p=1-2(100)+5(170)=651and
#! $(x=200,y=80)$ with minimal value $p=1-2(200)+5(80)=1$.
#! @EndChunk

[Dauer der Verarbeitung: 0.18 Sekunden, vorverarbeitet 2026-06-23]