Ampl Cplex QP Hessian不是半正定的。没有依据。错误

时间:2018-04-29 22:25:20

标签: optimization linear-programming cplex quadratic ampl

++出现的错误似乎来自我的模型文件中的非线性约束。我无法找到特定的冲突区域。下面附有我手边的模型文件。我试过从约束和变量中删除“=”。任何见解将不胜感激!

希望评论有助于理解设置,但基本方案是找到来自不同目的地的沙发和椅子的生产,运输和销售成本的最佳利润。

 #Parameters

param I; #Number of Plants

param J; #Number of Products

param K; #Number of Raw Material

param P; #Number of Type of Paid hours

param L; #Number of Processes

param M; #Number of Supplies

param N; #Number of Cities

param r{k in 1..K,j in 1..J}; #amount of raw material k required per unit of product j

param q{j in 1..J}; #miscellaneous production cost (in dollars) per unit of product i produced

param z{p in 1..P}; #total type of working hours p (regular or overtime) available per month

param t{l in 1..L,j in 1..J,i in 1..I}; #time (in hours) required by process l to produce product j at plant i.

param e{p in 1..P}; #salary multiplier for regular/overtime (p) paid hours

param w{l in 1..L, i in 1..I}; #regular salary cost (in dollars) per hour for process l at plant i.

param c{m in 1..M,k in 1..K}; #cost (in dollars) per unit of raw material k from supplier m

param h{m in 1..M,i in 1..I}; #cost (in dollars) per unit of raw material shipped from supplier m to plant i.

param Price{j in 1..J,n in 1..N}; #selling price (in dollars) per unit of product j in city n.

param Low{j in 1..J,n in 1..N}; #minimum demand (in number of units) of product j in city n

param U{j in 1..I,n in 1..N}; #maximum demand (in number of units) of product j in city n

param s{j in 1..J,i in 1..I,n in 1..N}; #shipping cost (in dollars) for product j shipped from plant i to city n.

param D{m in 1..M,k in 1..K}; #maximum amount of raw material k available from supplier m per month.



#Decision Variables

var x{i in 1..I,j in 1..J,n in 1..N}>=0; #number of units of product j produced by regular hours, shipped from plant i to city n. and non-negativity

var y{i in 1..I,j in 1..J,n in 1..N}>=0; #number of units of product j produced by overtime hours, shipped from plant i to city n. and non-negativity

var d{m in 1..M,k in 1..K}>=0; # demand of raw material k required from supplier m. and non-negativity

var revenue=sum{i in 1..I, j in 1..J, n in 1..N}(x[i,j,n]*y[i,j,n])*Price[j,n]; #total revenue generated by selling products.

var rawMatCost=sum{m in 1..M,k in 1..K} d[m,k]*c[m,k]; #total cost of purchasing raw material.

var rawMatShipCost=sum{m in 1..M,k in 1..K,i in 1..I} d[m,k]*h[m,i]; #total cost of shipping raw material

var salCost=sum{i in 1..I,j in 1..J,l in 1..L,n in 1..N} (x[i,j,n]*e[1]+y[i,j,n]*e[2])*(t[l,j,i]*w[l,i]); #total salary paid.

var prodShipCost=sum{i in 1..I,j in 1..J,n in 1..N}(x[i,j,n]+y[i,j,n])*s[j,i,n]; #total cost of shipping products

var miscCost=sum{i in 1..I,j in 1..J,n in 1..N} (x[i,j,n]+y[i,j,n])*q[j]; #total miscellaneous cost.



#Objective function

maximize MonthProfit: 
(revenue-rawMatCost-rawMatShipCost-salCost-prodShipCost-miscCost); #Total Monthly Profit



subject to
RawConsumed1{k in 1..K}:sum{i in 1..I,j in 1..J,n in 1..N}(x[i,j,n]+y[i,j,n])*r[k,j]>=sum{m in 1..M}d[m,k]; #Raw Material Consumed

RawConsumed2{k in 1..K}:sum{i in 1..I,j in 1..J,n in 1..N}(x[i,j,n]+y[i,j,n])*r[k,j]<=sum{m in 1..M}d[m,k]; #Raw Material Consumed

rawSup{k in 1..K}:sum{m in 1..M}d[m,k]<=sum{m in 1..M}D[m,k]; #Raw Material Supplied

RegTConsum{i in 1..I,l in 1..L}:sum{j in 1..J,n in 1..N}x[i,j,n]*t[l,j,i]<=z[1]; #Regular Time consumption

OverTConsum{i in 1..I,l in 1..L}:sum{j in 1..J,n in 1..N}y[i,j,n]*t[l,j,i]<=z[2]; #Overtime Consumption

MinDemand{j in 1..J,n in 1..N}:sum{i in 1..I}(x[i,j,n]+y[i,j,n])>=Low[j,n]; #minimum Demand

MaxDemand{j in 1..J,n in 1..N}:sum{i in 1..I}(x[i,j,n]+y[i,j,n])<=U[j,n]; #Maximum Demand

0 个答案:

没有答案