Mit Sammlungen den Überblick behalten
Sie können Inhalte basierend auf Ihren Einstellungen speichern und kategorisieren.
LineareOptimierungsEinschränkung
Objekt, das eine lineare Einschränkung vom Typ lowerBound ≤ Sum(a(i) x(i)) ≤ upperBound speichert, wobei lowerBound und upperBound Konstanten, a(i) Konstantenkoeffizienten und x(i) Variablen (Unbekannte) sind.
Im folgenden Beispiel wird die Variable x mit Werten zwischen 0 und 5 und die Einschränkung 0 ≤ 2 * x ≤ 5 erstellt. Dazu erstellen Sie zuerst eine Einschränkung mit der Untergrenze 5 und der Obergrenze 5. Dann wird der Koeffizient für die Variable x in dieser Einschränkung auf 2 festgelegt.
constengine=LinearOptimizationService.createEngine();// Create a variable so we can add it to the constraintengine.addVariable('x',0,5);// Create a linear constraint with the bounds 0 and 10constconstraint=engine.addConstraint(0,10);// Set the coefficient of the variable in the constraint. The constraint is now:// 0 <= 2 * x <= 5constraint.setCoefficient('x',2);
Legt den Koeffizienten einer Variablen in der Einschränkung fest.
Detaillierte Dokumentation
setCoefficient(variableName, coefficient)
Legt den Koeffizienten einer Variablen in der Einschränkung fest. Standardmäßig haben Variablen den Koeffizienten 0.
constengine=LinearOptimizationService.createEngine();// Create a linear constraint with the bounds 0 and 10constconstraint=engine.addConstraint(0,10);// Create a variable so we can add it to the constraintengine.addVariable('x',0,5);// Set the coefficient of the variable in the constraint. The constraint is now:// 0 <= 2 * x <= 5constraint.setCoefficient('x',2);
Parameter
Name
Typ
Beschreibung
variableName
String
Der Name der Variablen, für die der Koeffizient festgelegt wird.
[[["Leicht verständlich","easyToUnderstand","thumb-up"],["Mein Problem wurde gelöst","solvedMyProblem","thumb-up"],["Sonstiges","otherUp","thumb-up"]],[["Benötigte Informationen nicht gefunden","missingTheInformationINeed","thumb-down"],["Zu umständlich/zu viele Schritte","tooComplicatedTooManySteps","thumb-down"],["Nicht mehr aktuell","outOfDate","thumb-down"],["Problem mit der Übersetzung","translationIssue","thumb-down"],["Problem mit Beispielen/Code","samplesCodeIssue","thumb-down"],["Sonstiges","otherDown","thumb-down"]],["Zuletzt aktualisiert: 2025-07-26 (UTC)."],[[["\u003cp\u003e\u003ccode\u003eLinearOptimizationConstraint\u003c/code\u003e objects define constraints in the form of \u003ccode\u003elowerBound ≤ Sum(a(i) x(i)) ≤ upperBound\u003c/code\u003e, where \u003ccode\u003ea(i)\u003c/code\u003e are coefficients and \u003ccode\u003ex(i)\u003c/code\u003e are variables.\u003c/p\u003e\n"],["\u003cp\u003eYou can set the coefficient of a variable within a constraint using the \u003ccode\u003esetCoefficient(variableName, coefficient)\u003c/code\u003e method.\u003c/p\u003e\n"],["\u003cp\u003eConstraints are created with lower and upper bounds, and variables are added with their own bounds before being incorporated into the constraint.\u003c/p\u003e\n"],["\u003cp\u003eThe provided code example demonstrates creating a variable, adding a constraint, and setting the coefficient for the variable within that constraint.\u003c/p\u003e\n"]]],[],null,[]]