Dear Chris,

Thank you for your help. I tried adding a name with color to each constraint, but it doesn’t seem to work. 

{"b"=>"-0.048571428571428495", "u"=>"0.0", "d"=>"0.0", "g"=>"0.0", "e"=>"0.0", "t"=>"-9.466666666666669", "x1"=>"1.0", "x2"=>"1.0", "x3"=>"1.0", "x4"=>"1.0", "x5"=>"1.0", "x6"=>"1.0", "x7"=>"1.0", "x8"=>"1.0", "x9"=>"1.0", "x10"=>"1.0", "x11"=>"1.0", "x12"=>"1.0", "x13"=>"1.0", "x14"=>"1.0", "x15"=>"1.0", "x16"=>"1.0", "x17"=>"1.0", "x18"=>"1.0", "x19"=>"1.0", "x20"=>"1.0", "f"=>"0.0"}
10945.0

Somehow the name + colon at the beginning of each constraint is spread over the values. Do I have to declare the name of each constraint in a specific way?

Thank you,

Lukas
require 'opl'

lp = maximize(
    "1400x1 + 0x1 + 100x2 + 0x2 + 2620x3 + 0x3 + 100x4 + 0x4 + 100x5 + 0x5 + 100x6 + 0x6 + 100x7+ 0x7 + 100x8 + 0x8 + 100x9 + 0x9 + 1400x10 + 0x10 +1400x11 + 0x11 + 100x12 + 0x12 + 2620x13 + 0x13 + 100x14 + 0x14 + 100x15 + 0x15 + 100x16 + 0x16 + 100x17+ 0x17 + 100x18 + 0x18 + 100x19 + 0x19 + 100x20 + 5x20",
subject_to([
    "budget, 400x1 + 2800x2 + 180x3 + 180x4 + 180x5 + 180x6 + 180x7 + 180x8 + 180x9 + 200x10 + 400x11 + 2800x12 + 180x13 + 180x14 + 180x15 + 180x16 + 180x17 + 180x18 + 180x19 + 200x20 <= 3380",
    "fte, 0.0x1 + 0.0x2 + 1.5x3 + 0.0x4 + 0.0x5 + 0.0x6 + 0.0x7 + 0.0x8 + 0.0x9 + 0.0x10 + 2.1x11 + 1.0x12 + 2x13 + 1.0x14 + 1.2x15 + 2x16 + 3x17 + 1.5x18 + 1.9x19 + 0x20 <= 1.5",
    "x1 >= 0",
    "x2 >= 0",
    "x3 >= 0",
    "x4 >= 0",
    "x5 >= 0",
    "x6 >= 0",
    "x7 >= 0",
    "x8 >= 0",
    "x9 >= 0",
    "x10 >= 0",
    "x11 >= 0",
    "x12 >= 0",
    "x13 >= 0",
    "x14 >= 0",
    "x15 >= 0",
    "x16 >= 0",
    "x17 >= 0",
    "x18 >= 0",
    "x19 >= 0",
    "x20 >= 0"
],[
    "BOOLEAN: x1",
    "BOOLEAN: x2",
    "BOOLEAN: x3",
    "BOOLEAN: x4",
    "BOOLEAN: x5",
    "BOOLEAN: x6",
    "BOOLEAN: x7",
    "BOOLEAN: x8",
    "BOOLEAN: x9",
    "BOOLEAN: x10",
    "BOOLEAN: x11",
    "BOOLEAN: x12",
    "BOOLEAN: x13",
    "BOOLEAN: x14",
    "BOOLEAN: x15",
    "BOOLEAN: x16",
    "BOOLEAN: x17",
    "BOOLEAN: x18",
    "BOOLEAN: x19",
    "BOOLEAN: x20"
]
))

puts lp.solution
puts lp.objective.optimized_value
El 18 jun 2016, a las 16:40, Chris Matrakidis <[email protected]> escribió:

Lukas,

Note that the example you provided specifies names for each constraint
(c1 and c2):

Constraints:
c1: 398 x1 + 151 x2 + 129 x3 + 275 x4 + 291 x5 <= 800
c2: 111 x1 + 139 x2 + 56 x3 + 54 x4 + 123 x5 <= 200

In contrast, the test code you attached has no names for the
constraints. What happens is that OPL searches for a colon in each
constraint and assumes that anything before it is the name. When no
colon is found, the whole line is used as the name, which is limited
to 255 characters in GLPK. This is a bug in OPL, and you should report
it. However the obvious workaround of adding a name in your constraint
should work.


Best Regards,

Chris Matrakidis

_______________________________________________
Help-glpk mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/help-glpk

Reply via email to