| |||||||||||||||||
Coco - A full production planning example Description The Coco productional planning problem: multi-item,
multi-period, multi-site production planning. A sequence
of model versions show how the model
was developed, to (a) use more sophisticated modeling features
and (b) to extend the model, taking it from a simple linear model
to one with fixed prices and logical decisions.
Source Files By clicking on a file name, a preview is opened at the bottom of this page.
Data Files xbcoco1.cxx /******************************************************** Xpress-BCL C++ Example Problems =============================== file xbcoco1.cxx ```````````````` Coco Problem Phase 1. Initial formulation: data, variables and constraints fixed. (c) 2008-2024 Fair Isaac Corporation author: S.Heipcke, Jan. 2000, rev. Mar. 2011 ********************************************************/ #include <iostream> #include "xprb_cpp.h" using namespace std; using namespace ::dashoptimization; int main(int argc, char **argv) { XPRBvar make11,make21,make12,make22; XPRBprob p("Coco1"); /* Initialize a new problem in BCL */ /****VARIABLES****/ make11 = p.newVar("make11"); /* Amount of prod. 1 to make at factory 1 */ make21 = p.newVar("make21"); /* Amount of prod. 2 to make at factory 1 */ make12 = p.newVar("make12"); /* Amount of prod. 1 to make at factory 2 */ make22 = p.newVar("make22"); /* Amount of prod. 2 to make at factory 2 */ /****OBJECTIVE****/ /* Define & set objective function: maximize total profit */ p.setObj(p.newCtr("OBJ", 50*make11 + 125*make21 + 47*make12 + 132*make22)); /****CONSTRAINTS****/ p.newCtr("MxMake1", make11+make21 <= 400); /* Capacity limit at factory 1 */ p.newCtr("MxMake2", make12+make22 <= 500); /* Capacity limit at factory 2 */ p.newCtr("MxSell1", make11+make12 <= 650); /* Limit on the amount of prod. 1 to be sold */ p.newCtr("MxSell2", make21+make22 <= 600); /* Limit on the amount of prod. 2 to be sold */ /****SOLVING + OUTPUT****/ p.setSense(XPRB_MAXIM); /* Choose the sense of the optimization */ p.lpOptimize(""); /* Solve the LP-problem */ cout << "Objective: " << p.getObjVal() << endl; /* Get objective value */ /* Print out the solution values for all variables */ cout << make11.getName() << ": " << make11.getSol() << endl; cout << make21.getName() << ": " << make21.getSol() << endl; cout << make12.getName() << ": " << make12.getSol() << endl; cout << make22.getName() << ": " << make22.getSol() << endl; return 0; } | |||||||||||||||||
© Copyright 2023 Fair Isaac Corporation. |