// Numbas version: exam_results_page_options {"name": "Economic Dispatch", "extensions": [], "custom_part_types": [], "resources": [["question-resources/ED_Figure.svg", "/srv/numbas/media/question-resources/ED_Figure.svg"], ["question-resources/Picture1.svg", "/srv/numbas/media/question-resources/Picture1.svg"]], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"name": "Economic Dispatch", "tags": [], "metadata": {"description": "

An economic dispatch problem with three generators. The steps help the students to solve this using lagrangian multipliers. This question is designed to allow students studying economic dispatch to practice solving the problem.

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

Three generators supply the load in an electricity transmission network. The total load is {Demand} MW. The generators have the following cost functions:

\n

\n

CX={b_x}x+{a_x}x2

\n

Cy={b_y}y+{a_y}y2

\n

Cz={b_z}z+{a_z}z2

\n

\n

", "advice": "

The answer is ultimately found by finding the point at which the gradients of all three cost functions are the same which corresponds to  x + y + z = Demand.

\n

The first step in this is to work out the marginal cost (aka the first derivative) of each generator. These will then be used later. If the cost function is ax+bx2, then the first derivative will be a+2bx.

\n

The next step is to write the equality constraint, this will be x + y + z = Demand, but needs to be rearranged to x + y + z - Demand = 0.

\n

Then we can form the lagrangian, which is L=Cx + Cy + Cz  + h(x + y + z - Demand).

\n

Taking partial derivatives of this with respect to x, y, z, and h will give a system of 4 simultaneous equations with 4 unknown, these can be solved to give the optimal values of x, y, and z, as well as the value of h which is the \"shadow price\" of electricity.

", "rulesets": {}, "extensions": [], "builtin_constants": {"e": true, "pi,\u03c0": true, "i": true}, "constants": [], "variables": {"a_x": {"name": "a_x", "group": "Ungrouped variables", "definition": "random(0.1 .. 1#0.1)", "description": "

Quadratic cost coefficient

", "templateType": "randrange", "can_override": false}, "a_y": {"name": "a_y", "group": "Ungrouped variables", "definition": "random(0.1 .. 1#0.1)", "description": "", "templateType": "randrange", "can_override": false}, "a_z": {"name": "a_z", "group": "Ungrouped variables", "definition": "random(0.5 .. 1.5#0.1)", "description": "", "templateType": "randrange", "can_override": false}, "b_x": {"name": "b_x", "group": "Ungrouped variables", "definition": "random(1 .. 10#1)", "description": "", "templateType": "randrange", "can_override": false}, "b_y": {"name": "b_y", "group": "Ungrouped variables", "definition": "random(1 .. 10#1)", "description": "", "templateType": "randrange", "can_override": false}, "b_z": {"name": "b_z", "group": "Ungrouped variables", "definition": "random(5 .. 15#1)", "description": "", "templateType": "randrange", "can_override": false}, "demand": {"name": "demand", "group": "Ungrouped variables", "definition": "random(200 .. 400#10)", "description": "", "templateType": "randrange", "can_override": false}, "h": {"name": "h", "group": "Ungrouped variables", "definition": "(2*demand+b_x/a_x+b_y/a_y+b_z/a_z)/(1/a_x+1/a_y+1/a_z)", "description": "

Lagrangian Multiplier

", "templateType": "anything", "can_override": false}, "x_opt": {"name": "x_opt", "group": "Ungrouped variables", "definition": "(h-b_x)/(2*a_x)", "description": "", "templateType": "anything", "can_override": false}, "y_opt": {"name": "y_opt", "group": "Ungrouped variables", "definition": "(h-b_y)/(2*a_y)", "description": "", "templateType": "anything", "can_override": false}, "z_opt": {"name": "z_opt", "group": "Ungrouped variables", "definition": "(h-b_z)/(2*a_z)", "description": "", "templateType": "anything", "can_override": false}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["a_x", "a_y", "a_z", "b_x", "b_y", "b_z", "demand", "h", "x_opt", "y_opt", "z_opt"], "variable_groups": [], "functions": {}, "preamble": {"js": "", "css": ""}, "parts": [{"type": "jme", "useCustomName": false, "customName": "", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "

Enter the formula for the marginal cost of generator x

", "answer": "2*{a_x}x+{b_x}", "showPreview": true, "checkingType": "absdiff", "checkingAccuracy": 0.001, "failureRate": 1, "vsetRangePoints": 5, "vsetRange": [0, 1], "checkVariableNames": false, "singleLetterVariables": false, "allowUnknownFunctions": true, "implicitFunctionComposition": false, "caseSensitive": false, "valuegenerators": [{"name": "x", "value": ""}]}, {"type": "jme", "useCustomName": false, "customName": "", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "

Enter the formula for the marginal cost of generator y

", "answer": "2*{a_y}y+{b_y}", "showPreview": true, "checkingType": "absdiff", "checkingAccuracy": 0.001, "failureRate": 1, "vsetRangePoints": 5, "vsetRange": [0, 1], "checkVariableNames": false, "singleLetterVariables": false, "allowUnknownFunctions": true, "implicitFunctionComposition": false, "caseSensitive": false, "valuegenerators": [{"name": "y", "value": ""}]}, {"type": "jme", "useCustomName": false, "customName": "", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "

Enter the formula for the marginal cost of generator z

", "answer": "2*{a_z}z+{b_z}", "showPreview": true, "checkingType": "absdiff", "checkingAccuracy": 0.001, "failureRate": 1, "vsetRangePoints": 5, "vsetRange": [0, 1], "checkVariableNames": false, "singleLetterVariables": false, "allowUnknownFunctions": true, "implicitFunctionComposition": false, "caseSensitive": false, "valuegenerators": [{"name": "z", "value": ""}]}, {"type": "jme", "useCustomName": false, "customName": "", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "

Enter the equality constraint which ensures that the total demand is met by the three generators. Enter it in the form that is equal to 0.

", "answer": "x+y+z-{Demand}", "showPreview": true, "checkingType": "absdiff", "checkingAccuracy": 0.001, "failureRate": 1, "vsetRangePoints": 5, "vsetRange": [0, 1], "checkVariableNames": false, "singleLetterVariables": false, "allowUnknownFunctions": true, "implicitFunctionComposition": false, "caseSensitive": false, "valuegenerators": [{"name": "x", "value": ""}, {"name": "y", "value": ""}, {"name": "z", "value": ""}]}, {"type": "gapfill", "useCustomName": false, "customName": "", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "

Write our the full optimisation problem, using h for the Lagrangian multiplier.

\n

[[0]]

", "gaps": [{"type": "jme", "useCustomName": false, "customName": "", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "alternatives": [{"type": "jme", "useCustomName": false, "customName": "", "marks": "1", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "alternativeFeedbackMessage": "", "useAlternativeFeedback": false, "answer": "C_x+C_y+C_z-h*(x+y+z-{Demand})", "showPreview": true, "checkingType": "absdiff", "checkingAccuracy": 0.001, "failureRate": 1, "vsetRangePoints": 5, "vsetRange": [0, 1], "checkVariableNames": false, "singleLetterVariables": false, "allowUnknownFunctions": true, "implicitFunctionComposition": false, "caseSensitive": false, "valuegenerators": [{"name": "c_x", "value": ""}, {"name": "c_y", "value": ""}, {"name": "c_z", "value": ""}, {"name": "h", "value": ""}, {"name": "x", "value": ""}, {"name": "y", "value": ""}, {"name": "z", "value": ""}]}], "answer": "{b_x}x+{a_x}x^2+{b_y}y+{a_y}y^2+{b_z}z+{a_z}z^2-h*(x+y+z-{Demand})", "showPreview": true, "checkingType": "absdiff", "checkingAccuracy": 0.001, "failureRate": 1, "vsetRangePoints": 5, "vsetRange": [0, 1], "checkVariableNames": false, "singleLetterVariables": false, "allowUnknownFunctions": true, "implicitFunctionComposition": false, "caseSensitive": false, "valuegenerators": [{"name": "h", "value": ""}, {"name": "x", "value": ""}, {"name": "y", "value": ""}, {"name": "z", "value": ""}]}], "sortAnswers": false}, {"type": "numberentry", "useCustomName": false, "customName": "", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [{"variable": "a_x", "part": "p0", "must_go_first": false}], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "

By taking partial derivatives of the optimisation problem, calculate the value of h.

", "minValue": "h-0.05", "maxValue": "h+0.05", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "numberentry", "useCustomName": false, "customName": "", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [{"variable": "h", "part": "p5", "must_go_first": false}], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "

What is the optimal value of x?

", "minValue": "x_opt-0.01", "maxValue": "x_opt+0.01", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "numberentry", "useCustomName": false, "customName": "", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [{"variable": "h", "part": "p5", "must_go_first": false}], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "

What is the optimal value of y?

", "minValue": "y_opt-0.01", "maxValue": "y_opt+0.01", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "numberentry", "useCustomName": false, "customName": "", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [{"variable": "h", "part": "p7", "must_go_first": false}], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "

What is the optimal value of z?

", "minValue": "z_opt-0.01", "maxValue": "z_opt+0.01", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always", "contributors": [{"name": "David Greenwood", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/23643/"}]}]}], "contributors": [{"name": "David Greenwood", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/23643/"}]}