Please how to write a mathematical expression or formula in OPL. I need to calculate the cost then use it in the objective function.
Do I write it in execute block ?
Thanks.
Please how to write a mathematical expression or formula in OPL. I need to calculate the cost then use it in the objective function.
Do I write it in execute block ?
Thanks.
Hi,
you do not need any execute block for that. Let me give you a small example:
dvar float+ Gas;
dvar float+ Chloride;
dexpr float objective=40 * Gas + 50 * Chloride;
maximize objective;
subject to {
ctMaxTotal:
Gas + Chloride <= 50;
ctMaxTotal2:
3 * Gas + 4 * Chloride <= 180;
ctMaxChloride:
Chloride <= 40;
}
regards
- AlexFleischer
- 2014-05-21T08:46:57Z
Hi,
you do not need any execute block for that. Let me give you a small example:
dvar float+ Gas;
dvar float+ Chloride;
dexpr float objective=40 * Gas + 50 * Chloride;
maximize objective;
subject to {
ctMaxTotal:
Gas + Chloride <= 50;
ctMaxTotal2:
3 * Gas + 4 * Chloride <= 180;
ctMaxChloride:
Chloride <= 40;
}regards
Thank you so much.