Hello Dong-John, your message had to be forwarded manually because you are not subscribed to the list, see https://lists.gnu.org/mailman/listinfo/help-glpk
I guess this is what you are looking for: param flag := 2; var x1, >= 0, <= 3; var x2, >= 0, <= 4; maximize obj : ( if flag == 1 then .3 * x1 + .4 * x2 else 0 ) + ( if flag == 2 then .5 * x1 + .3 * x2 else 0 ) + ( if flag == 3 then -.3 * x1 - .4 * x2 else 0 ); s.t. c1 : x1 + x2 <= 5; solve; end; Best regards Xypron > -------- Forwarded Message -------- > Subject: Conditional objective function structure > Date: Wed, 8 Feb 2012 21:23:31 -0800 > > Hello, > > Can I make a code structure like following,,? > > (if flag = 1 then > ( > minimize ~~ > s.t. ~~ > ) > else if flag = 2 then > ( > maximize ~~ > s.t. ~~ > ) > else > ( > ~~ > ) > ); > > solve; > > Best, > TGno3 -- Follow me at http://twitter.com/#!/xypron Empfehlen Sie GMX DSL Ihren Freunden und Bekannten und wir belohnen Sie mit bis zu 50,- Euro! https://freundschaftswerbung.gmx.de _______________________________________________ Help-glpk mailing list [email protected] https://lists.gnu.org/mailman/listinfo/help-glpk
