[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Help-glpk] Re: how make Solver to select arbitrary subset of nonzero va
From: |
Andrew Makhorin |
Subject: |
[Help-glpk] Re: how make Solver to select arbitrary subset of nonzero variables with specified cardinality |
Date: |
Tue, 09 Nov 2010 14:14:15 +0300 |
> My problem is planning resources for recognition of objects .
> I have various kinds of of resources and other side various kinds of objects.
>
> To increase reliability of recognition more than one resource must be set in
> result plan for the same
> object.
> For this purpose I want to have a "overlap" param, which Solver must
> interpret in next s.t. as
> "For every Objects[i] must be planned overlap[j] types of Resources"
>
>
> s.t. overlapping{j in Objects}: card ( { i in Resources,j: x[i,j]!=0 } ) =
> overlap[j];
>
> This incorrect, I see because in this context x[i,j] can not be used.
> I hope someone have idea what I am talking about))), please help me.
First, you need to introduce auxiliary binary variables, say, as
follows:
var y{i in Resources, j in Objects}, binary;
s.t. foo{i in Resources, j in Objects}: x[i,j] <= M * y[i,j];
where y[i,j] = 0 means that x[i,j] = 0 and y[i,j] = 1 means that
0 <= x[i,j] <= M, and "big M" is an appropriate upper bound of x[i,j].
Then your constraint can be written as:
s.t. overlapping{j in Objects}: sum{i in Resources}y[i,j] = overlap[j];
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Help-glpk] Re: how make Solver to select arbitrary subset of nonzero variables with specified cardinality,
Andrew Makhorin <=