AL17, AL18 - Solving linear programs with software

AL17, AL18 - Solving linear programs with software

Specify an LP or ILP for a solver, read its decision values and objective in context, and distinguish an optimal result from a feasible candidate or a failed model. Software provides computing power; the formulation determines what its answer means.

Supplying the correct mathematical model

A solver reports a minimum of 77 worker-minutes for two tasks, yet the workers can finish them in 44 minutes. Can both statements be correct?

Yes: total worker-time and elapsed completion time are different objectives. First check what the model asked the computer to optimise.

You already know

An LP needs defined numerical decisions, an objective and constraints. Ordinary simplex solves a continuous problem; whole-count decisions need an integer requirement. Graphs and hand calculations help check a small instance before scaling up.

A spreadsheet solver typically needs decision cells, an objective cell with a maximise/minimise setting, resource or balance constraints, and variable domains. Other optimisation software needs the same mathematical information in another format. Some routines accept only standard-form LPs; others also accept non-standard or integer formulations.

Worked example 1: a continuous solver model

Question. Specify a solver model for maximising P=3x+2yP=3x+2y, subject to 2x+y≤82x+y\le8, x+2y≤8x+2y\le8, x,y≥0x,y\ge0. The quantities are divisible.

Plan. Identify the decision entries, calculated expressions, optimisation direction and continuous domains.

Solver componentRequired content
Decision entriesNumerical values of x,yx,y
Objective expression3x+2y3x+2y, maximise
First calculated resource2x+y≤82x+y\le8
Second calculated resourcex+2y≤8x+2y\le8
DomainsNon-negative continuous x,yx,y

An optimal output is:

VariableValue
xx2.6666672.666667
yy2.6666672.666667
Objective13.33333313.333333
2(83)+83=8,3(83)+2(83)=4032\left(\frac83\right)+\frac83=8,\qquad 3\left(\frac83\right)+2\left(\frac83\right)=\frac{40}3

Why this step? The solver's variable cells must be the actual decisions; calculated resource totals are constraints, not extra independent choices.

Answer. The settings in the first table define the continuous model. Its exact optimal solution is x=y=8/3x=y=8/3, P=40/3P=40/3.

Check. Both resources are fully used. The displayed decimals are rounded versions of the exact values, so tiny rounding discrepancies are expected.

Change only the decision domains.

Worked example 2: an integer requirement

Question. The same objective and resource limits now concern complete items. Specify the required solver change and interpret this optimal output.

VariableValue
xx3.0000003.000000
yy2.0000002.000000
Objective13.00000013.000000

Plan. Retain the expressions and bounds, but require both decision variables to be integers.

x,y∈Z≥0whole non-negative items2(3)+2=8first resource use3+2(2)=7second resource useP=3(3)+2(2)=13objective in its original units\begin{aligned} x,y&\in\mathbb Z_{\ge0}&&\text{whole non-negative items}\\ 2(3)+2&=8&&\text{first resource use}\\ 3+2(2)&=7&&\text{second resource use}\\ P&=3(3)+2(2)=13&&\text{objective in its original units} \end{aligned}

Why this step? Formatting a spreadsheet cell to show no decimal places does not impose an integer constraint on the mathematical solution.

Answer. Add the integer domains to the solver. The output recommends 33 first items and 22 second items, with objective 1313.

Check. The slacks are 00 and 11; both are non-negative.

For practical data, keep the constraint coefficient table, bounds and units explicit. A correct solver answer to the wrong table remains the wrong answer to the practical question.

Watch out

Wrong: round a continuous report and call it an integer optimisation. Right: solve with the required integer or binary domains included.

Read a new domain choice before accepting a report.

Interpreting allocation output and units

A solver's output often lists values for many arc or allocation variables. Return to their definitions before adding anything.

Here A1=1A1=1 means worker AA performs task 11, not that the task takes one minute. Each worker may do at most one task, and both tasks are required.

WorkerTask 11, minutesTask 22, minutes
AA4477
BB5533
CC6644

Worked example 3: selected pairings and total time

Question. Interpret this optimal allocation output and calculate its total worker-time.

VariableValue
A1A11.0000001.000000
A2A20.0000000.000000
B1B10.0000000.000000
B2B21.0000001.000000
C1C10.0000000.000000
C2C20.0000000.000000

Plan. Translate the binary selections, then multiply each selected variable by its task time.

A1=B2=1selected assignmentsW=4(1)+3(1)=7worker-minuteselapsed time=max⁡(4,3)=4if both start together\begin{aligned} A1=B2&=1&&\text{selected assignments}\\ W&=4(1)+3(1)=7&&\text{worker-minutes}\\ \text{elapsed time}&=\max(4,3)=4&&\text{if both start together} \end{aligned}

Why this step? The objective sums worker-times. Independent simultaneous tasks finish when the slower selected task finishes, not when their durations have been added.

Answer. AA does task 11, BB does task 22, and CC is unused. Total worker-time is 77 minutes; with simultaneous starts and no further restrictions, elapsed time is 44 minutes.

Check. Each task appears once, each selected worker has one task, and all other selection variables are zero.

Change only worker availability.

Worked example 4: interpreting a changed optimum

Question. Worker BB is unavailable. An optimal solver output has A1=C2=1A1=C2=1, with every other variable zero. Interpret the result and calculate the relevant times.

Plan. Decode the new selection and use the unchanged cost table.

A1=C2=1new assignmentsW=4+4=8total worker-minuteselapsed time=max⁡(4,4)=4independent simultaneous starts\begin{aligned} A1=C2&=1&&\text{new assignments}\\ W&=4+4=8&&\text{total worker-minutes}\\ \text{elapsed time}&=\max(4,4)=4&&\text{independent simultaneous starts} \end{aligned}

Why this step? A higher total workload need not mean a longer elapsed completion time; the chosen objective and the parallel schedule measure different quantities.

Answer. AA performs task 11, CC performs task 22. Total worker-time is 88 minutes and possible elapsed time remains 44 minutes.

Check. No variable belonging to unavailable BB is selected, and both task equalities still hold.

For flow output, add flows across the source boundary or sink boundary, rather than summing every arc value. Internal flow would otherwise be counted several times. For path output, read selected arcs in connectivity order rather than treating the variable listing as a route order.

Continue this lesson.

You’re previewing NovaLearn without an account. Create a free account to read the rest.

Create free account