// Numbas version: exam_results_page_options {"name": "Transportation problem - apply minimum cost algorithm", "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"], "name": "Setup"}, {"variables": ["supply", "demand", "costs"], "name": "Initial data"}, {"variables": ["assignment", "assignment_cost"], "name": "Minimum costs"}], "variables": {"costs": {"templateType": "anything", "group": "Initial data", "definition": "matrix(repeat(\n repeat(\n random(1..9),\n num_destinations\n ),\n num_sources\n))", "description": "", "name": "costs"}, "num_sources": {"templateType": "anything", "group": "Setup", "definition": "random(3..5)", "description": "", "name": "num_sources"}, "num_destinations": {"templateType": "anything", "group": "Setup", "definition": "7-num_sources+random(0,1)", "description": "", "name": "num_destinations"}, "assignment": {"templateType": "anything", "group": "Minimum costs", "definition": "minimum_cost(supply,demand,costs)", "description": "", "name": "assignment"}, "assignment_cost": {"templateType": "anything", "group": "Minimum costs", "definition": "assignment_cost(assignment,costs)", "description": "", "name": "assignment_cost"}, "total": {"templateType": "anything", "group": "Setup", "definition": "random(50..500)", "description": "", "name": "total"}, "supply": {"templateType": "anything", "group": "Initial data", "definition": "random_partition(total,num_sources)", "description": "", "name": "supply"}, "demand": {"templateType": "anything", "group": "Initial data", "definition": "random_partition(total,num_destinations)", "description": "", "name": "demand"}}, "ungrouped_variables": [], "rulesets": {}, "name": "Transportation problem - apply minimum cost algorithm", "functions": {"show_variable_list": {"type": "string", "language": "javascript", "definition": "return data.map(function(n,i) {\n return '$'+name+'_{'+(i+1)+'} = '+Numbas.math.niceNumber(n)+'$';\n}).join(', ');", "parameters": [["data", "list"], ["name", "string"]]}}, "showQuestionGroupNames": false, "parts": [{"showCorrectAnswer": true, "markPerCell": false, "allowFractions": false, "correctAnswer": "assignment", "allowResize": false, "prompt": "

Apply the minimum cost algorithm 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.

", "correctAnswerFractions": false, "numRows": "num_sources", "scripts": {}, "type": "matrix", "numColumns": "num_destinations", "tolerance": 0, "variableReplacementStrategy": "originalfirst", "variableReplacements": [], "marks": 1}, {"showCorrectAnswer": true, "allowFractions": false, "variableReplacementStrategy": "originalfirst", "minValue": "assignment_cost", "prompt": "

What is the total cost of this solution?

", "showPrecisionHint": false, "scripts": {}, "type": "numberentry", "correctAnswerFraction": false, "variableReplacements": [{"part": "p0", "must_go_first": false, "variable": "assignment"}], "marks": 1, "maxValue": "assignment_cost"}], "variablesTest": {"condition": "", "maxRuns": "3000"}, "statement": "

Four power stations labelled $j = 1,2,3,4$ require {show_variable_list(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(supply,'a')} units of coal, respectively.

\n

The cost $c_{ij}$ 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(supply,demand,costs)}

", "tags": [], "question_groups": [{"pickingStrategy": "all-ordered", "questions": [], "name": "", "pickQuestions": 0}], "preamble": {"css": "", "js": ""}, "type": "question", "metadata": {"notes": "", "licence": "Creative Commons Attribution 4.0 International", "description": ""}, "advice": "

a)

\n

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

\n

{minimum_cost_display(supply,demand,costs)}

\n

b)

\n

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

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