35 static bool init =
false;
38 logger <<
"Warning: Calling frepple::LibrarySolver::initialize() more "
39 <<
"than once." << endl;
54 (
"solver",
"solver_mrp",Object::createString<SolverMRP>,
true);
84 logger <<
"Start solving cluster " << cluster <<
" at " << Date::now() << endl;
98 for (deque<Demand*>::const_iterator i = demands->begin();
99 i != demands->end(); ++i)
104 (*i)->solve(*Solver,
this);
109 logger <<
"Error: Caught an exception while solving demand '"
110 << (*i)->getName() <<
"':" << endl;
112 catch (
const bad_exception&) {
logger <<
" bad exception" << endl;}
113 catch (
const exception& e) {
logger <<
" " << e.what() << endl;}
114 catch (...) {
logger <<
" Unknown type" << endl;}
132 logger <<
"Error: Caught an exception while solving cluster "
133 << cluster <<
":" << endl;
135 catch (
const bad_exception&) {
logger <<
" bad exception" << endl;}
136 catch (
const exception& e) {
logger <<
" " << e.what() << endl;}
137 catch (...) {
logger <<
" Unknown type" << endl;}
141 if (f->getCluster() == cluster)
142 f->deleteOperationPlans();
150 logger <<
"End solving cluster " << cluster <<
" at " << Date::now() << endl;
158 demands_per_cluster[i->getCluster()].push_back(&*i);
169 if (demands_per_cluster.find(e->getCluster())!=demands_per_cluster.end())
170 e->deleteOperationPlans();
173 int cl = demands_per_cluster.size();
185 for (classified_demand::iterator j = demands_per_cluster.begin();
186 j != demands_per_cluster.end(); ++j)
194 if (gres->getSetupMatrix()) gres->updateSetups();
217 o->
writeElement(tag_iterationthreshold, iteration_threshold);
218 o->
writeElement(tag_iterationaccuracy, iteration_accuracy);
229 if (userexit_resource)
231 if (userexit_operation)
258 else if (pAttr.
isA(tag_iterationthreshold))
260 else if (pAttr.
isA(tag_iterationaccuracy))
262 else if (pAttr.
isA(tag_lazydelay))
289 if (attr.
isA(tag_iterationthreshold))
291 if (attr.
isA(tag_iterationaccuracy))
293 if (attr.
isA(tag_lazydelay))
319 else if (attr.
isA(tag_iterationthreshold))
321 else if (attr.
isA(tag_iterationaccuracy))
323 else if (attr.
isA(tag_lazydelay))
335 PyObject *dem = NULL;
336 if (args && !PyArg_ParseTuple(args,
"|O:solve", &dem))
return NULL;
343 Py_BEGIN_ALLOW_THREADS
364 PythonType::evalException();
368 return Py_BuildValue(
"");
374 Py_BEGIN_ALLOW_THREADS
379 me->
commands.CommandManager::commit();
384 PythonType::evalException();
388 return Py_BuildValue(
"");
394 Py_BEGIN_ALLOW_THREADS
402 PythonType::evalException();
406 return Py_BuildValue(
"");