简体   繁体   中英

pulp (python) - objective function depends on the result

My objective function depends on the result of problem that i am trying to solve, is it possible to model such a problem ?

for example

objective = (price * is_channel_assigned[channel id])

the price depends on the number of channels assigned ie., 1st channel is 100, 2nd 80 .. and so on.

Is this possible ?

Sure make a list of the prices

and use

objective = (price[channel_id] * is_channel_assigned[channel_id])

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM