| 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
|
_______________________________________________ Help-glpk mailing list [email protected] https://lists.gnu.org/mailman/listinfo/help-glpk
