-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
remove assumption of integer objective, fixes #23 #24
Open
rowtricker
wants to merge
3
commits into
coin-or:development
Choose a base branch
from
rowtricker:allowNonIntegerObjective
base: development
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+89
−63
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -73,15 +73,18 @@ public class ColGen<T extends ModelInterface, U extends AbstractColumn<T, V>, | |
/** | ||
* The ColGen procedure is terminated if the bound on the best attainable solution to the master | ||
* problem is worse than the cutoffValue. If the master is a minimization problem, the Colgen | ||
* procedure is terminated if {@code ceil(boundOnMasterObjective) >= cutoffValue}. If the master | ||
* is a maximization problem, the Colgen procedure is terminated if | ||
* {@code floor(boundOnMasterObjective) <= cutoffValue}. | ||
* procedure is terminated if {@code ceil(boundOnMasterObjective) >= cutoffValue} in case | ||
* {@link Configuration#INTEGER_OBJECTIVE} is set to {@code true} and if | ||
* {@code boundOnMasterObjective) >= cutoffValue} otherwise. If the master is a maximization problem, the Colgen | ||
* procedure is terminated if {@code floor(boundOnMasterObjective) <= cutoffValue} when the objective value | ||
* is guaranteed to be integer and is terminated if {@code boundOnMasterObjective <= cutoffValue} otherwise. | ||
**/ | ||
protected int cutoffValue; | ||
protected double cutoffValue; | ||
/** | ||
* Bound on the best attainable objective value from the master problem. Assuming that the | ||
* master is a minimization problem, the Colgen procedure is terminated if | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. descr needs update |
||
* {@code ceil(boundOnMasterObjective) >= cutoffValue}. | ||
* {@code ceil(boundOnMasterObjective) >= cutoffValue} if {@link Configuration#INTEGER_OBJECTIVE} is set to | ||
* {@code true} and is terminated if {@code boundOnMasterObjective >= cutoffValue} otherwise. | ||
**/ | ||
protected double boundOnMasterObjective = 0; | ||
/** Total number of column generation iterations. **/ | ||
|
@@ -114,7 +117,7 @@ public class ColGen<T extends ModelInterface, U extends AbstractColumn<T, V>, | |
public ColGen( | ||
T dataModel, AbstractMaster<T, U, V, ? extends MasterData<T, U, V, ?>> master, List<V> pricingProblems, | ||
List<Class<? extends AbstractPricingProblemSolver<T, U, V>>> solvers, List<U> initSolution, | ||
int cutoffValue, double boundOnMasterObjective) | ||
double cutoffValue, double boundOnMasterObjective) | ||
{ | ||
this.dataModel = dataModel; | ||
this.master = master; | ||
|
@@ -161,7 +164,7 @@ public ColGen( | |
public ColGen( | ||
T dataModel, AbstractMaster<T, U, V, ? extends MasterData<T, U, V, ?>> master, V pricingProblem, | ||
List<Class<? extends AbstractPricingProblemSolver<T, U, V>>> solvers, List<U> initSolution, | ||
int cutoffValue, double boundOnMasterObjective) | ||
double cutoffValue, double boundOnMasterObjective) | ||
{ | ||
this( | ||
dataModel, master, Collections.singletonList(pricingProblem), solvers, initSolution, | ||
|
@@ -188,7 +191,7 @@ public ColGen( | |
public ColGen( | ||
T dataModel, AbstractMaster<T, U, V, ? extends MasterData<T, U, V, ?>> master, List<V> pricingProblems, | ||
List<Class<? extends AbstractPricingProblemSolver<T, U, V>>> solvers, | ||
PricingProblemManager<T, U, V> pricingProblemManager, List<U> initSolution, int cutoffValue, | ||
PricingProblemManager<T, U, V> pricingProblemManager, List<U> initSolution, double cutoffValue, | ||
double boundOnMasterObjective) | ||
{ | ||
this.dataModel = dataModel; | ||
|
@@ -519,10 +522,17 @@ public List<AbstractInequality> getCuts() | |
*/ | ||
protected boolean boundOnMasterExceedsCutoffValue() | ||
{ | ||
if (optimizationSenseMaster == OptimizationSense.MINIMIZE) | ||
return Math.ceil(boundOnMasterObjective - config.PRECISION) >= cutoffValue; | ||
else | ||
return Math.floor(boundOnMasterObjective + config.PRECISION) <= cutoffValue; | ||
if (config.INTEGER_OBJECTIVE) { | ||
if (optimizationSenseMaster == OptimizationSense.MINIMIZE) | ||
return Math.ceil(boundOnMasterObjective - config.PRECISION) >= cutoffValue; | ||
else | ||
return Math.floor(boundOnMasterObjective + config.PRECISION) <= cutoffValue; | ||
} else { | ||
if (optimizationSenseMaster == OptimizationSense.MINIMIZE) | ||
return boundOnMasterObjective >= cutoffValue; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Check: how to handle precision correctly. |
||
else | ||
return boundOnMasterObjective <= cutoffValue; | ||
} | ||
} | ||
|
||
/** | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this bit is tricky. It doesn't take the precision into account. I need to read up on this topic to decide what is the best comparison.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was also not entirely sure what to do here either. However, allowing to deviate by the precision would mean that this would be allowed recursively if the nodes are pruned. Hence, the final precision could turn out significantly worse than the given precision. That was my reason for not taking it into account here.