From 430153e1a9489a86cf0ff7942eceb0bf5f1c170c Mon Sep 17 00:00:00 2001 From: vrvarma Date: Fri, 13 Dec 2019 10:24:55 -0500 Subject: osdf rearchitecture into apps and libs Change-Id: I2db2f8e252bd5e60807b2ffabf5a5b193a789f7a Signed-off-by: vrvarma Issue-ID: OPTFRA-637 --- .../solver/no_conflicts_no_confusion.mzn | 86 ++++++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 apps/pci/optimizers/solver/no_conflicts_no_confusion.mzn (limited to 'apps/pci/optimizers/solver/no_conflicts_no_confusion.mzn') diff --git a/apps/pci/optimizers/solver/no_conflicts_no_confusion.mzn b/apps/pci/optimizers/solver/no_conflicts_no_confusion.mzn new file mode 100644 index 0000000..0a9b3e3 --- /dev/null +++ b/apps/pci/optimizers/solver/no_conflicts_no_confusion.mzn @@ -0,0 +1,86 @@ +% ------------------------------------------------------------------------- +% Copyright (c) 2018 AT&T Intellectual Property +% +% Licensed under the Apache License, Version 2.0 (the "License"); +% you may not use this file except in compliance with the License. +% You may obtain a copy of the License at +% +% http://www.apache.org/licenses/LICENSE-2.0 +% +% Unless required by applicable law or agreed to in writing, software +% distributed under the License is distributed on an "AS IS" BASIS, +% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +% See the License for the specific language governing permissions and +% limitations under the License. +% +% ------------------------------------------------------------------------- +% + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Parameters and its assertions +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% Number of cells/radios. +int: NUM_NODES; + +% Maximum number of Physical Cell Identifiers to be assigned to the nodes. +int: NUM_PCIS; + +% Number of edges between neighbor nodes. There is a edge (i,j) if and only +% if nodes i and j are neighbors, i.e., an user equipment (UE) can make +% handoff between i and j. Such edges are used to avoid **COLLISIONS**, i.e., +% to guarantee that nodes i and j have different PCIs. +int: NUM_NEIGHBORS; + +% Each line represents an edge between direct neighbors as defined before. +array[1..NUM_NEIGHBORS, 1..2] of int: NEIGHBORS; + +% Number of undirect neighbor pairs (j, k) such that both j and k are direct +% neighbors of node i, i.e., (j, k) exits if and only if exists (i, j) and +% (i, k). Nodes (i, k) can generate "confunsions" in the network if they have +% the same PCI. Such edges are used to avoid/minimize **CONFUSIONS**. +int: NUM_SECOND_LEVEL_NEIGHBORS; + +% Each line represents an edge between undirect neighbors as defined before. +array[1..NUM_SECOND_LEVEL_NEIGHBORS, 1..2] of int: SECOND_LEVEL_NEIGHBORS; + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Decision variables +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% Defines the PCI for each node. +array[0..NUM_NODES-1] of var 0..NUM_PCIS-1: pci; + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Constraints +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% Direct neighbors must have different PCIs for avoid **COLLISION**. +constraint +forall(i in 1..NUM_NEIGHBORS)( + pci[NEIGHBORS[i, 1]] != pci[NEIGHBORS[i, 2]] +); + +% Undirect neighbors must have different PCIs for avoid **CONFUSIONS**. +constraint +forall(i in 1..NUM_SECOND_LEVEL_NEIGHBORS)( + pci[SECOND_LEVEL_NEIGHBORS[i, 1]] != pci[SECOND_LEVEL_NEIGHBORS[i, 2]] +); + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Objective function +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% Just satisfy the problem. +solve :: int_search(pci, smallest, indomain_min, complete) satisfy; + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Output +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +output +["node,pci\n"] ++ +[ + show(node) ++ "," ++ show(pci[node]) ++ "\n" +| node in 0..NUM_NODES-1 +] -- cgit 1.2.3-korg