-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
152 additions
and
0 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?xml version="1.0" encoding="ASCII"?><project> | ||
<version>1.0</version> | ||
<configs> | ||
<config category="opl" default="true" name="Konfiguracja1"> | ||
<ref name="nodelink.mod" type="model"> | ||
</ref> | ||
<ref name="nodelink.ops" type="setting"> | ||
</ref> | ||
<ref name="nodelink.dat" type="data"> | ||
</ref> | ||
</config> | ||
</configs> | ||
|
||
</project> |
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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<projectDescription> | ||
<name>nodelink</name> | ||
<comment></comment> | ||
<projects> | ||
</projects> | ||
<buildSpec> | ||
</buildSpec> | ||
<natures> | ||
<nature>ilog.odms.ide.core.opl.project.nature</nature> | ||
</natures> | ||
</projectDescription> |
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 |
---|---|---|
@@ -0,0 +1,67 @@ | ||
/********************************************* | ||
* OPL 12.6.3.0 Data | ||
* Author: grzegorz | ||
* Creation Date: 18-12-2016 at 11:05:20 | ||
*********************************************/ | ||
|
||
v = { 1 2 3 4 5 6 7 8 9 10 }; | ||
d = { 1 2 }; | ||
e = { 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 }; | ||
|
||
a = | ||
[ | ||
[ 1, 0, 0, 0, 0, 0, 0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
[ 0, 0, 1, 0, 0, 0, 0, 0, 0, 0 ] //10 | ||
[ 0, 0, 0, 0, 0, 1, 0, 0, 0, 0 ] //11 | ||
[ 0, 0, 0, 0, 0, 0, 1, 0, 0, 0 ] //12 | ||
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 ] //13 | ||
[ 0, 0, 0, 0, 0, 1, 0, 0, 0, 0 ] //14 | ||
[ 0, 0, 0, 0, 0, 0, 1, 0, 0, 0 ] //15 | ||
[ 0, 0, 0, 0, 0, 0, 0, 0, 1, 0 ] //16 | ||
]; | ||
|
||
|
||
// source node of demand d | ||
s = [ 1 2 ]; | ||
|
||
// sink node of demand d | ||
t = [ 10 8 ]; | ||
|
||
//volume of demand d | ||
h = [ 10 10 ]; | ||
|
||
//links costs | ||
ksi = [ 30 40 30 35 90 50 10 10 90 10 35 10 25 30 15 45 ]; | ||
|
||
//links capacities | ||
cap = [ 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 ]; //lack of capacity | ||
//cap = [ 5 10 10 5 5 5 5 5 5 5 5 5 5 5 5 5 ]; //10 for 2 and 3 edge | ||
//cap = [ 5 5 5 5 5 5 5 5 5 5 5 5 10 5 10 5 ]; //10 for 13 and 13 edge |
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 |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/********************************************* | ||
* OPL 12.6.3.0 Model | ||
* Author: grzegorz | ||
* Creation Date: 18-12-2016 at 11:05:20 | ||
*********************************************/ | ||
|
||
{int} e = ...; | ||
{int} v = ...; | ||
{int} d = ...; | ||
|
||
|
||
int a[e][v] = ...; | ||
int b[e][v] = ...; | ||
int ksi[e] = ...; | ||
int s[d] = ...; | ||
int t[d] = ...; | ||
int h[d] = ...; | ||
int cap[e] = ...; | ||
|
||
|
||
dvar float+ x[e][d]; | ||
dvar float+ y[e]; | ||
|
||
minimize | ||
sum(edge in e) ksi[edge]*y[edge]; | ||
|
||
subject to { | ||
|
||
forall (edge in e) { | ||
sum(demand in d) x[edge][demand] <= y[edge]; | ||
} | ||
|
||
|
||
forall (demand in d) { | ||
forall (node in v) { | ||
|
||
if (node == s[demand]) { | ||
sum(edge in e) a[edge][node]*x[edge][demand] - sum(edge in e) b[edge][node]*x[edge][demand] == h[demand]; | ||
} | ||
|
||
else if (node == t[demand]) { | ||
sum(edge in e) a[edge][node]*x[edge][demand] - sum(edge in e) b[edge][node]*x[edge][demand] == -1*h[demand]; | ||
} | ||
|
||
else { | ||
sum(edge in e) a[edge][node]*x[edge][demand] - sum(edge in e) b[edge][node]*x[edge][demand] == 0; | ||
} | ||
|
||
} | ||
} | ||
|
||
forall (edge in e) { | ||
y[edge] <= cap[edge]; | ||
} | ||
|
||
} |
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
|
||
<settings version="2"/> |