AMPL epsilon 约束规划

AMPL epsilon constraint programming

提问人:D. React 提问时间:3/6/2023 更新时间:3/6/2023 访问量:54

问:

我不明白为什么这个问题是无限的?我是否需要为其中一个决策变量添加另一个约束?我不知道哪一个不受约束。是无界的银行变量吗?这是我最有可能的猜测。关于为什么目标函数没有被求解并说无界的任何建议。

# AMPL code for "Titan Enterprise" problem 
reset;

#set-up options
option solver cplex;
option cplex_options 'sensitivity';

# PARAMETERES and SETS
set year;

# Decision variables for all 5 projects with respect to returns
var A >= 0; # project A
var B >= 0; # project B
var C >= 0; # project C
var D >= 0; # project D
var E >= 0; # project E

var Bank{year}  >= 0; # project years 

# objective function
minimize risk:  (B - B * .12)  + (1.75*D - D * .20) + (1.4*E - E * .05) + 1.06*Bank[3];
maximize cash:  B  + 1.75*D + 1.4*E + 1.06*Bank[3];

# PROBLEMS
problem maxCash: cash, A, B, C, D, E, Bank[1], Bank[2], Bank[3]; 
problem minRisk: risk, A, B, C, D, E, Bank[1], Bank[2], Bank[3];


# constraints
subject to project_A: A <= 500000;
subject to project_B: B <= 500000;
subject to project_E: E <= 750000;
subject to year_1: A + B + C + D + E + Bank[1] <= 1000000;
subject to year2: B + Bank[2] <= 1.06*Bank[1] + 0.3*A + 1.1*C; 
# The amount for investment for year 2 is from earnings of this year. 
subject to year3: E + Bank[3] <= 1.06*Bank[2] + A + 0.3*B; # The amount of investment for 
year 3 is from the earnings of this year.

data;

set year := 1 2 3 4;

printf "\n\EPSILON-CONSTRAINT METHOD ---------------------------------------------\n";

#get upper and lower bounds for objectives
param upperRisk;
param lowerRisk;

# in this example, put Cash as the objective function and use epsilon contstraints on the risk

# Let's get the lower and upper bounds for labor values by solving the independent problems
solve minRisk;
let lowerRisk:=risk;

solve maxCash;
let upperRisk:=risk;

param epsilon;
let epsilon := lowerRisk;

display upperRisk, lowerRisk, risk, cash;

s.t. epsilonRisk: (B - B * .12)  + (1.75*D - D * .20) + (1.4*E - E * .05) + 1.06*Bank[3] <= 
    epsilon;
problem epsConst: cash, B, D, E, Bank[3], epsilonRisk; 

param steps = 20;

printf "\n\nMultiple values for EPSILON-CONSTRAINT --------------------------------------- \n";
for {eps in 0..steps} {

let epsilon := lowerRisk + eps*(upperRisk - lowerRisk)/(steps+1);
solve epsConst;

display A, B, C, D, E, Bank[1], Bank[2], Bank[3], epsilon, cash, risk;

printf "%d, %7.4f, %7.4f, %7.4f\n", eps, epsilon, cash, risk >  
 "C:\Users\drewm\OneDrive\Documents\Advanced Data Analytics\hw4\HW4_iv_results.txt"};
优化 线性编程 Ampl epsilon

评论

0赞 Erwin Kalvelagen 3/6/2023
为变量添加较大的上限。再次运行并检查结果。这应该提供足够的信息来调试模型。

答: 暂无答案