Close Menu
    Trending
    • Gemini introducerar funktionen schemalagda åtgärder i Gemini-appen
    • AIFF 2025 Runway’s tredje årliga AI Film Festival
    • AI-agenter kan nu hjälpa läkare fatta bättre beslut inom cancervård
    • Not Everything Needs Automation: 5 Practical AI Agents That Deliver Enterprise Value
    • Prescriptive Modeling Unpacked: A Complete Guide to Intervention With Bayesian Modeling.
    • 5 Crucial Tweaks That Will Make Your Charts Accessible to People with Visual Impairments
    • Why AI Projects Fail | Towards Data Science
    • The Role of Luck in Sports: Can We Measure It?
    ProfitlyAI
    • Home
    • Latest News
    • AI Technology
    • Latest AI Innovations
    • AI Tools & Technologies
    • Artificial Intelligence
    ProfitlyAI
    Home » Linear Programming: Managing Multiple Targets with Goal Programming
    Artificial Intelligence

    Linear Programming: Managing Multiple Targets with Goal Programming

    ProfitlyAIBy ProfitlyAIApril 3, 2025No Comments13 Mins Read
    Share Facebook Twitter Pinterest LinkedIn Tumblr Reddit Telegram Email
    Share
    Facebook Twitter LinkedIn Pinterest Email


    That is the (and sure final) a part of a Linear Programming sequence I’ve been writing. With the core ideas lined by the prior articles, this text focuses on objective programming which is a much less frequent linear programming (LP) use case. Purpose programming is a particular linear programming setup that may deal with the optimization of a number of targets in a single LP drawback.

    By the top of this text, you’ll perceive:
    1. Definition of objective programming and when it must be used
    2. The weighted objective programming strategy — illustrated with an instance
    3. The preemptive objective programming strategy — illustrated with an instance

    Definition and Use Case of Purpose Programming

    Purpose programming is a particular case of linear programming that permits for a number of — usually conflicting — targets to be balanced. With common LP issues, you choose a single metric to optimize (decrease or maximize) and set constraints to make sure that the optimum answer is possible. Purpose programming is a way that permits for a number of goal metrics to be focused on the identical time.

    The ‘mindset’ of objective programming is basically totally different from plain vanilla LP issues. Primary LP searches for tactics to get as little or as a lot of a single metric as potential — e.g., maximize revenue or decrease waste  — topic to constraints. Usually conflicting priorities shall be discovered within the goal perform or the constraints. For instance, maximize revenue (goal) topic to a most quantity of waste (constraint). With objective programming, we are able to transfer vital constraint metrics into the target perform so we are able to optimize on them slightly than simply constraining them. We will maximize revenue and decrease waste on the identical time!

    Now is an efficient time to ascertain the instance we’ll probe for the remainder of the article:

    Let’s think about that we handle a manufacturing unit that makes clothes. Our manufacturing unit could make pants, shirts, and attire. Every article of clothes has prices, revenue, and waste related to their manufacturing. We need to create a manufacturing plan that may make a sure stage of revenue and likewise waste under a sure amount attributable to an environmental dedication. Let’s say that we need to make $150k a month in revenue and we additionally need to waste lower than 20k yards of cloth. Along with our objectives, we are able to’t spend greater than $50k in supplies and labor. 

    The instance above sounds lots like a daily linear programming drawback proper? Effectively, the twist is that we are able to’t make $150k in revenue and waste lower than 20k of yards on the identical time. In different phrases, there can be no possible answer if we had been to plug this into a daily linear programming drawback. Usually, the objectives set within the issues can’t all be achieved with a single answer, in any other case there wouldn’t be a degree in utilizing objective programming. We might simply use common previous linear programming with our objectives as constraints. The true worth of objective programming is that it may well create a compromise between conflicting objectives when common linear programming would yield an infeasible answer.

    The true worth of objective programming is that it may well create a compromise between conflicting objectives when common linear programming would yield an infeasible answer.

    How does objective programming stability and compromise with conflicting objectives? There are two standard approaches: (1) weighted and (2) preemptive. We’ll cowl these intimately within the following sections.

    The weights strategy

    Right here, we’ll dive into the small print of the weights strategy. The weights technique has a single goal perform and runs a single Optimization primarily based on (you guessed it) weights! The truth that just one optimization is run below the weights technique could look like a given — however the preemptive technique really runs a number of linear programming optimizations. We’ll get to that within the subsequent part…

    The weights technique has particular targets or objectives for a number of metrics — e.g., make no less than $150k in revenue promoting garments or waste not more than 20k yards of cloth. For normal LP, we need to absolutely optimize. For the weights technique of objective programming, we need to get as near hitting objectives as potential — after we attain a objective, the optimization doesn’t see extra profit in additional maximization or minimization, so it prioritizes hitting the following most vital objective. If this appears complicated now, don’t fear it’s going to make extra sense as we get into the instance.

    The goal perform for the weights strategy is specifically formulated to reduce the weighted variations between a metric’s objective and the precise worth of the metric. Let’s leap to our instance from above — i.e., we need to make $150k in revenue and waste lower than 20k yards of uncooked materials. Our goal is to reduce how far off we’re from each of those objectives. 

    Right here is the mathematical formulation for this goal:

    The place w1 and w2 are assigned weights and P and W are how far we miss our revenue and waste objectives respectively

    With our goal perform arrange, we have to outline our constraints. We can have two kinds of constraints (1) objective associated constraints and (2) common linear programming constraints (the identical form of constraints you’d discover in plain vanilla LP). Let’s speak in regards to the objective associated constraints first.

    We might want to create two issues to arrange our objective associated constraints, (1) revenue and waste capabilities and (2) a number of slack variables. Let’s undergo these separately.

    The revenue and waste capabilities are very straight ahead. They mix our choice variables collectively to calculate whole revenue and whole waste give a particular answer. Under are the formulation that tie revenue and waste to the variety of pants, shirts and attire we produce:

    revenue and waste capabilities

    With our revenue and waste capabilities established, let’s begin speaking about our slack variables. In objective programming, slack variables are used to measure how far an answer is from hitting a objective. In our instance, the variables P and W are each slack variables — they signify how a lot decrease our revenue is in comparison with our revenue objective and the way a lot larger our waste is in comparison with our waste objective. Slack variables are embedded in constraints. Under are the constraint capabilities for our revenue and waste objectives — once more, the P’s and the W’s are our slack variables:

    P+, P-, W+ and W- are slack variables, revenue and waste are capabilities established with the formulation above

    Notice that we’ve plus and minus slack variables — this enables us to overlook the objective on both finish. We solely need to penalize the slack variable that goes in the other way of our objective (e.g., we don’t need to penalize extra revenue than our objective, we solely need to penalize much less revenue) — that’s the reason just one slack variable per objective is within the goal perform. With this new notation, let’s rewrite our goal perform:

    Goal perform with up to date slack variable notation

    We’ve got now finished the entire particular work for objective programming. The very last thing we have to do is rapidly add our plain vanilla funds constraint. We’re utilizing a daily constraint for our funds as a result of, in our instance, it’s a exhausting constraint. Not like with revenue and waste, we can’t violate the funds.

    Common (not objective programming associated) funds constraint

    Now, we’ve a completely specified objective programming drawback. Let’s set it up in Python and remedy!

    # $150,000 in revenue
    drawback += revenue + profit_deviation_neg - profit_deviation_pos == 150000, "Profit_Goal"
    
    # Waste objective: Not more than 20,000 yards of waste
    drawback += waste + waste_deviation_neg - waste_deviation_pos == 20000, "Cost_Goal"
    
    # Funds constraint
    drawback += value <= 50000
    
    # Resolve the issue
    drawback.remedy()
    
    # Show the outcomes
    print("Standing:", pulp.LpStatus[problem.status])
    print("Pants produced:", pulp.worth(pants))
    print("Shirts produced:", pulp.worth(shirts))
    print("Clothes produced:", pulp.worth(attire))
    print("Value :", pulp.worth(value))
    print("Revenue :", pulp.worth(revenue))
    print("Revenue deviation (optimistic):", pulp.worth(profit_deviation_pos))
    print("Revenue deviation (destructive):", pulp.worth(profit_deviation_neg))
    print("Waste :", pulp.worth(waste))
    print("Waste deviation (optimistic):", pulp.worth(waste_deviation_pos))
    print("Waste deviation (destructive):", pulp.worth(waste_deviation_neg))

    This optimization recommends we make 0 pants, 5,000 shirts and 0 attire. We make $150k in revenue which matches our objective precisely and we waste 50k yards of cloth which exceeds our max waste by 30k yards. The total outcomes are printed by the code and proven under:

    outcomes of optimization run with equal weights

    Now that we’ve obtained the fundamental construction of the weights strategy down, let’s really speak in regards to the weights! In our first instance, we gave equal weights to a greenback of revenue and to a yard of waste. This most likely doesn’t make a variety of sense as a result of they’re totally different models. Setting the weights is a subjective choice to be made by the practitioner. For our instance, we’ll determine that losing 1.5 yards of cloth is as unhealthy as making $1 of revenue is sweet. In different phrases, we’ll enhance the load of cloth waste to 1.5 in our goal perform.

    drawback += profit_deviation_neg + 1.5*waste_deviation_pos

    The optimization with the up to date charges recommends we make about 8,572 pants, 7,143 shirts and 0 attire. With this answer, we generate $107k in revenue (which is a objective miss of $43k) and we waste 20,000 yards of cloth which matches our objective precisely. The total outcomes are printed by the code and proven under:

    Outcomes of optimization run with 1.5 weight on cloth waste

    Clearly, shifting the weights of the objectives can have massive impression on the optimization outcomes. We have to fastidiously set our weights to adequately stability the relative significance of our objectives!

    Now that we’ve a stable understanding of how the weighted strategy works, let’s shift to speaking in regards to the objective programming with the preemptive strategy.

    Preemptive Strategy

    Whereas the weights technique balances objectives utilizing weights within the goal perform, the preemptive technique provides hierarchical precedence to objectives by way of iterative optimizations. That’s a variety of phrases, don’t fear, we’ll break it down!

    Listed below are the steps to the preemptive strategy:

    1. Run a daily linear programming optimization in your first objective — e.g., maximize revenue
    2. Save the target worth from that run
    3. Run one other common linear programming on the following most vital objective — e.g., decrease waste — however, add the target worth from the final run as a constraint
    4. Repeat the method till you’ve gone by way of all objective metrics

    Two vital options of the preemptive technique are (1) it prioritizes objectives by rank and (2) the target worth of a better significance objective can’t be decreased (due to the exhausting constraint) when optimizing decrease precedence objectives. Let’s go over an instance to construct instinct.

    For our instance, let’s say that revenue is an important objective and minimizing waste is the second. We’ll begin out by working a plain vanilla optimization that maximizes revenue:

    # Outline the issue
    drawback = pulp.LpProblem("Clothing_Company_Goal_Programming", pulp.LpMaximize)
    
    # Determination variables: variety of pants, shirts, and attire produced
    pants = pulp.LpVariable('pants', lowBound=0, cat='Steady')
    shirts = pulp.LpVariable('shirts', lowBound=0, cat='Steady')
    attire = pulp.LpVariable('attire', lowBound=0, cat='Steady')
    
    # Revenue and price coefficients
    revenue = 10 * pants + 3 * shirts + 15 * attire
    value = 5 * pants + 1 * shirts + 10 * attire
    waste = 1.5 * pants + 1 * shirts + 3 * attire
    
    # Goal perform: Maximize revenue
    drawback += revenue
    
    # Constraints
    # Funds constraint
    drawback += value <= 50000
    
    # Resolve the issue
    drawback.remedy()
    
    # Show the outcomes
    print("Standing:", pulp.LpStatus[problem.status])
    print("Pants produced:", pulp.worth(pants))
    print("Shirts produced:", pulp.worth(shirts))
    print("Clothes produced:", pulp.worth(attire))
    print("Value :", pulp.worth(value))
    print("Revenue :", pulp.worth(revenue))

    The outcomes of the revenue maximizing LP drawback are under:

    Revenue maximization

    So, our goal perform says to make 50k shirts and acquire a revenue of $150k. This was solely the primary optimization we’re going to run although! Following the algorithm outlined above, we’ll now run one other LP that minimizes waste however, we’ll add a constraint of revenue ≥ $150k to make sure we don’t get a worse revenue.

    # Outline the issue
    drawback = pulp.LpProblem("Clothing_Company_Goal_Programming", pulp.LpMinimize)
    
    # Determination variables: variety of pants, shirts, and attire produced
    pants = pulp.LpVariable('pants', lowBound=0, cat='Steady')
    shirts = pulp.LpVariable('shirts', lowBound=0, cat='Steady')
    attire = pulp.LpVariable('attire', lowBound=0, cat='Steady')
    
    # Revenue and price coefficients
    revenue = 10 * pants + 3 * shirts + 15 * attire
    value = 5 * pants + 1 * shirts + 10 * attire
    waste = 1.5 * pants + 1 * shirts + 3 * attire
    
    # Goal perform: Decrease the material waste
    drawback += waste
    
    # Funds constraint
    drawback += value <= 50000
    
    drawback += revenue >= 150000
    
    # Resolve the issue
    drawback.remedy()
    
    # Show the outcomes
    print("Standing:", pulp.LpStatus[problem.status])
    print("Pants produced:", pulp.worth(pants))
    print("Shirts produced:", pulp.worth(shirts))
    print("Clothes produced:", pulp.worth(attire))
    print("Value :", pulp.worth(value))
    print("Revenue :", pulp.worth(revenue))

    And listed below are the outcomes of this last optimization:

    outcomes of waste minimizing optimization

    The astute observer will discover that the optimization is the very same 😅. This may usually be the case with the preemptive technique. The constraint of beforehand optimized objectives may be very restrictive. The one time when iterative optimizations are totally different is that if there are a number of methods to get the optimum values for earlier objectives. For instance, if there have been two methods to get $150k in revenue; one had extra waste and the opposite had much less, our second iteration would return the outcomes of the answer with the decrease waste. Within the preemptive technique, there is no such thing as a commerce off between the objectives. Even when there was an answer that made $149k in revenue with 0 yards of waste, the preemptive technique would at all times select $150k in revenue with 50k yards of waste. The additional $1000 of revenue is infinitely extra vital than any quantity of wasted cloth.

    The preemptive technique must be used when objectives are clearly prioritized, and there’s no substitution between them — which means no quantity of success in decrease precedence objectives can compensate for decreased optimization in larger precedence ones. When used appropriately, the preemptive technique may also help optimize a main objective whereas looking for good options for decrease precedence objectives very successfully.

    Conclusion

    Purpose programming gives a framework that extends conventional linear programming to optimize a number of metrics on the identical time. The weighted strategy balances priorities through weights within the goal perform and is suitable when goal metrics have relative significance that may be quantified. The preemptive technique is an iterative strategy that provides precedence to metrics primarily based on hierarchy. It’s acceptable when some targets are wholly extra vital than others. Each approaches may be highly effective optimization methods when utilized within the right context!

    Glad optimizing!

    Earlier articles on this sequence:



    Source link

    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email
    Previous ArticleThe first trial of generative AI therapy shows it might help with depression
    Next Article Undetectable AI vs. Grammarly’s AI Detector: It’s One-Sided
    ProfitlyAI
    • Website

    Related Posts

    Artificial Intelligence

    Not Everything Needs Automation: 5 Practical AI Agents That Deliver Enterprise Value

    June 6, 2025
    Artificial Intelligence

    Prescriptive Modeling Unpacked: A Complete Guide to Intervention With Bayesian Modeling.

    June 6, 2025
    Artificial Intelligence

    5 Crucial Tweaks That Will Make Your Charts Accessible to People with Visual Impairments

    June 6, 2025
    Add A Comment
    Leave A Reply Cancel Reply

    Top Posts

    Grammar as an Injectable: A Trojan Horse to NLP

    June 2, 2025

    AWS: Deploying a FastAPI App on EC2 in Minutes

    April 25, 2025

    Red Teaming in LLMs: Enhancing AI Security and Resilience

    April 7, 2025

    Deploy agentic AI faster with DataRobot and NVIDIA

    April 5, 2025

    Google Cloud Next 2025 presenterade flera nya moln och AI-teknologier

    April 10, 2025
    Categories
    • AI Technology
    • AI Tools & Technologies
    • Artificial Intelligence
    • Latest AI Innovations
    • Latest News
    Most Popular

    Building networks of data science talent | MIT News

    May 27, 2025

    How to Set the Number of Trees in Random Forest

    May 16, 2025

    MIT spinout maps the body’s metabolites to uncover the hidden drivers of disease | MIT News

    April 5, 2025
    Our Picks

    Gemini introducerar funktionen schemalagda åtgärder i Gemini-appen

    June 7, 2025

    AIFF 2025 Runway’s tredje årliga AI Film Festival

    June 7, 2025

    AI-agenter kan nu hjälpa läkare fatta bättre beslut inom cancervård

    June 7, 2025
    Categories
    • AI Technology
    • AI Tools & Technologies
    • Artificial Intelligence
    • Latest AI Innovations
    • Latest News
    • Privacy Policy
    • Disclaimer
    • Terms and Conditions
    • About us
    • Contact us
    Copyright © 2025 ProfitlyAI All Rights Reserved.

    Type above and press Enter to search. Press Esc to cancel.