【线性规划LP建模实例——香水】

【线性规划LP建模实例——香水】

在这里插入图片描述
configExe

perfumes.mod

perfumes.mod

/*********************************************
 * OPL 12.6.0.0 Model
 * Perfumes
 *********************************************/

//Make sure you use c[i] to access the i-th cost 
//and do not remove/change the following line
float c[1..2] = [300, 500];

dvar float+ perfume1;
dvar float+ perfume2;

maximize c[1]*perfume1+c[2]*perfume2;

subject to {
    perfume1*1+perfume2*0<=4;  //	Material A
    perfume1*0+perfume2*2<=12; //	Material B
    perfume1*3+perfume2*2<=18; //	Material C 

}

/* Display */
execute {
  writeln("Post-traitement: ");
  writeln("La valeur de l'objectif est de "+cplex.getObjValue());
} 

运行结果

Default LOCALE: en_US.UTF-8                                                                                                         
IBM ILOG CPLEX Optimization Studio Community Edition.  The CPLEX Optimizers will solve problems up to 1000 variables and 1000 constr
aints.                                                                                                                              
CP Optimizer (Community Edition) solves problems with a search space of up to 2^1000                                                
                                                                                                                                    
<<< setup, at 0s, took 1.64574e+09s                                                                                                 
                                                                                                                                    
                                                                                                                                    
<<< generate, at 0.01s, took 0.00521398s                                                                                            
                                                                                                                                    
Tried aggregator 1 time.                                                                                                            
LP Presolve eliminated 2 rows and 0 columns.                                                                                        
Reduced LP has 1 rows, 2 columns, and 2 nonzeros.                                                                                   
Presolve time = 0.00 sec. (0.00 ticks)                                                                                              
                                                                                                                                    
Iteration log . . .                                                                                                                 
Iteration:     1   Dual objective     =          3600.000000                                                                        
                                                                                                                                    
<<< solve, at 0.01s, took 0.000514984s                                                                                              
                                                                                                                                    
                                                                                                                                    
OBJECTIVE: 3600                                                                                                                     
Post-traitement:                                                                                                                    
La valeur de l'objectif est de 3600                                                                                                 
                                                                                                                                    
<<< post process, at 0.01s, took 0.000190973s                                                                                       
                                                                                                                                    
// solution (optimal) with objective 3600                                                                                           
// Quality There are no bound infeasibilities.                                                                                      
// There are no reduced-cost infeasibilities.                                                                                       
// Maximum Ax-b  residual             = 0                                                                                           
// Maximum c-B'pi residual            = 0                                                                                           
// Maximum |x|                        = 6                                                                                           
// Maximum |slack|                    = 2                                                                                           
// Maximum |pi|                       = 150                                                                                         
// Maximum |red-cost|                 = 0                                                                                           
// Condition number of unscaled basis = 6.9e+00                                                                                     
//                                                                                                                                  
                                                                                                                                    
perfume1 = 2;                                                                                                                       
perfume2 = 6;                                                                                                                       
                                                                                                                                    
<<< done, at 0.01s, took 0.000177145s 
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值