[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-glpk] min() & max() functions alternatives to use non numeric
From: |
nikel90 |
Subject: |
Re: [Help-glpk] min() & max() functions alternatives to use non numeric parameters |
Date: |
Wed, 27 Apr 2011 12:42:36 -0700 (PDT) |
unfortunately i knew it...
i dont really know glpk... its possible to do something like
var a;
if (b==1) a=b;
else
a= c;
?? ty
Nikel
nikel90 wrote:
>
> Good evining!
>
> I've got a problem with the max() and min() functions...
>
> i need to do something like this:
> min(120,ScorteIniziali+PrimoStd+PrimoStra)*70
> in my "objective function"
>
> but min() accepts only numeric parameters..
>
> is there any alternatives?
>
> thank you!
>
> Nikel
>
> the entire model:
>
> #
> #
> /* Trimestri*/
> var PrimoStd >=0, integer;
> var SecondoStd >=0, integer;
> var TerzoStd >=0, integer;
> var QuartoStd >=0, integer;
> var PrimoStra >=0, integer;
> var SecondoStra >=0, integer;
> var TerzoStra >=0, integer;
> var QuartoStra >=0, integer;
> var ScorteIniziali >=0, integer;
> #
> /* Objective function */
> maximize z:
> (min(120,ScorteIniziali+PrimoStd+PrimoStra)*70)-(((max(PrimoStd,SecondoStd,TerzoStd)*3*10)+(PrimoStra*3*15))+(max(0,ScorteIniziali+PrimoStd+PrimoStra-120)*6)+((PrimoStd+PrimoStra)*15))
> +
> (min(310,ScorteIniziali+PrimoStd+PrimoStra-120+SecondoStd+SecondoStra)*70)-(((max(PrimoStd,SecondoStd,TerzoStd)*3*10)+(SecondoStra*3*15))+(max(0,ScorteIniziali+PrimoStd+PrimoStra-120+SecondoStd+SecondoStra-310)*6)+((SecondoStd+SecondoStra)*15))
> + (min(180,ScorteIniziali+PrimoStd+PrimoStra-120 +
> SecondoStd+SecondoStra-310+TerzoStd+TerzoStra)*70)-(((max(PrimoStd,SecondoStd,TerzoStd)*3*10)+(TerzoStra*3*15))+(max(0,ScorteIniziali+PrimoStd+PrimoStra-120
> +
> SecondoStd+SecondoStra-310+TerzoStd+TerzoStra-180)*6)+((TerzoStd+TerzoStra)*15))
> + (min(120,ScorteIniziali+PrimoStd+PrimoStra-120 +
> SecondoStd+SecondoStra-310 +
> TerzoStd+TerzoStra-180+QuartoStd+QuartoStra)*70)-(((max(PrimoStd,SecondoStd,TerzoStd)*3*10)+(QuartoStra*3*15))+(max(0,ScorteIniziali+PrimoStd+PrimoStra-120
> + SecondoStd+SecondoStra-310 +
> TerzoStd+TerzoStra-180+QuartoStd+QuartoStra-120)*6)+((QuartoStd+QuartoStra)*15))
> - (ScorteIniziali*45 + ScorteIniziali+PrimoStd+PrimoStra-120 +
> SecondoStd+SecondoStra-310 + TerzoStd+TerzoStra-180 +
> QuartoStd+QuartoStra-120*45);
>
> /* Constraints */
> #
> s.t. a: ScorteIniziali - ScorteIniziali+PrimoStd+PrimoStra-120 +
> SecondoStd+SecondoStra-310 + TerzoStd+TerzoStra-180 +
> QuartoStd+QuartoStra-120 <= 0;
> end;
>
>
--
View this message in context:
http://old.nabble.com/min%28%29---max%28%29-functions-alternatives-to-use-non-numeric-parameters-tp31489922p31490622.html
Sent from the Gnu - GLPK - Help mailing list archive at Nabble.com.