Problem with square root

404 views
Skip to first unread message

Brecht

unread,
Mar 28, 2011, 5:58:44 AM3/28/11
to AMPL Modeling Language
Hello,

I am trying to solve a model but I always get conflicts when running
this model in CPLEX. For my model, I need a square root where you can
see the _sqrt. To obtain a square root, I declared the formulation in
the last 4 statements, but if I use these statements, I always get a
conflict for ctToekenningAanEenHubOfFacility.

Best regards.

---
/*Objective function*/
minimize sum(f in Facilities)(openingskostfac[f]*z[f])
+ sum(h in Hubs)(openingskosthub[h]*w[h])
+ sum(f in Facilities, c in Customers, p in Products)
(transportkost_fac_customer[f][c]*demand_customer_prod[c][p]*y[f][c]
[p])
+ sum(h in Hubs, c in Customers, p in Products)
(transportkost_hub_customer[h][c]*demand_customer_prod[c][p]*x[h][c]
[p])
+ sum(h in Hubs, f in Facilities, c in Customers, p in Products)
(transportkost_hub_fac[h][f]*demand_customer_prod[c][p]*y[f][c][p])
+ sum(f in Facilities, p in Products)(holdingcost_fac_prod[f]
[p]*demandaggr_fac_sqrt[f][p])
+ sum(h in Hubs, p in Products)(holdingcost_hub_prod[h]
[p]*demandaggr_hub_sqrt[h][p])
+ sum(f in Facilities, p in Products)(holdingcost_fac_prod[f]
[p]*servicelevel*leadtime_fac_prod[f][p]*varianceaggr_fac_sqrt[f][p])
+ sum(h in Hubs, p in Products)(holdingcost_hub_prod[h]
[p]*servicelevel*leadtime_hub_prod[h][p]*varianceaggr_hub_sqrt[h][p]);

subject to{

forall(f in Facilities, c in Customers, p in Products)
ctTijdslimietFacilities:
y[f][c][p] * tijd_fac_customer[f][c] <= tijdslimiet;

forall(h in Hubs, c in Customers, p in Products)
ctTijdslimietHubs:
x[h][c][p] * tijd_hub_customer[h][c] <= tijdslimiet;

forall(f in Facilities, c in Customers, p in Products)
ctOpeningFacilityVereist:
y[f][c][p] <= z[f];

forall(h in Hubs, c in Customers, p in Products)
ctOpeningHubVereist:
x[h][c][p] <= w[h];


forall(c in Customers, p in Products)
ctToekenningAanEenHubOfFacility:
sum(f in Facilities)(y[f][c][p]) + sum(h in Hubs)(x[h][c][p]) ==
1;

forall(f in Facilities, p in Products)
sum(c in Customers)(demand_customer_prod[c][p] * y[f][c][p]) <=
demandaggr_fac_sqrt[f][p]^2;

forall(h in Hubs, p in Products)
sum(c in Customers)(demand_customer_prod[c][p] * x[h][c][p]) <=
demandaggr_hub_sqrt[h][p]^2;

forall(f in Facilities, p in Products)
sum(c in Customers)(variance_customer_prod[c][p] * y[f][c][p]) <=
varianceaggr_fac_sqrt[f][p]^2;

forall(h in Hubs, p in Products)
sum(c in Customers)(variance_customer_prod[c][p] * x[h][c][p]) <=
varianceaggr_hub_sqrt[h][p]^2;

}

Robert Fourer

unread,
Mar 28, 2011, 11:02:14 AM3/28/11
to am...@googlegroups.com
This model is not written in AMPL ... it looks to me like IBM's OPL modeling
language. You might want to try the "OPL using CPLEX Optimizer" forum at

http://www.ibm.com/developerworks/forums/forum.jspa?forumID=2053

In general only certain very special convex quadratic expressions are
handled by the CPLEX solver. Sometimes a problem that does not use these
expressions can be reformulated into one that does, but that depends on the
specifics of the problem. There also exist solvers for more general
nonlinear problems, but for those you would need a language like AMPL that
can deal with general nonlinearities.

Bob Fourer
4...@ampl.com

Reply all
Reply to author
Forward
0 new messages