Skip to content
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

Add option to show all pareto-optimal solutions #28

Open
wants to merge 13 commits into
base: master
Choose a base branch
from

Conversation

elKei24
Copy link
Contributor

@elKei24 elKei24 commented May 18, 2021

Like #26, but this time functioning 😆 When running the MiniBrassRunner with the parameter --pareto, it will not only output a single solution but all pareto-optimal solutions. The user of course should ensure that the variables are constrained enough in order for this to be feasible with reasonable resources.

While working on that feature, I refactored the MiniBrassRunner and split it into some smaller ones:

  • WorkingModelManager cares about creating/updating/removing the working MiniZinc file(s)
  • MiniBrassRunnerMain cares about parsing the command line parameters and then executes the MiniBrassRunner
  • SingleUseMiniBrassRunner encapsulates stuff needed for a single execution but not afterwards (like the working model, …). It is immutable from outside, in contrast to the MiniBrassRunner using this class.

The example from #27 again highlights the usage and will output four solutions:

var 0..2: x;
var 0..2: y;
constraint x != y;
solve satisfy;
include "defs.mbr";

PVS: px = new WeightedCsp("px") {
	soft-constraint x0: 'x = 0';
	soft-constraint x1: 'x = 1';
	soft-constraint x2: 'x = 2' :: weights('2');
};

PVS: py = new WeightedCsp("py") {
	soft-constraint y0: 'y = 0';
	soft-constraint y1: 'y = 1';
	soft-constraint y2: 'y = 2' :: weights('2');
};

solve py pareto px;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant