Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

from pulp import LpProblem, LpVariable, LpMinimize, LpContinuous, LpStatus, value # Define the problem lpProb = LpProblem(GVHS_Admission, LpMinimize) # Decision variables m1 = LpVariable(m1,

from pulp import LpProblem, LpVariable, LpMinimize, LpContinuous, LpStatus, value\ \ # Define the problem\ lpProb = LpProblem("GVHS_Admission", LpMinimize)\ \ # Decision variables\ m1 = LpVariable("m1", 0, None, 'Integer') # Male town residents\ f1 = LpVariable("f1", 0, None, 'Integer') # Female town residents\ m2 = LpVariable("m2", 0, None, 'Integer') # Male neighboring town residents\ f2 = LpVariable("f2", 0, None, 'Integer') # Female neighboring town residents\ m3 = LpVariable("m3", 0, None, 'Integer') # Male international students\ f3 = LpVariable("f3", 0, None, 'Integer') # Female international students\ \ # Deviation variables\ s1_minus = LpVariable("s1_minus", 0, None, LpContinuous) # Deviation from average GPA goal (negative)\ s1_plus = LpVariable("s1_plus", 0, None, LpContinuous) # Deviation from average GPA goal (positive)\ s2_minus = LpVariable("s2_minus", 0, None, LpContinuous) # Deviation from international student percentage goal (negative)\ s2_plus = LpVariable("s2_plus", 0, None, LpContinuous) # Deviation from international student percentage goal (positive)\ s3_minus = LpVariable("s3_minus", 0, None, LpContinuous) # Deviation from female-male ratio goal (negative)\ s3_plus = LpVariable("s3_plus", 0, None, LpContinuous) # Deviation from female-male ratio goal (positive)\ \ # Objective function (Minimize total deviation)\ lpProb += s1_minus + s1_plus + s2_minus + s2_plus + s3_minus + s3_plus, "Deviation"\ \ # Constraints\ lpProb += m1 + f1 + m2 + f2 + m3 + f3 >= 300, "Total Students"\ \ # Ratios\ lpProb += m1 == f1, "Town Ratio"\ lpProb += m2 == 2 * f2, "Neighboring Towns Ratio"\ lpProb += m3 == 4 * f3, "International Ratio"\ \ # Average GPA\ lpProb += (3.8 * m1 + 3.8 * f1 + 3.5 * m2 + 3.5 * f2 + 3.2 * m3 + 3.2 * f3) - (3.4 * (m1 + f1 + m2 + f2 + m3 + f3)) + s1_minus - s1_plus == 0\ \ # International Student Percentage\ lpProb += (m3 + f3) - (0.15 * (m1 + f1 + m2 + f2 + m3 + f3)) + s2_minus - s2_plus == 0\ \ # Female-Male Ratio\ lpProb += 3 * (f1 + f2 + f3) - (2 * (m1 + m2 + m3)) + s3_minus - s3_plus == 0\ \ # Solve the problem\ lpProb.solve()\ \ # Print results\ print("Status:", LpStatus[lpProb.status])\ print("Total deviation:", value(lpProb.objective))\ \ for i in lpProb.variables():\ print(f"Variable {i.name} = {i.varValue}")

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Managing Your Information How To Design And Create A Textual Database On Your Microcomputer

Authors: Tenopir, Carol, Lundeen, Gerald

1st Edition

1555700233, 9781555700232

More Books

Students also viewed these Databases questions