Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Binary variables #60

Open
rgesulfo opened this issue Apr 25, 2017 · 1 comment
Open

Binary variables #60

rgesulfo opened this issue Apr 25, 2017 · 1 comment

Comments

@rgesulfo
Copy link

rgesulfo commented Apr 25, 2017

Does this package handle binary variables?

I tried this in the Tableau format, but I'm not getting the expected result.

rawModel = [ "max: 21 x11 22.5 x21 22.5 x12 24.5 x22 23 x13 25.5 x23 1500 y1 2000 y2 3000 y3", "1 x11 1 x21 <= 425", "1 x12 1 x22 >= 400", "1 x13 1 x23 >= 750", "1 x11 1 x12 1 x13 >= 550", "1 x21 1 x22 1 x23 >= 450", "1 x11 1 x21 -425 y1 <= 0", "1 x12 1 x22 -400 y2 <= 0", "1 x13 1 x23 -750 y3 <= 0", "1 x11 >= 0", "1 x12 >= 0", "1 x13 >= 0", "1 x21 >= 0", "1 x22 >= 0", "1 x23 >= 0", "y1 = {0,1}", "y2 = {0,1}", "y3 = {0,1}", "int x11", "int x21", "int x12", "int x22", "int x13", "int x23", ];

Thank you for your help.

@JWally
Copy link
Owner

JWally commented Oct 24, 2017

Sorry for the late response.

At the moment, the re-format functionality needs to be cleaned up and updated.
The library itself handles binary variables; however ReformatLP doesn't (yet).

In the mean time, would this hacky solution work?:

var problem = [ 
    "max: 21x11 22.5x21 22.5x12 24.5x22 23x13 25.5x23 1500y1 2000y2 3000y3", 
    "1x11 1x21 <= 425", 
    "1x12 1x22 >= 400", 
    "1x13 1x23 >= 750", 
    "1x11 1x12 1x13 >= 550", 
    "1x21 1x22 1x23 >= 450", 
    "1x11 1x21 -425y1 <= 0", 
    "1x12 1x22 -400y2 <= 0", 
    "1x13 1x23 -750y3 <= 0", 
    // I think these are redundant
    "1x11 >= 0", 
    "1x12 >= 0",
    "1x13 >= 0", 
    "1x21 >= 0", 
    "1x22 >= 0", 
    "1x23 >= 0", 
    "int x11", 
    "int x21", 
    "int x12", 
    "int x22", 
    "int x13", 
    "int x23",
    // AKA CHEATING
    "int y1",
    "int y2",
    "int y3",
    "1y1 <= 1",
    "1y2 <= 1",
    "1y3 <= 1"
    ];

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants