mathematical programming for optimisation mike morgan and vic grout centre for applied internet...
TRANSCRIPT
Mathematical Programming for Optimisation
Mike Morgan and Vic Grout
Centre for Applied Internet Research (CAIR)University of WalesNEWI Plas Coch Campus, Mold RoadWrexham, LL11 2AW, UK{mi.morgan|v.grout}@newi.ac.ukwww.cair-uk.org
NEWI North East Wales Institute of Higher Education - Centre for Applied Internet Research
CAIR Seminar Programme, Wednesday 28th May 2008
Mathematical Programming for Optimisation
Optimisation generally involves maximising or minimising something
The ‘something’ is the objective function e.g., “Maximise x” or just max x (no solution) Also, there are usually constraints e.g., max x
subject to (s.t.) x 2 (trivially x = 2) A better example, max 3x + 2y
s.t. 3x - 2y 47y – 3x 9
Not so obvious!
A Better Example
max 3x + 2y s.t. 3x - 2y 4 7y – 3x 9
Solution:
5
7223,
5
13,
15
46 yxyx
x
y 3x-2y = 4
7y-3x = 9
3x+2y
An Even Better Example
x
y
Algorithms suchas the SimplexMethod find (asin ‘home-in’ on)the optimal solution
This isMathematical Programming
Common Notation
Used to simplify/generalise large expressions in many dimensions/variables
3x + 4y – 2z + … = ax + by + cz + … = a1x1 + a2x2 + a3x3 + … + anxn
n
iii xa
1
The General Form
max/min Σ …xi
s.t. Σ … / = / …
Σ … / = / …
Σ … / = / … … xi {0,1} etc.
Or, it can be expressed using linear algebra Vectors and matrices – can save space
Example: The ‘Diet’ Problem
One of the first problems ever formulated in this way Consider buying the weekly shopping. Choice of
n foods, containing m nutrients
A = (aij) is the ‘amount’ matrix (2-d array (m x n)) aij is the quantity of the ith nutrient in the jth food
r = (ri) is the ‘requirement’ vector (1-d array (m))
ri is the weekly requirement of nutrient i
c = (cj) is the ‘cost’ vector (1-d array (n))
cj is the cost of food j
x = (xj) is the ‘consumption’ vector (1-d array (n))
xj is the weekly consumption of food j
Example: The ‘Diet’ Problem
We want to find a diet, of minimal cost, that satisfies the dietary requirement of all nutrients
min c’x s.t. Ax r x 0
Simple Network/Graph Problem
Minimum Dominating Set (MDS)
Find the minimum subset of nodes S, such that each node not in S has a neighbour in S
MDS as an Integer Program
Vector s = (si), where si = 1 if node i is a relay and 0 otherwise
Adjacency matrix A = (aij), where aij = 1 if there is an edge between nodes i and j and 0 otherwise.
1
1
minimise:
subject to:
1 1..
{0,1}
i
i
ni
i
nij j
j
s
s a s i n
s
A more complex problem
Minimum connected dominating set (MCDS)
Same as MDS only the subgraph induced by S must be connected
Solve using surplus ‘network flow’ variables
Increases complexity (runtime) for solving problem
Testing Connectivity with Network Flows (almost)
Flow matrix F = (fij) records flow across edges
Flows are directional To test connectivity, choose one
node as source and all the others as sinks. The source introduces n-1 units of flow onto the network and each sink must absorb 1.
Flow may only be transmitted from a relay or from the source
Well, that’s lovely, but…
…it doesn’t work! Consider using a different node as source:
Need to restrict problem so that the source node can only send flow along one edge, unless it is a relay
In other words, if the source is not a relay, it gives all it’s flow to a neighbouring relay
What does this look like as an integer program?
First of all, set the source node as node 1 Node 1 must introduce n-1 units of flow onto the
network:
All other nodes must consume 1 unit:
1 12 2
1n n
j jj j
f f n
1 1
1 2..n n
ji ijj j
f f i n
What does this look like as an integer program? (cont’d)
For all nodes other than the source, flows must originate from a relay and traverse a valid edge:
Flow can originate from the source node if it isn’t a relay, but must travel along a valid edge to a neighbouring relay
1 10 ( ) 2..j ij jf na s s j n
0 2.. , 2..ij ij if na s i n j n
What does this look like as an integer program? (cont’d)
Binary ‘source vector’ q=(qi), defined as qi=1 if flow is transmitted from the src node to i and 0 otherwise:
If source is not a relay, q must sum to 1
1 2..j jf nq j n
12
1
0,1
n
ii
i
q ns
q
How do we solve the problem?
Solving a mathematical program with binary or integer variables is NP-complete
Powerful method for finding optimal solutions
Particularly if you use 3rd party software!
x
y
3x+2y
Useful results
Solving problems this way involves little software development
Express your problem in this form and let the solver do the work
Cplex solver originally developed by B. Bixby but now taken over by ILOG
For MCDS (with a small alteration from model outlined) we’ve obtained optimal solutions for problems with n <= 100 nodes.
Test accuracy of heuristics More complex variants of problem solved using
combination of IP and heuristics
Subsets of Constraints
Suppose we require 2 node-disjoint paths between all node pairs on the network.
In this example, it is only necessary to constrain one node pair to get a feasible solution
Number of flow variables is reduced from n2m to m
Runtime of LP solver is exponentially related to number of variables!!
Subsets of constraints (cont’d)
First require that every node have 2 relay neighbours
minimise:
subject to:
1
n
ii
s
1
2 1..n
ij jj
a s i n
Subsets of constraints (cont’d)
Introduce flow variables incrementally:
Each constrained node pair (u,v) represents a commodity
u creates 2 units of flow and v absorbs 2. All other nodes conserve flow.
Transient nodes may only carry one unit of flow for a given commodity (ensures 2 disjoint paths)
Lower bounds and heuristics
After each IP is solved, solution is checked for feasibility.
If it is not feasible, the size of S represents a lower bound on the size of the optimal solution.
Use heuristic after each IP, if it finds solution with size = lower bound, that solution is optimal.
The more constraints are added, the more accurate the lower bound becomes
Eventually, either the IP will yield a feasible solution or the heuristic will hit the lower bound
Good news and bad news
Problems solved to optimality for n<=100 and up to four node-disjoint paths between all node pairs
Unfortunately this does involve some software development
Any questions?
Thank you
NEWI North East Wales Institute of Higher Education - Centre for Applied Internet Research
Mike Morgan and Vic Grout
Centre for Applied Internet Research (CAIR)University of WalesNEWI Plas Coch Campus, Mold RoadWrexham, LL11 2AW, UK{mi.morgan|v.grout}@newi.ac.ukwww.cair-uk.org
CAIR Seminar Programme, Wednesday 28th May 2008