Commit 71f29ba1 authored by Shirley Crompton's avatar Shirley Crompton
Browse files

added defualt 0 to solution timestamp

parent 450be41d
...@@ -105,6 +105,7 @@ public class Mapper { ...@@ -105,6 +105,7 @@ public class Mapper {
List<EObject> model_contents = null; List<EObject> model_contents = null;
// start the cdo-client // start the cdo-client
try{ try{
Long timestamp = 0l;
this.utils.openCDOSession(); this.utils.openCDOSession();
// clone the resource in memory and get the cp model // clone the resource in memory and get the cp model
model_contents = this.utils.cloneModel(resId); // cloner may return an empty list model_contents = this.utils.cloneModel(resId); // cloner may return an empty list
...@@ -126,7 +127,7 @@ public class Mapper { ...@@ -126,7 +127,7 @@ public class Mapper {
+ " has no Metric Variable entities..."); + " has no Metric Variable entities...");
log.debug("CP model in " + resId log.debug("CP model in " + resId
+ " has no Metric Variable entities..."); + " has no Metric Variable entities...");
} else { } else {//there are metric variables
System.out.println(mvs.size() System.out.println(mvs.size()
+ " metric variables retrived from CP model in " + resId + " metric variables retrived from CP model in " + resId
+ "..."); + "...");
...@@ -144,7 +145,7 @@ public class Mapper { ...@@ -144,7 +145,7 @@ public class Mapper {
.searchLastSolution(solutions); .searchLastSolution(solutions);
} }
if (solution == null) { if (solution == null) {
// no solution in model, create one now // no last solution in model, create one now
System.out.println("CP model in " + resId System.out.println("CP model in " + resId
+ " has no Solution entities..."); + " has no Solution entities...");
log.debug("CP model in " + resId log.debug("CP model in " + resId
...@@ -170,8 +171,9 @@ public class Mapper { ...@@ -170,8 +171,9 @@ public class Mapper {
}// solution got it already, continue }// solution got it already, continue
} }
} }
jObj.add("solution_tmp", solution.getTimestamp()); // milp-solver needs this timestamp = solution.getTimestamp();
} //jObj.add("solution_tmp", solution.getTimestamp()); // milp-solver needs this
}//end if there are metric variables
if (updateCP) { if (updateCP) {
System.out.println("updating CP Model( " + resId System.out.println("updating CP Model( " + resId
+ ") in CDO..."); + ") in CDO...");
...@@ -179,7 +181,8 @@ public class Mapper { ...@@ -179,7 +181,8 @@ public class Mapper {
+ ") in CDO..."); + ") in CDO...");
//get a new resource id //get a new resource id
String newId = CpModelTool.getCloneId(CpModelTool.getAppId(model_contents), resId); String newId = CpModelTool.getCloneId(CpModelTool.getAppId(model_contents), resId);
this.utils.overwriteCPModelinCDO(model_contents, newId); //this.utils.overwriteCPModelinCDO(model_contents, newId);
this.utils.commitCloneModelToCDO(model_contents, newId);
jObj.add("id", newId); jObj.add("id", newId);
}else{ }else{
System.out.println("no change to CP Model(" + resId System.out.println("no change to CP Model(" + resId
...@@ -189,6 +192,7 @@ public class Mapper { ...@@ -189,6 +192,7 @@ public class Mapper {
//we are using the same model //we are using the same model
jObj.add("id", resId); jObj.add("id", resId);
} }
jObj.add("solution_tmp", timestamp); // milp-solver needs this
// explicitly stop the cdo client // explicitly stop the cdo client
this.utils.closeCDOSession(); this.utils.closeCDOSession();
// //
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment