[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-glpk] How to code restriction on number of variables > 0
From: |
Heinrich Schuchardt |
Subject: |
Re: [Help-glpk] How to code restriction on number of variables > 0 |
Date: |
Thu, 20 Feb 2014 12:36:35 +0100 |
Hello Wouter,
you can add a binary variable per ingredient.
Add a constraint limiting the ingredient quantity to zero if the binary is 0.
aim <= M *x;
Choose M as small as possible.
Add a constraint for the sum of the binaries.
Best regards
Heinrich Schuchardt
http://www.xypron.de
On 20.02.14 at 11:49, Baake, Wouter wrote:
> Hi,
>
>
>
> I'm modelling a problem where I need to make several products with different
> specifications. Each product undergoes several unit operations where
> ingredients are added.
>
> var ingredient_used {Products, Unit_operations,Ingredients} >= 0;
>
>
>
> Each ingredient has a cost and the total cost is to be minimized:
>
> minimize total_cost: sum{p in Products,u in Unit_operations, i in
> Ingredients} cost[i] * ingredient_used [p,u,i];
>
>
>
> Each ingredient consists of several elements in different concentrations.
> Each of the products has an aim value for concentration of each of the
> elements in the product:
>
> Subject to {p in Products, e in Elements}: sum {u in Unit_operations, i in
> Ingredients} (ingredient_used [p,u,i]*concentration[i,e]) = aim[p,e];
>
>
>
> This problem I can model and solve, but I need to add some more constraints.
>
> One constraint is that there is a maximum number of ingredients that can be
> kept in stock at a given unit operation. As an example, at the first unit
> operation, I cannot keep more than 10 ingredients in stock, but the amount
> per ingredient is unlimited.
>
>
>
> How could I translate this into a mathprog constraint?
>
>
>
> Regards,
>
> Wouter
>
>
>
>
>
> **********************************************************************
>
>
>
> This transmission is confidential and must not be used or disclosed by anyone
> other than the intended recipient. Neither Tata Steel Europe Limited nor any
> of its subsidiaries can accept any responsibility for any use or misuse of
> the transmission by anyone.
>
>
>
> For address and company registration details of certain entities within the
> Tata Steel Europe group of companies, please visit
> http://www.tatasteeleurope.com/entities
>
>
>
> **********************************************************************
>
> _______________________________________________
>
> Help-glpk mailing list
>
> address@hidden
>
> https://lists.gnu.org/mailman/listinfo/help-glpk