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 >= 131
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, &success) );
92#elif SCIP_APIVERSION >= 101
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, &success) );
95#elif SCIP_APIVERSION >= 100
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, &success) );
98#elif SCIP_APIVERSION >= 17
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, &success) );
102 SCIP_CALL_ABORT( SCIPcopyPlugins(
scip, tempScip, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE,
103 TRUE, TRUE, TRUE, TRUE, TRUE, &success) );
105 SCIP_CALL_ABORT( SCIPcopyParamSettings(
scip, tempScip) );
108 SCIP_HASHMAP* varmap = 0;
109 if( SCIPgetNVars(
scip) > 0 )
111 SCIP_CALL_ABORT( SCIPhashmapCreate(&varmap, SCIPblkmem(tempScip), SCIPgetNVars(
scip)) );
113 SCIP_HASHMAP* conssmap = 0;
114 if( SCIPgetNConss(
scip) > 0 )
116 SCIP_CALL_ABORT( SCIPhashmapCreate(&conssmap, SCIPblkmem(tempScip), SCIPgetNConss(
scip)) );
120 SCIP_CALL_ABORT( SCIPcopyProb(
scip, tempScip, varmap, conssmap, TRUE,
"") );
124 if( SCIPgetNVars(
scip) > 0 )
126#if (SCIP_VERSION < 321 || ( SCIP_VERSION == 321 && SCIP_SUBVERSION < 2) )
127 SCIP_CALL_ABORT( SCIPcopyVars(
scip, tempScip, varmap, conssmap, TRUE) );
129 SCIP_CALL_ABORT( SCIPcopyVars(
scip, tempScip, varmap, conssmap, NULL, NULL, 0, TRUE) );
132 if( SCIPgetNConss(
scip) > 0 )
134 SCIP_CALL_ABORT( SCIPcopyConss(
scip, tempScip, varmap, conssmap, TRUE, FALSE, &success) );
137#if SCIP_APIVERSION > 39
143 SCIP_CALL_ABORT( SCIPcopyBenders(
scip, tempScip, NULL, TRUE, &valid) );
149 if( SCIPgetNConss(
scip) > 0 )
151 SCIPhashmapFree(&conssmap);
153 if( SCIPgetNVars(
scip) > 0 )
155 SCIPhashmapFree(&varmap);
158 std::cerr <<
"Some constraint handler did not perform a valid copy. Cannot solve this instance." << std::endl;
164 int n = SCIPgetNVars(tempScip);
169 if( SCIPgetNConss(
scip) > 0 )
171 SCIPhashmapFree(&conssmap);
173 if( SCIPgetNVars(
scip) > 0 )
175 SCIPhashmapFree(&varmap);
180 std::cout <<
"** ParaScipInstance copy does not increase the number of variables. **" << std::endl;
185 std::cout <<
"** ParaScipInstance copy increased the number of variables. **" << std::endl;
233 for(
int v = 0; v <
nVars; ++v)
236 objCoefs[v] = SCIPvarGetObj(vars[v]);
237 assert(SCIPvarGetProbindex(vars[v])!=-1);
238 assert(SCIPvarGetProbindex(vars[v]) == v);
239 lVarNames += strlen(SCIPvarGetName(vars[v])) + 1;
245 for(
int v = 0; v <
nVars; ++v )
247 SCIP_VAR *var = vars[v];
249 varLbs[SCIPvarGetProbindex(var)] = SCIPvarGetLbLocal(var);
250 varUbs[SCIPvarGetProbindex(var)] = SCIPvarGetUbLocal(var);
251 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.