Skip to content
Adam Furmanek edited this page Jul 18, 2016 · 2 revisions

Description

There are requirements which are easier to implement (and to calculate) when they are added as goals, and not as constraints. For instance, to maximize minimum of a set one could calculate minimum explicitly (using OperationType.Minimum) and then add calculated variable as a goal and maximize it. However, it is much easier to maximize minimum using tricks with creating new variable, constraining it to not be less than variables in set, and maximize that variable. This requires no additional variables and much fewer constraints.

Please remember, that these are goals! You need to add them explicitly to goal function and correctly interpret result. For instance, minimizing variable 5 <= x <= 10 will create new variable y and maximize it, so its value will be -5. You can't just directly take -5 as a value of x in final solution, because it is just an implementation detail. You need to obtain value of original variable, which should be 5.

List

Currently there are implemented the following goals:

  • Minimize
  • Maximize
  • Maximize minimum
  • Minimize maximum
  • Maximize maximum
  • Minimize minimum

Minimize

Creates expression for minimizing variable

Usage

IMilpManager manager;
IVariable a;
...
IVariable goal = a.MakeGoal(GoalType.Minimize);
manager.AddGoal("goal", goal);
or
IVariable goal = manager.MakeGoal(GoalType.Minimize, a);
manager.AddGoal("goal", goal);

Details

Minimizes variable.


Maximize

Creates expression for maximizing variable

Usage

IMilpManager manager;
IVariable a;
...
IVariable goal = a.MakeGoal(GoalType.Maximize);
manager.AddGoal("goal", goal);
or
IVariable goal = manager.MakeGoal(GoalType.Maximize, a);
manager.AddGoal("goal", goal);

Details

Maximizes variable. Please note that maximization is default mode of library (and as for now cannot be changed), so it is not required to make goal explicitly, one can just pass original variable as a goal.


Maximize minimum

Creates expression for maximizing minimum of a set

Usage

IMilpManager manager;
IVariable a;
IVariable b;
IVariable c;
...
IVariable goal = a.MakeGoal(GoalType.MaximizeMinimum, b, c);
manager.AddGoal("goal", goal);
or
IVariable goal = manager.MakeGoal(GoalType.MaximizeMinimum, a, b, c);
manager.AddGoal("goal", goal);

Details

Maximizes minimum of passed variables.


Minimize maximum

Creates expression for minimizing maximum of a set

Usage

IMilpManager manager;
IVariable a;
IVariable b;
IVariable c;
...
IVariable goal = a.MakeGoal(GoalType.MinimizeMaximum, b, c);
manager.AddGoal("goal", goal);
or
IVariable goal = manager.MakeGoal(GoalType.MinimizeMaximum, a, b, c);
manager.AddGoal("goal", goal);

Details

Minimizes maximum of passed variables.


Maximize maximum

Creates expression for maximizing maximum of a set

Usage

IMilpManager manager;
IVariable a;
IVariable b;
IVariable c;
...
IVariable goal = a.MakeGoal(GoalType.MaximizeMaximum, b, c);
manager.AddGoal("goal", goal);
or
IVariable goal = manager.MakeGoal(GoalType.MaximizeMaximum, a, b, c);
manager.AddGoal("goal", goal);

Details

Maximizes maximum of passed variables.


Minimize minimum

Creates expression for minimizing minimum of a set

Usage

IMilpManager manager;
IVariable a;
IVariable b;
IVariable c;
...
IVariable goal = a.MakeGoal(GoalType.MinimizeMinimum, b, c);
manager.AddGoal("goal", goal);
or
IVariable goal = manager.MakeGoal(GoalType.MinimizeMinimum, a, b, c);
manager.AddGoal("goal", goal);

Details

Minimizes minimum of passed variables.