// Numbas version: finer_feedback_settings {"name": "Sensitivity analysis of a linear programming problem", "extensions": ["jsxgraph", "optimisation"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"variable_groups": [{"variables": [], "name": "Testing"}, {"variables": ["product_baseline", "x_bound", "y_bound", "resource_baseline", "profit_baseline"], "name": "Order of magnitude"}, {"variables": ["x_intercept_a", "y_intercept_a"], "name": "Constraint setup"}, {"variables": ["minimum_x", "minimum_y", "x_resource", "y_resource", "total_resource", "profit_x", "profit_y"], "name": "Final constraints"}, {"variables": ["x_intercept", "y_intercept", "inequality_coordinates"], "name": "Diagram data"}, {"variables": ["program", "best", "line_is_binding", "best_coords", "binding_lines"], "name": "Optimal solution"}, {"variables": ["line_names", "change_description", "line_prepositions"], "name": "Text"}, {"variables": ["nonbinding_line", "change", "changing_affects_solution"], "name": "Relax or tighten"}], "variables": {"resource_baseline": {"templateType": "anything", "group": "Order of magnitude", "definition": "repeat(\n 10^random(0..1)*random(1..9)*y_bound,\n 2\n)", "description": "", "name": "resource_baseline"}, "profit_baseline": {"templateType": "anything", "group": "Order of magnitude", "definition": "10^random(1,1,1,2,2,3)", "description": "", "name": "profit_baseline"}, "binding_lines": {"templateType": "anything", "group": "Optimal solution", "definition": "filter(line_is_binding[j],j,0..3)", "description": "", "name": "binding_lines"}, "line_is_binding": {"templateType": "anything", "group": "Optimal solution", "definition": "binding_lines(program)", "description": "", "name": "line_is_binding"}, "changing_affects_solution": {"templateType": "anything", "group": "Relax or tighten", "definition": "[\n best_coords[0]*x_resource[0]+best_coords[1]*y_resource[0]>total_resource[0]*change-0.0001,\n best_coords[0]*x_resource[1]+best_coords[1]*y_resource[1]>total_resource[1]*change-0.0001,\n best_coords[0]Graph goes here

", "scripts": {}, "type": "information", "showCorrectAnswer": true, "variableReplacementStrategy": "originalfirst", "variableReplacements": [], "marks": 0}, {"displayType": "radiogroup", "minMarks": 0, "layout": {"type": "all", "expression": ""}, "choices": ["{capitalise(line_names[0])}", "{capitalise(line_names[1])}", "{capitalise(line_names[2])}", "{capitalise(line_names[3])}"], "showCorrectAnswer": true, "matrix": "map(if(binding,[1,0],[0,1]),binding,line_is_binding)", "prompt": "

Which of the constraints are binding?

", "type": "m_n_x", "maxAnswers": 0, "shuffleChoices": false, "warningType": "none", "scripts": {}, "marks": 0, "minAnswers": 0, "maxMarks": 0, "shuffleAnswers": false, "variableReplacementStrategy": "originalfirst", "variableReplacements": [], "answers": ["Binding", "Non-binding"]}, {"displayType": "radiogroup", "choices": ["

Yes

", "

No

"], "showCorrectAnswer": true, "matrix": "if(changing_affects_solution,[1,0],[0,1])", "prompt": "

Suppose the {line_names[nonbinding_line]} {change_description}. Would that affect the optimal solution?

", "distractors": ["", ""], "shuffleChoices": false, "scripts": {}, "minMarks": 0, "type": "1_n_2", "maxMarks": 0, "displayColumns": 0, "variableReplacementStrategy": "originalfirst", "variableReplacements": [], "marks": 0}], "statement": "

A factory manufractures two products, X and Y. Existing demand means the factory must produce at least {minimum_x} units of product X and {minimum_y} units of product Y.

\n

A unit of X requires {x_resource[0]} units of resource 1 and {x_resource[1]} units of resource 2.

\n

A unit of Y requires {y_resource[0]} units of resource 1 and {y_resource[1]} units of resource 2.

\n

Each unit of product X sold earns £{profit_x} profit, and each unit of product Y sold earns £{profit_y} profit.

", "tags": ["linear programming", "MAS1901", "sensitivity analysis"], "rulesets": {}, "preamble": {"css": "", "js": "var optimisation = Numbas.extensions.optimisation;\n\nquestion.onHTMLAttached(function() {\n with(question.unwrappedVariables) {\n var result = optimisation.linear_programming_board({\n x_bound: x_bound,\n y_bound: y_bound,\n objective_line_coordinates: [-(minimum_x*profit_x + minimum_y*profit_y),profit_x,profit_y],\n minimum_x: minimum_x,\n minimum_y: minimum_y,\n inequality_1_coordinates: inequality_coordinates[0],\n inequality_2_coordinates: inequality_coordinates[1],\n coord_point: false\n });\n result.inequality_line_1.setAttribute({fixed:false, withLabel:true, name: 'Resource 1'});\n result.inequality_line_2.setAttribute({fixed:false, withLabel:true, name: 'Resource 2'});\n result.x_constraint_line.setAttribute({fixed:false});\n result.y_constraint_line.setAttribute({fixed:false});\n \n var board = result.board;\n \n var shadow_inequality_line_1 = board.create('line',inequality_coordinates[0],{withLabel:false,color:'lightgray', highlight: false, fixed: true});\n var shadow_inequality_line_2 = board.create('line',inequality_coordinates[1],{withLabel:false,color:'lightgray', highlight: false, fixed: true});\n var shadow_x_constraint_line = board.create('line',[[minimum_x,0],[minimum_x,1]],{withLabel:false,color:'lightgray', highlight: false, fixed: true});\n var shadow_y_constraint_line = board.create('line',[[0,minimum_y],[1,minimum_y]],{withLabel:false,color:'lightgray', highlight: false, fixed: true});\n shadow_inequality_line_1.visProp.layer = 1;\n shadow_inequality_line_2.visProp.layer = 1;\n shadow_x_constraint_line.visProp.layer = 1;\n shadow_y_constraint_line.visProp.layer = 1;\n \n board.update();\n \n window.result = result;\n\n $(question.display.html).find('.lp-graph').html('').append(result.div);\n \n }\n});"}, "type": "question", "metadata": {"notes": "", "licence": "Creative Commons Attribution 4.0 International", "description": "

Student is shown a linear programming problem, with graphical solution. 

\n

Asked to identify binding constraints, and decide if the optimal solution is changed by a named constraint either doubling or halving.

"}, "variablesTest": {"condition": "", "maxRuns": "100"}, "advice": "

a)

\n

The optimal solution is found at the intersection of the lines representing {line_names[binding_lines[0]]} and {line_names[binding_lines[1]]}. These constraints are binding; the other constraints are non-binding.

\n

b)

\n

If the {line_names[nonbinding_line]} {change_description}, the optimal solution found earlier ends up {line_prepositions[1][nonbinding_line]} the line representing the {line_names[nonbinding_line]}, making it invalidis still {line_prepositions[0][nonbinding_line]} the line representing the {line_names[nonbinding_line]}, so the optimal solution is not affected.

", "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/"}]}