// Numbas version: exam_results_page_options {"name": "Transportation problem - apply minimum cost algorithm to unbalanced problem", "extensions": ["optimisation"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"variable_groups": [{"variables": ["num_sources", "num_destinations", "total", "omit_source", "show_sources", "show_destinations"], "name": "Setup"}, {"variables": ["supply", "demand", "costs", "show_supply", "show_demand", "show_costs", "dummy_resource"], "name": "Initial data"}, {"variables": ["assignment", "assignment_cost", "show_assignment"], "name": "Minimum costs"}], "variables": {"show_assignment": {"group": "Minimum costs", "templateType": "anything", "definition": "matrix(map(\n map(\n assignment[x][y],\n y,\n 0..show_destinations-1\n ),\n x,\n 0..show_sources-1\n))", "description": "", "name": "show_assignment"}, "costs": {"group": "Initial data", "templateType": "anything", "definition": "matrix(map(\n map(\n if(xBy adding dummy sources or destinations, balance this problem.

\n

The balanced problem adds another [[0]] with [[1]] units of coal.

\n

Enter the cost matrix for the balanced problem below.

\n

[[2]]

", "unitTests": [], "showFeedbackIcon": true, "scripts": {}, "gaps": [{"displayType": "radiogroup", "showCorrectAnswer": true, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "matrix": "if(omit_source,[1,0],[0,1])", "choices": ["

pit

", "

power station

"], "unitTests": [], "variableReplacements": [], "shuffleChoices": false, "showFeedbackIcon": true, "scripts": {}, "minMarks": 0, "type": "1_n_2", "maxMarks": 0, "variableReplacementStrategy": "originalfirst", "displayColumns": 0, "marks": 0}, {"showCorrectAnswer": true, "allowFractions": false, "customMarkingAlgorithm": "", "mustBeReduced": false, "extendBaseMarkingAlgorithm": true, "minValue": "dummy_resource", "maxValue": "dummy_resource", "unitTests": [], "correctAnswerStyle": "plain", "variableReplacementStrategy": "originalfirst", "showFeedbackIcon": true, "scripts": {}, "type": "numberentry", "notationStyles": ["plain", "en", "si-en"], "correctAnswerFraction": false, "variableReplacements": [], "marks": 1, "mustBeReducedPC": 0}, {"showCorrectAnswer": true, "markPerCell": false, "allowFractions": false, "correctAnswer": "costs", "extendBaseMarkingAlgorithm": true, "customMarkingAlgorithm": "", "allowResize": true, "unitTests": [], "correctAnswerFractions": false, "numRows": 1, "scripts": {}, "type": "matrix", "numColumns": 1, "tolerance": 0, "variableReplacementStrategy": "originalfirst", "variableReplacements": [], "marks": 1, "showFeedbackIcon": true}], "type": "gapfill", "variableReplacementStrategy": "originalfirst", "variableReplacements": [], "marks": 0, "sortAnswers": false}, {"scripts": {}, "showCorrectAnswer": true, "markPerCell": false, "allowFractions": false, "correctAnswer": "show_assignment", "extendBaseMarkingAlgorithm": true, "customMarkingAlgorithm": "", "prompt": "

Apply the minimum cost algorithm to your balanced problem to find an assignment of units of coal to be transported between pits and power stations.

\n

When there's more than one choice of cell, choose the cell with the maximum available allocation.

", "unitTests": [], "correctAnswerFractions": false, "numRows": "show_sources", "allowResize": false, "type": "matrix", "numColumns": "show_destinations", "tolerance": 0, "variableReplacementStrategy": "originalfirst", "variableReplacements": [{"part": "p0g2", "must_go_first": false, "variable": "costs"}], "marks": 1, "showFeedbackIcon": true}, {"showCorrectAnswer": true, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "prompt": "

What is the total cost of this solution?

\n

£ [[0]]

", "unitTests": [], "showFeedbackIcon": true, "scripts": {}, "gaps": [{"showCorrectAnswer": true, "allowFractions": false, "customMarkingAlgorithm": "", "mustBeReduced": false, "extendBaseMarkingAlgorithm": true, "minValue": "assignment_cost", "maxValue": "assignment_cost", "unitTests": [], "correctAnswerStyle": "plain", "variableReplacementStrategy": "originalfirst", "showFeedbackIcon": true, "scripts": {}, "type": "numberentry", "notationStyles": ["plain", "en", "si-en"], "correctAnswerFraction": false, "variableReplacements": [{"part": "p1", "must_go_first": false, "variable": "assignment"}], "marks": 1, "mustBeReducedPC": 0}], "type": "gapfill", "variableReplacementStrategy": "originalfirst", "variableReplacements": [], "marks": 0, "sortAnswers": false}], "statement": "

Four power stations labelled $j = 1,2,3,4$ require {show_variable_list(show_demand,'b')} units of coal, respectively. These are to be provided by three pits labelled $i=1,2,3$, which have supplies of {show_variable_list(show_supply,'a')} units of coal, respectively.

\n

The cost $c_{ij}$, in pounds, of transporting one unit of coal from pit $i$ to power station $j$ is in the following table (with supplies and demand shown in the margin).

\n

{cost_table(show_supply,show_demand,show_costs)}

", "tags": [], "rulesets": {}, "preamble": {"css": "", "js": ""}, "type": "question", "metadata": {"licence": "Creative Commons Attribution 4.0 International", "description": "

Although the statement has 4 power stations and 3 pits, when the question is run sometimes 3 power stations are given and sometimes 4 pits.

"}, "extensions": ["optimisation"], "variablesTest": {"condition": "", "maxRuns": 100}, "advice": "

a)

\n

The total supply is {sum(show_supply)}, while the total demand is {sum(show_demand)}, so we need to add a dummy {if(omit_source,'pit supplying','power station demanding')} {dummy_resource} units of coal.

\n

The cost matrix then looks like this:

\n

{cost_table(supply,demand,costs)}

\n

b)

\n

The following tables show each step of the minimum cost algorithm:

\n

{minimum_cost_display(supply,demand,costs)}

\n

c)

\n

The total cost of this solution is $\\var{show_cost_calculation(assignment,costs)}$.

", "contributors": [{"name": "Bill Foster", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/6/"}, {"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}]}]}], "contributors": [{"name": "Bill Foster", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/6/"}, {"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}]}