On 19 Gen, 23:57, Paul <
parubi...@gmail.com> wrote:
> There's nothing structurally wrong with your approach (or at least as much
> as is shown in your post). You defined Constraints as having second
> dimension 1..NUM_EDGES but summed over 1..NUM_EDGES_NW when defining
> constraints; I can't tell if that's deliberate or a typo.
Sorry, it was a mistake, the 1..NUM_EDGES_NW should be 1..NUM_EDGES.
> You might try issuing the command 'expand ConstraintSet;' after the second
> solve, to see if (a) the second constraint is present and (b) it is what you
> expected. If the second constraint is there but a duplicate of the first,
> then you have a bug elsewhere in your code.
I've tried to issue the 'expand' command and the constraints were all
there.
They were duplicated so I discovered a bug in my code and I solved it.
Now seem that it's working but I've another question. The problem that
I must
solve is defined as follows:
maximize TotalCapacity: sum {j in 1..NUM_EDGES} link_capacity[j] *
x[j];
subject to Budget:
sum {j in 1..NUM_EDGES} link_cost[j] * x[j] <= BUDGET;
subject to ConstraintSet {i in 1..constraints}:
sum {j in 1..NUM_EDGES} Constraints[i, j] * x[j] >= 1;
ConstraintSet is the set of constraints that I'm building at runtime.
I'm not sure about how to define x variables:
var x {i in 1..NUM_EDGES} >= 0, <= 1;
#var x {i in 1..NUM_EDGES} binary;
The set of constraints in ConstraintSet should assure me that if a
vector x
satisfies all constraints into this set, it must be an incidence
vector of
a covering graph of the original one (in other words the same graph
with a
subset of the edges such that the resulting graph is still connected).
Should I define x variables binary or continuous? I was thinking that
if a
vector x satisfies ConstraintSet then it must be an incidence vector
and so
it cannot hold fractional values, but it can only be a binary vector.
Unfortunately, declaring x continuous, cplex gives me a fractional
solution.
Is this due to the fact that ConstraintSet is built dinamically so
during the
execution it's not complete? So should I declare x as binary
variables?
Thanks again