// Numbas version: exam_results_page_options {"name": "Simplex algorithm - bus company", "extensions": ["optimisation"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"name": "Simplex algorithm - bus company", "tags": ["simplex"], "metadata": {"description": "

Linear program described in words. Student must write out constraints as equations in standard form, then identify the optimal solution in a finished simplex tableau.

", "licence": "Creative Commons Attribution 4.0 International"}, "statement": "

A travel company needs to order new vehicles to carry their passengers. They will order a mix of shuttles and coaches, subject to the following conditions:

\n", "advice": "

a-f)

\n

A linear program in standard form uses only strict equations, not inequalities. We can achieve this by introducing a slack variable to each inequality.

\n

Let $x_1$ be the number of shuttles bought, and $x_2$ the number of coaches.

\n

The constraints can be written as follows:

\n

\\begin{align}
\\simplify{{price_shuttle}*x1 + {price_coach}*x2} &\\leq \\var{budget} & \\text{(budget)} \\\\
x_1 + x_2 &\\leq \\var{garage} & \\text{(garage capacity)} \\\\
x_1 &\\geq \\var{min_shuttles} & \\text{(number of shuttles)} \\\\
x_2 &\\geq \\var{min_coaches} & \\text{(number of coaches)} \\\\
\\simplify{{seats_shuttle}*x1 + {seats_coach}*x2} &\\geq \\var{min_seats} & \\text{(number of seats)} \\\\
\\frac{x_2}{x_1+x_2} &\\geq \\var[fractionnumbers]{prop_coaches} & \\text{(proportion of coaches)}
\\end{align}

\n

\\begin{align}
\\simplify{{price_shuttle}*x1 + {price_coach}*x2} +s_1 &= \\var{budget} & \\text{(budget)} \\\\
x_1 + x_2 +s_2 &= \\var{garage} & \\text{(garage capacity)} \\\\
-x_1 + s_3 &= \\var{-min_shuttles} & \\text{(number of shuttles)} \\\\
-x_2 + s_4 &= \\var{-min_coaches} & \\text{(number of coaches)} \\\\
\\simplify{-{seats_shuttle}*x1 -{seats_coach}*x2} +s_5 &= \\var{-min_seats} & \\text{(number of seats)} \\\\
\\simplify[all,fractionnumbers]{x_1 + {1-1/prop_coaches}x_2} + s_6 &= 0 & \\text{(proportion of coaches)}
\\end{align}

\n

g)

\n

The company expects to earn a monthly profit of £{comma(base_profit*profit_shuttle)} from each shuttle, and £{comma(base_profit*profit_coach)} from each coach, so the total expected monthly profit is

\n

\\[ \\simplify{{base_profit*profit_shuttle}*x1 + {base_profit*profit_coach}*x2} \\]

\n

h)

\n

$x_1$ is basic in row {basic_rows[0]+1}, so its value in the optimal solution is $\\var[fractionnumbers]{optimal_tableau[basic_rows[0]][len(equations)+2]}$.

\n

$x_2$ is basic in row {basic_rows[1]+1}, so its value in the optimal solution is $\\var[fractionnumbers]{optimal_tableau[basic_rows[1]][len(equations)+2]}$.

\n

This solution is not feasible in the real world, so we must look for nearby integer solutions. The integer solution which maximises the objective is $x_1 = \\var{num_shuttles}$, $x_2 = \\var{num_coaches}$.

\n

The company should buy {num_shuttles} shuttles and {num_coaches} coaches.

", "rulesets": {}, "extensions": ["optimisation"], "variables": {"num_shuttles_raw": {"name": "num_shuttles_raw", "group": "Simplex solution", "definition": "solution[0]", "description": "

Number of shuttles to buy, given by the simplex method. This might be a fraction, in which case we need to look for nearby integer solutions.

", "templateType": "anything"}, "basic_rows": {"name": "basic_rows", "group": "Simplex solution", "definition": "simplex_find_basics(optimal_tableau)", "description": "", "templateType": "anything"}, "profit_coach": {"name": "profit_coach", "group": "Initial data", "definition": "profit_shuttle*random(1.2 .. 1.6 # 0.1)", "description": "

Profit earned by a single coach

", "templateType": "anything"}, "seats_coach": {"name": "seats_coach", "group": "Initial data", "definition": "seats_shuttle+random(50..100#10)", "description": "", "templateType": "anything"}, "profits": {"name": "profits", "group": "Simplex solution", "definition": "map(s[0]*profit_shuttle+s[1]*profit_coach,s,acceptable_solutions)", "description": "

Profit earned for each acceptable solution

", "templateType": "anything"}, "garage": {"name": "garage", "group": "Initial data", "definition": "min_shuttles+min_coaches+random(5..30#5)", "description": "

Total capacity of the garage

", "templateType": "anything"}, "profit_shuttle": {"name": "profit_shuttle", "group": "Initial data", "definition": "1", "description": "

Profit earned by one shuttle. Doesn't matter what the values really are, so set to 1

", "templateType": "anything"}, "solution": {"name": "solution", "group": "Simplex solution", "definition": "simplex(objective,equations)", "description": "

Values of each of the variables found by the simplex method.

", "templateType": "anything"}, "min_coaches": {"name": "min_coaches", "group": "Initial data", "definition": "random(5..30#5)", "description": "", "templateType": "anything"}, "price_shuttle": {"name": "price_shuttle", "group": "Initial data", "definition": "random(15..40#5)*1000", "description": "

The price of a single shuttle

", "templateType": "anything"}, "integer_solutions": {"name": "integer_solutions", "group": "Simplex solution", "definition": "list(set(product([floor(num_shuttles_raw),ceil(num_shuttles_raw)],[floor(num_coaches_raw),ceil(num_coaches_raw)])))", "description": "

Integer solutions near the (potentially non-integer) solution found by the simplex method.

", "templateType": "anything"}, "prop_coaches": {"name": "prop_coaches", "group": "Initial data", "definition": "round(random(min_coaches/garage .. 1-min_shuttles/garage # 0)*12)/12", "description": "

Minimum fraction of vehicles bought which must be coaches.

\n

The minimum value this can possibly be while obeying the minimum order conditions is min_coaches/garage. The maximum it can be is 1-min_shuttles/garage.

\n

Pick a number between those two values and round off to the nearest 1/12th.

", "templateType": "anything"}, "budget": {"name": "budget", "group": "Initial data", "definition": "random(price_shuttle*garage .. price_coach*garage # 10000)", "description": "

Total budget. Picked so that it's a realistic amount given the garage space available (no point having this constraint if you can afford to fill the garage with the most expensive vehicle).

", "templateType": "anything"}, "equations": {"name": "equations", "group": "Simplex solution", "definition": "reduce_equations([\n [price_shuttle,price_coach,1,0,0,0,0,0,budget], // budget\n [1,1,0,1,0,0,0,0,garage], // garage\n [-1,0,0,0,1,0,0,0,-min_shuttles], // number of shuttles\n [0,-1,0,0,0,1,0,0,-min_coaches], // number of coaches\n [-seats_shuttle,-seats_coach,0,0,0,0,1,0,-min_seats], // number of seats\n [1,1-1/prop_coaches,0,0,0,0,0,1,0] // proportion of coaches\n])", "description": "

Encodings of the constraint equations, for the simplex tableau.

\n

The reduce_equations function divides the coefficients of each equation so that, for each equation, the gcd of the non-slack variables and the right-hand side is 1.

", "templateType": "anything"}, "seats_shuttle": {"name": "seats_shuttle", "group": "Initial data", "definition": "random(30..80#10)", "description": "

The number of seats on a shuttle

", "templateType": "anything"}, "min_seats": {"name": "min_seats", "group": "Initial data", "definition": "seats_shuttle*min_shuttles + seats_coach*min_coaches + random(100 .. (garage-min_shuttles-min_coaches)*seats_coach # 100)", "description": "

The minimum number of seats. Add up the minimum given by the minimum orders of seats and coaches, then add on a few more, making sure we don't ask for more than the garage condition makes possible.

", "templateType": "anything"}, "profit": {"name": "profit", "group": "Answer", "definition": "profit_shuttle*num_shuttles + profit_coach*num_coaches", "description": "

Total profit earned in the optimal solution.

", "templateType": "anything"}, "best_solution": {"name": "best_solution", "group": "Simplex solution", "definition": "acceptable_solutions[filter(profits[x]=max(profits),x,0..len(acceptable_solutions)-1)[0]]", "description": "

The solution with the highest profit

", "templateType": "anything"}, "base_profit": {"name": "base_profit", "group": "Initial data", "definition": "random(1000..2000#10)", "description": "", "templateType": "anything"}, "price_coach": {"name": "price_coach", "group": "Initial data", "definition": "price_shuttle+random(5..35#5)*1000", "description": "

The price of a single coach - always more than a shuttle

", "templateType": "anything"}, "optimal_tableau": {"name": "optimal_tableau", "group": "Simplex solution", "definition": "simplex_optimal_tableau(objective,equations)", "description": "

Optimal tableau found by the simplex method

", "templateType": "anything"}, "num_coaches": {"name": "num_coaches", "group": "Answer", "definition": "best_solution[1]", "description": "

The number of coaches to buy

", "templateType": "anything"}, "num_coaches_raw": {"name": "num_coaches_raw", "group": "Simplex solution", "definition": "solution[1]", "description": "

Number of coaches to buy, given by the simplex method. This might be a fraction, in which case we need to look for nearby integer solutions.

", "templateType": "anything"}, "acceptable_solutions": {"name": "acceptable_solutions", "group": "Simplex solution", "definition": "filter(\n let(shuttles,s[0],coaches,s[1],\n shuttles+coaches<=garage\n and\n shuttles>=min_shuttles\n and\n coaches>=min_coaches\n and\n coaches/(coaches+shuttles)>=prop_coaches\n and\n shuttles*price_shuttle + coaches*price_coach<=budget\n and\n shuttles*seats_shuttle + coaches*seats_coach >= min_seats\n ),\n s,\n integer_solutions\n)", "description": "

The integer solutions which satisfy all the constraints.

", "templateType": "anything"}, "min_shuttles": {"name": "min_shuttles", "group": "Initial data", "definition": "random(5..30#5)", "description": "

Minimum number of shuttles that must be bought

", "templateType": "anything"}, "num_shuttles": {"name": "num_shuttles", "group": "Answer", "definition": "best_solution[0]", "description": "

The number of shuttles to buy

", "templateType": "anything"}, "objective": {"name": "objective", "group": "Simplex solution", "definition": "[base_profit*profit_shuttle,base_profit*profit_coach,0,0,0,0,0,0]", "description": "

Encoding of the objective function for the simplex tableau

", "templateType": "anything"}}, "variablesTest": {"condition": "len(acceptable_solutions)>0", "maxRuns": "100"}, "ungrouped_variables": [], "variable_groups": [{"name": "Initial data", "variables": ["price_shuttle", "price_coach", "min_shuttles", "min_coaches", "garage", "budget", "seats_shuttle", "seats_coach", "min_seats", "prop_coaches", "profit_shuttle", "profit_coach", "base_profit"]}, {"name": "Simplex solution", "variables": ["objective", "equations", "optimal_tableau", "solution", "num_shuttles_raw", "num_coaches_raw", "integer_solutions", "acceptable_solutions", "profits", "best_solution", "basic_rows"]}, {"name": "Answer", "variables": ["num_shuttles", "num_coaches", "profit"]}], "functions": {"comma": {"parameters": [["n", "number"]], "type": "number", "language": "javascript", "definition": "//format a number with commas every three digits\nn = Numbas.math.precround(n,2)\nvar s = Math.floor(n)+'';\nfor(var i=s.length-3;i>0;i-=3) {\n s = s.slice(0,i)+','+s.slice(i);\n}\nvar d = (n%1);\nif(d>0) {\n return s+'.'+Numbas.math.niceNumber(d).slice(2);\n} else {\n return s\n}"}, "reduce_equations": {"parameters": [["equations", "list"]], "type": "list", "language": "jme", "definition": "// reduce each of the linear equations so the non-slack variables and the RHS have gcd 1\nmap(\n let(l,len(row),g,gcd([row[0],row[1],row[len(row)-1]]),\n [row[0]/g,row[1]/g]+row[2..l-1]+[row[l-1]/g]\n ),\n row,\n equations\n)"}, "gcd": {"parameters": [["l", "list"]], "type": "number", "language": "javascript", "definition": "var g;\nfor(var s=0;s0) {\n g = Numbas.math.gcd(g,Math.abs(l[i]));\n }\n}\nreturn g;"}}, "preamble": {"js": "", "css": "/* hide the feedback icons on the part g gaps */\n.parts > .part:nth-child(7) .part .feedback-icon {\n display: none;\n}"}, "parts": [{"type": "gapfill", "useCustomName": false, "customName": "", "marks": 0, "showCorrectAnswer": true, "showFeedbackIcon": true, "scripts": {}, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "adaptiveMarkingPenalty": 0, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "prompt": "

Write an equation in standard form for the constraint defined by the budget. Let x1 be the number of shuttles bought, and x2 the number of coaches, with a slack variable s1.

\n

Do not cancel any of the coefficients in your answer.

\n

[[0]] $+ s_1 =$ [[1]]

", "gaps": [{"type": "jme", "useCustomName": false, "customName": "", "marks": "0.5", "showCorrectAnswer": true, "showFeedbackIcon": true, "scripts": {}, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "adaptiveMarkingPenalty": 0, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "answer": "{price_shuttle}*x1 + {price_coach}*x2", "showPreview": true, "checkingType": "absdiff", "checkingAccuracy": 0.001, "failureRate": 1, "vsetRangePoints": 5, "vsetRange": [0, 1], "checkVariableNames": false, "valuegenerators": [{"name": "x1", "value": ""}, {"name": "x2", "value": ""}]}, {"type": "jme", "useCustomName": false, "customName": "", "marks": "0.5", "showCorrectAnswer": true, "showFeedbackIcon": true, "scripts": {}, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "adaptiveMarkingPenalty": 0, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "answer": "{budget}", "showPreview": true, "checkingType": "absdiff", "checkingAccuracy": 0.001, "failureRate": 1, "vsetRangePoints": 5, "vsetRange": [0, 1], "checkVariableNames": false, "valuegenerators": []}], "sortAnswers": false}, {"type": "gapfill", "useCustomName": false, "customName": "", "marks": 0, "showCorrectAnswer": true, "showFeedbackIcon": true, "scripts": {}, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "adaptiveMarkingPenalty": 0, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "prompt": "

Write an equation in standard form for the constraint defined by the capacity of the garage. Let x1 be the number of shuttles bought, and x2 the number of coaches, with a slack variable s2.

\n

[[0]] $ + s_2 = $ [[1]]

", "gaps": [{"type": "jme", "useCustomName": false, "customName": "", "marks": "0.5", "showCorrectAnswer": true, "showFeedbackIcon": true, "scripts": {}, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "adaptiveMarkingPenalty": 0, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "answer": "x1 + x2", "showPreview": true, "checkingType": "absdiff", "checkingAccuracy": 0.001, "failureRate": 1, "vsetRangePoints": 5, "vsetRange": [0, 1], "checkVariableNames": false, "valuegenerators": [{"name": "x1", "value": ""}, {"name": "x2", "value": ""}]}, {"type": "jme", "useCustomName": false, "customName": "", "marks": "0.5", "showCorrectAnswer": true, "showFeedbackIcon": true, "scripts": {}, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "adaptiveMarkingPenalty": 0, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "answer": "{garage}", "showPreview": true, "checkingType": "absdiff", "checkingAccuracy": 0.001, "failureRate": 1, "vsetRangePoints": 5, "vsetRange": [0, 1], "checkVariableNames": false, "valuegenerators": []}], "sortAnswers": false}, {"type": "gapfill", "useCustomName": false, "customName": "", "marks": 0, "showCorrectAnswer": true, "showFeedbackIcon": true, "scripts": {}, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "adaptiveMarkingPenalty": 0, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "prompt": "

Write an equation in standard form for the constraint defined by the required number of shuttles. Let x1 be the number of shuttles bought, with a slack variable s3.

\n

[[0]] $ + s_3 = $ [[1]]

", "gaps": [{"type": "jme", "useCustomName": false, "customName": "", "marks": "0.5", "showCorrectAnswer": true, "showFeedbackIcon": true, "scripts": {}, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "adaptiveMarkingPenalty": 0, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "answer": "-x1", "showPreview": true, "checkingType": "absdiff", "checkingAccuracy": 0.001, "failureRate": 1, "vsetRangePoints": 5, "vsetRange": [0, 1], "checkVariableNames": false, "valuegenerators": [{"name": "x1", "value": ""}]}, {"type": "jme", "useCustomName": false, "customName": "", "marks": "0.5", "showCorrectAnswer": true, "showFeedbackIcon": true, "scripts": {}, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "adaptiveMarkingPenalty": 0, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "answer": "-{min_shuttles}", "showPreview": true, "checkingType": "absdiff", "checkingAccuracy": 0.001, "failureRate": 1, "vsetRangePoints": 5, "vsetRange": [0, 1], "checkVariableNames": false, "valuegenerators": []}], "sortAnswers": false}, {"type": "gapfill", "useCustomName": false, "customName": "", "marks": 0, "showCorrectAnswer": true, "showFeedbackIcon": true, "scripts": {}, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "adaptiveMarkingPenalty": 0, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "prompt": "

Write an equation in standard form for the constraint defined by the required number of coaches. Let x2 be the number of coaches bought, with a slack variable s4.

\n

[[0]] $ + s_4 = $ [[1]]

", "gaps": [{"type": "jme", "useCustomName": false, "customName": "", "marks": "0.5", "showCorrectAnswer": true, "showFeedbackIcon": true, "scripts": {}, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "adaptiveMarkingPenalty": 0, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "answer": "-x2", "showPreview": true, "checkingType": "absdiff", "checkingAccuracy": 0.001, "failureRate": 1, "vsetRangePoints": 5, "vsetRange": [0, 1], "checkVariableNames": false, "valuegenerators": [{"name": "x2", "value": ""}]}, {"type": "jme", "useCustomName": false, "customName": "", "marks": "0.5", "showCorrectAnswer": true, "showFeedbackIcon": true, "scripts": {}, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "adaptiveMarkingPenalty": 0, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "answer": "-{min_coaches}", "showPreview": true, "checkingType": "absdiff", "checkingAccuracy": 0.001, "failureRate": 1, "vsetRangePoints": 5, "vsetRange": [0, 1], "checkVariableNames": false, "valuegenerators": []}], "sortAnswers": false}, {"type": "gapfill", "useCustomName": false, "customName": "", "marks": 0, "showCorrectAnswer": true, "showFeedbackIcon": true, "scripts": {}, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "adaptiveMarkingPenalty": 0, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "prompt": "

Write an equation in standard form for the constraint defined by the required number of available seats. Let x1 be the number of shuttles bought, and x2 the number of coaches, with a slack variable s5.

\n

[[0]] $ + s_5 = $ [[1]]

", "gaps": [{"type": "jme", "useCustomName": false, "customName": "", "marks": "0.5", "showCorrectAnswer": true, "showFeedbackIcon": true, "scripts": {}, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "adaptiveMarkingPenalty": 0, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "answer": "-{seats_shuttle}*x1 - {seats_coach}*x2", "showPreview": true, "checkingType": "absdiff", "checkingAccuracy": 0.001, "failureRate": 1, "vsetRangePoints": 5, "vsetRange": [0, 1], "checkVariableNames": false, "valuegenerators": [{"name": "x1", "value": ""}, {"name": "x2", "value": ""}]}, {"type": "jme", "useCustomName": false, "customName": "", "marks": "0.5", "showCorrectAnswer": true, "showFeedbackIcon": true, "scripts": {}, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "adaptiveMarkingPenalty": 0, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "answer": "-{min_seats}", "showPreview": true, "checkingType": "absdiff", "checkingAccuracy": 0.001, "failureRate": 1, "vsetRangePoints": 5, "vsetRange": [0, 1], "checkVariableNames": false, "valuegenerators": []}], "sortAnswers": false}, {"type": "gapfill", "useCustomName": false, "customName": "", "marks": 0, "showCorrectAnswer": true, "showFeedbackIcon": true, "scripts": {}, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "adaptiveMarkingPenalty": 0, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "prompt": "

Write an equation in standard form for the constraint defined by the required proportion of coaches. Let x1 be the number of shuttles bought, and x2 the number of coaches bought, with a slack variable s6.

\n

$x_1 + $ [[0]] $ \\times x_2 + s_6 = $ [[1]]

", "gaps": [{"type": "numberentry", "useCustomName": false, "customName": "", "marks": "0.5", "showCorrectAnswer": true, "showFeedbackIcon": true, "scripts": {}, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "adaptiveMarkingPenalty": 0, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "minValue": "1-1/prop_coaches", "maxValue": "1-1/prop_coaches", "correctAnswerFraction": true, "allowFractions": true, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "numberentry", "useCustomName": false, "customName": "", "marks": "0.5", "showCorrectAnswer": true, "showFeedbackIcon": true, "scripts": {}, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "adaptiveMarkingPenalty": 0, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "minValue": "0", "maxValue": "0", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "sortAnswers": false}, {"type": "gapfill", "useCustomName": false, "customName": "", "marks": 0, "showCorrectAnswer": true, "showFeedbackIcon": true, "scripts": {}, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "adaptiveMarkingPenalty": 0, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "prompt": "

Write a function for the profit the company expects to earn each month, based on the number of shuttles (x1) and coaches (x2) ordered.

\n

$\\text{Profit} = $ [[0]]

", "gaps": [{"type": "jme", "useCustomName": false, "customName": "", "marks": 1, "showCorrectAnswer": true, "showFeedbackIcon": true, "scripts": {}, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "adaptiveMarkingPenalty": 0, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "answer": "{base_profit*profit_shuttle}*x1 + {base_profit*profit_coach}*x2", "showPreview": true, "checkingType": "absdiff", "checkingAccuracy": 0.001, "failureRate": 1, "vsetRangePoints": 5, "vsetRange": [0, 1], "checkVariableNames": false, "valuegenerators": [{"name": "x1", "value": ""}, {"name": "x2", "value": ""}]}], "sortAnswers": false}, {"type": "gapfill", "useCustomName": false, "customName": "", "marks": 0, "showCorrectAnswer": true, "showFeedbackIcon": true, "scripts": {}, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "adaptiveMarkingPenalty": 0, "customMarkingAlgorithm": "all_valid:\n map(assert(x[\"valid\"], concat_feedback(x[\"feedback\"],1/len(gaps))), x, marked_original_order)\n\nshuttles:\n interpreted_answers[0]\n\ncoaches:\n interpreted_answers[1]\n\nconditions:\n [\n shuttles+coaches<=garage,\n shuttles>=min_shuttles,\n coaches>=min_coaches,\n coaches/(coaches+shuttles)>=prop_coaches,\n shuttles*price_shuttle + coaches*price_coach<=budget,\n shuttles*seats_shuttle + coaches*seats_coach >= min_seats\n ]\n\nconditions_unsatisfied:\n assert(all(conditions),\n incorrect(\"Your solution does not satisfy all of the conditions.\");\n end();\n true\n )\n \nstudent_profit: shuttles*profit_shuttle + coaches*profit_coach\n\nprofit_optimal:\n if(student_profit >= profit,\n correct(\"Your solution is optimal.\")\n ,\n incorrect(\"There is another solution which gives a higher profit.\")\n )\n\nmark:\n apply(all_valid);\n apply(conditions_unsatisfied);\n apply(profit_optimal)", "extendBaseMarkingAlgorithm": true, "unitTests": [], "prompt": "

Below is an optimal tableau for the linear program.

\n

{simplex_final_tableau(objective,equations)}

\n

How many shuttles and coaches should the company order, in order to maximise their profit?

\n

[[0]] shuttles

\n

[[1]] coaches

", "gaps": [{"type": "numberentry", "useCustomName": false, "customName": "", "marks": "0.5", "showCorrectAnswer": true, "showFeedbackIcon": false, "scripts": {}, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "adaptiveMarkingPenalty": 0, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "minValue": "num_shuttles", "maxValue": "num_shuttles", "correctAnswerFraction": true, "allowFractions": true, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "numberentry", "useCustomName": false, "customName": "", "marks": "0.5", "showCorrectAnswer": true, "showFeedbackIcon": false, "scripts": {}, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "adaptiveMarkingPenalty": 0, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "minValue": "num_coaches", "maxValue": "num_coaches", "correctAnswerFraction": true, "allowFractions": true, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "sortAnswers": false}], "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}, {"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}]}]}], "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}, {"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}]}