37#ifndef __SCIP_PARA_INSTANCE_MPI_H__
38#define __SCIP_PARA_INSTANCE_MPI_H__
82 if( method == 2 && SCIPgetStage(
scip) != SCIP_STAGE_SOLVED )
85 SCIP_Bool success = TRUE;
86 SCIP_CALL_ABORT( SCIPcreate(&tempScip) );
89#if SCIP_APIVERSION >= 163
90 SCIP_CALL_ABORT( SCIPcopyPlugins(
scip, tempScip, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE,
91 TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, &success) );
92#elif SCIP_APIVERSION >= 131
93 SCIP_CALL_ABORT( SCIPcopyPlugins(
scip, tempScip, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE,
94 TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, &success) );
95#elif SCIP_APIVERSION >= 101
96 SCIP_CALL_ABORT( SCIPcopyPlugins(
scip, tempScip, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE,
97 TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, &success) );
98#elif SCIP_APIVERSION >= 100
99 SCIP_CALL_ABORT( SCIPcopyPlugins(
scip, tempScip, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE,
100 TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, &success) );
101#elif SCIP_APIVERSION >= 17
102 SCIP_CALL_ABORT( SCIPcopyPlugins(
scip, tempScip, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE,
103 TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, &success) );
105 SCIP_CALL_ABORT( SCIPcopyPlugins(
scip, tempScip, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE,
106 TRUE, TRUE, TRUE, TRUE, TRUE, &success) );
108 SCIP_CALL_ABORT( SCIPcopyParamSettings(
scip, tempScip) );
111 SCIP_HASHMAP* varmap = 0;
112 if( SCIPgetNVars(
scip) > 0 )
114 SCIP_CALL_ABORT( SCIPhashmapCreate(&varmap, SCIPblkmem(tempScip), SCIPgetNVars(
scip)) );
116 SCIP_HASHMAP* conssmap = 0;
117 if( SCIPgetNConss(
scip) > 0 )
119 SCIP_CALL_ABORT( SCIPhashmapCreate(&conssmap, SCIPblkmem(tempScip), SCIPgetNConss(
scip)) );
123 SCIP_CALL_ABORT( SCIPcopyProb(
scip, tempScip, varmap, conssmap, TRUE,
"") );
127 if( SCIPgetNVars(
scip) > 0 )
129#if (SCIP_VERSION < 321 || ( SCIP_VERSION == 321 && SCIP_SUBVERSION < 2) )
130 SCIP_CALL_ABORT( SCIPcopyVars(
scip, tempScip, varmap, conssmap, TRUE) );
132 SCIP_CALL_ABORT( SCIPcopyVars(
scip, tempScip, varmap, conssmap, NULL, NULL, 0, TRUE) );
135 if( SCIPgetNConss(
scip) > 0 )
137 SCIP_CALL_ABORT( SCIPcopyConss(
scip, tempScip, varmap, conssmap, TRUE, FALSE, &success) );
140#if SCIP_APIVERSION > 39
146 SCIP_CALL_ABORT( SCIPcopyBenders(
scip, tempScip, NULL, TRUE, &valid) );
152 if( SCIPgetNConss(
scip) > 0 )
154 SCIPhashmapFree(&conssmap);
156 if( SCIPgetNVars(
scip) > 0 )
158 SCIPhashmapFree(&varmap);
161 std::cerr <<
"Some constraint handler did not perform a valid copy. Cannot solve this instance." << std::endl;
167 int n = SCIPgetNVars(tempScip);
172 if( SCIPgetNConss(
scip) > 0 )
174 SCIPhashmapFree(&conssmap);
176 if( SCIPgetNVars(
scip) > 0 )
178 SCIPhashmapFree(&varmap);
183 std::cout <<
"** ParaScipInstance copy does not increase the number of variables. **" << std::endl;
188 std::cout <<
"** ParaScipInstance copy increased the number of variables. **" << std::endl;
236 for(
int v = 0; v <
nVars; ++v)
239 objCoefs[v] = SCIPvarGetObj(vars[v]);
240 assert(SCIPvarGetProbindex(vars[v])!=-1);
241 assert(SCIPvarGetProbindex(vars[v]) == v);
242 lVarNames += strlen(SCIPvarGetName(vars[v])) + 1;
248 for(
int v = 0; v <
nVars; ++v )
250 SCIP_VAR *var = vars[v];
252 varLbs[SCIPvarGetProbindex(var)] = SCIPvarGetLbLocal(var);
253 varUbs[SCIPvarGetProbindex(var)] = SCIPvarGetUbLocal(var);
254 varTypes[SCIPvarGetProbindex(var)] = SCIPvarGetType(var);
bool isCopyIncreasedVariables()
MPI_Datatype createDatatype3(bool memAllocNecessary)
ScipParaInstanceMpi(SCIP *scip, int method)
void allocateMemoryForDatatype3()
void copyIncrasedVariables()
const char * getFileName()
MPI_Datatype createDatatype2(bool memAllocNecessary)
int bcast(UG::ParaComm *comm, int rank, int method)
void setFileName(const char *inFileName)
void allocateMemoryForDatatype2()
MPI_Datatype createDatatype1()
void copyScipEnvironment(SCIP **scip)
bool copyIncreasedVariables
Base class of communicator object.
static ScipParaCommTh * comm
ScipParaInstanceMpi * ScipParaInstanceMpiPtr
Base class of communicator for UG Framework.
Defines for UG Framework.
ParaInstance extenstion for SCIP solver.