Free to use, no account

Kalkulator for lineær programmering

Oppgi en lineær målfunksjon og opptil åtte begrensninger for å løse et lineært programmeringsproblem med to variabler, der x og y er ikke-negative. Tofase-simpleksmetoden finner optimum, infeasibilitet eller ubegrensethet og viser hvert pivottrinn.

Målfunksjonskoeffisienter (x, y)

Én per linje: a,b <= rhs, a,b >= rhs eller a,b = rhs

Bruker opptil åtte begrensninger og koeffisienter/høyresider innenfor ±1 000 000. Begge beslutningsvariablene må oppfylle x ≥ 0 og y ≥ 0. Bruk komma mellom koeffisientene for x og y; skriv én ulikhet eller likhet per linje.

En tofaset primal simplex-løser for to variabler. Numerisk toleranse brukes for flyttallspivoter; nesten degenererte problemer kan være følsomme for avrunding. Tilfeller uten løsning, med ubegrenset løsning eller med nådd iterasjonsgrense rapporteres uten å finne på et optimum.

Hvordan fungerer simplekskalkulatoren for to variabler?

Den konverterer begrensningene til en mulig tablåform, bruker et fase I-mål når det trengs og utfører deretter primal-simplexpivoter for å optimalisere målfunksjonen. Variablene x og y er begrenset til ikke-negative verdier.

Veiledning

Slik bruker du linear-programming-calculator

This calculator solves a linear program with two variables, x and y, that cannot be negative. You give the objective to maximize or minimize and up to eight constraints, one per line. It uses the two-phase simplex method and reports the best point, or says the problem is infeasible or unbounded, with the pivot steps listed.

Slik gjør du

  1. Choose Maximize or Minimize and enter the coefficient of x and of y in the objective. For example, 3 and 2 means 3x + 2y.
  2. Type each constraint on its own line in the form a,b <= rhs, a,b >= rhs or a,b = rhs, where a multiplies x and b multiplies y. You can enter from 1 to 8 lines.
  3. Press Solve linear program. Read the status, the optimum, the values of x and y, the numbers of the active constraints and the pivot steps. Copy results copies them.

Eksempler

The tool's sample

Du skriver inn
Målfunksjon
maximize x + y
Bibetingelser
1,1 <= 5
Du får
Status
optimal
x
5
y
0
Optimum
5
Aktive bibetingelser
1
Pivoteringer
1

Any point on the line x + y = 5 gives the value 5. The tool reports one of them, (5, 0). It does not list the other equally good points.

Kjørt med verktøyets egen kode.

A maximizing problem with three limits

Du skriver inn
Målfunksjon
maximize 3x + 2y
Bibetingelser
1,1 <= 4; 1,3 <= 6; 1,0 <= 3
Du får
Status
optimal
x
3
y
1
Optimum
11
Aktive bibetingelser
1; 2; 3
Pivoteringer
2

At (3, 1) the value is 9 + 2 = 11. All three constraints are met with equality there, so all three are listed as active.

Kjørt med verktøyets egen kode.

A minimizing problem with at-least limits

Du skriver inn
Målfunksjon
minimize 2x + 3y
Bibetingelser
1,1 >= 4; 1,2 >= 6
Du får
Status
optimal
x
2
y
2
Optimum
10
Aktive bibetingelser
1; 2
Pivoteringer
2

Greater-than limits need a first phase to find a starting point. The best point is (2, 2), which gives 4 + 6 = 10. Both constraints are active.

Kjørt med verktøyets egen kode.

Når det er nyttig

  • Check homework on a two-variable linear programming problem and see the pivots the simplex method takes.
  • Test a small mix or budget model, such as how many of two products to make under limits on time and material.
  • Learn how infeasible and unbounded problems look, by entering contradictory limits or leaving a direction open.

Begrensninger

  • It handles exactly two variables, both at least zero, and 1 to 8 constraints. Every coefficient and right-hand side must be a number between -1,000,000 and 1,000,000, and each line needs commas, as in 1,1 <= 5.
  • The answer is only for the model you typed in. The tool does not check whether the units, limits or goals fit a real decision. It reports one optimal point even when many points tie, and it can be sensitive to rounding on nearly degenerate problems.
  • If the simplex steps do not finish within 500 pivots the tool reports an iteration limit instead of a result, and it never invents an optimum for infeasible or unbounded problems.

Tips

  • If a quantity has no upper limit, leave that constraint out instead of typing a huge number. A maximizing problem with room to grow is then reported as unbounded.
  • Move all variables to the left side before typing. A limit written as x - y <= 2 goes in as 1,-1 <= 2.
  • Check the answer by putting x and y back into each constraint by hand. It takes a minute and catches typing errors.

Vanlige spørsmål

What format do the constraints use?

One per line, with a comma between the x and y coefficients, then <=, >= or =, then the right-hand side. For example, 2,1 >= 4 means 2x + y is at least 4. Variables are fixed to x and y.

What does infeasible mean?

No point satisfies every constraint at once. For example, 1,1 <= 2 together with 1,1 >= 5 cannot both hold. The tool reports this status and does not give a best point.

What does unbounded mean?

The objective can keep improving without reaching a best value. For example, maximizing x + y with only 1,-1 <= 2 lets both grow together forever. The tool reports it instead of a number.

What are active constraints?

They are the constraints that hold with equality at the answer, listed by their line number. They show which limits are actually pinning the solution in place.

Can I add a third variable or require whole numbers?

No. The tool has only x and y, and both are continuous, so it will not return whole-number answers. For integer problems you need a different method, such as branch and bound.

Are my numbers sent anywhere?

No. The solver runs in this browser, and the objective and constraints are not sent to a server or saved by the tool. Copy the results if you want a record.

Ofte stilte spørsmål

Hvordan fungerer simplekskalkulatoren for to variabler?

Den konverterer begrensningene til en mulig tablåform, bruker et fase I-mål når det trengs og utfører deretter primal-simplexpivoter for å optimalisere målfunksjonen. Variablene x og y er begrenset til ikke-negative verdier.

Lastes målfunksjonen og begrensningene mine opp?

Nei. Løseren kjører i denne nettleseren. Målfunksjonen og begrensningene sendes ikke til en server eller lagres.

Hvilket format skal jeg bruke for begrensninger?

Skriv én rad per linje, for eksempel 1,1 <= 5 eller 2,1 >= 4. Det første tallet multipliserer x, det andre multipliserer y, og begge variablene må være ikke-negative.

Hva betyr at en løsning er umulig eller ubegrenset?

Ingen gyldig løsning betyr at ingen punkter oppfyller alle angitte begrensninger. Ubegrenset betyr at en gyldig retning lar målfunksjonen fortsette å forbedres uten et endelig optimum.

Beviser resultatet at den virkelige modellen min er riktig?

Nei. Verktøyet løser bare ligningene du oppga. Kontroller enheter, forutsetninger og om begrensningene beskriver beslutningen din riktig.