[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-glpk] Divorce settlement
From: |
Andrew Makhorin |
Subject: |
Re: [Help-glpk] Divorce settlement |
Date: |
Mon, 25 May 2009 21:17:26 +0300 |
> Is there an easy way to make the variables mixed in this program? By
> this I mean if some items are divisible (money say) then that variable
> can be declared as >=0; if the item cannot be divided (a painting say)
> then it can be defined as binary.
> I have tried writing a version of this maximin program here
> http://pastie.org/488829 with both types of variables but it does not
> work.
> Is there a way to mix binary and other variables in this problem?
There is no such way due to the MathProg syntax. However, you can
define two arrays of variables as follows:
set I;
/* items */
set D, within I;
/* subset of divisible items */
var x1{i in I: i in D}, >= 0, <= 1;
var x2{i in I: i in (I diff D)}, binary;
and then use them everywhere instead of x[i] as follows:
foo: ... (if i in D then x1[i] else x2[i]) ...