Questions in topic: "constraint"
https://developer.ibm.com/answers/questions/topics/single/187529.html
The latest questions for the topic "constraint"How to formulate decision variables and constraints in matrix form in cplex?
https://developer.ibm.com/answers/questions/514564/how-to-formulate-decision-variables-and-constraint.html
I have decision variables da(i,j) dc(i,j) n(j,i) accordingly. How can I add these decision variables to my model in matrix form.
Also later on I want to create constraints using these decision variables which is equal to another matrix.
for example: constraint da + dc = d ,(da,dc are decision variables , d is input data)
Can someone help me?
Any help appreciated!
(I'm new to python cplex)cplexdocplexconstraintmatrixTue, 13 Aug 2019 05:13:55 GMTJason ThomNon-strict inequalities Python API
https://developer.ibm.com/answers/questions/505047/non-strict-inequalities-python-api-1.html
Hello everybody!
Context of my question: using Cplex Python API (with Python 3.7)
I found this in the description for the "senses" parameter in function add(self, lin_expr=None, senses='', rhs=None, range_values=None, names=None)
"senses must be either a list of single-character strings or a string containing the senses of the linear constraints. Each entry must be one of 'G', 'L', 'E', and 'R', indicating greater-than, less-than, equality, and ranged constraints, respectively."
(The link of this description is available in: https://www.ibm.com/support/knowledgecenter/SSSA5P_12.9.0/ilog.odms.cplex.help/refpythoncplex/html/cplex._internal._subinterfaces.LinearConstraintInterface-class.html)
I would like to know how I add a less than or equal to inequality, e.g., "x1 + x2 >= 2", something that is possible when I use the Cplex C++ ConCert Technology
Thanks in advance for your time to what probably is a really basic question (although I haven't been able to find the reply in a while)
Best regards,
DiegopythoncplexconstraintFri, 17 May 2019 17:50:50 GMTdiegorossitNon-strict inequalities Python API
https://developer.ibm.com/answers/questions/505041/non-strict-inequalities-python-api.html
Hello everybody!
Context of my question: using Cplex Python API (with Python 3.7)
I found this in the description for the "senses" parameter in function add(self, lin_expr=None, senses='', rhs=None, range_values=None, names=None)
"senses must be either a list of single-character strings or a string containing the senses of the linear constraints. Each entry must be one of 'G', 'L', 'E', and 'R', indicating greater-than, less-than, equality, and ranged constraints, respectively."
(The link of this description is available in: https://www.ibm.com/support/knowledgecenter/SSSA5P_12.9.0/ilog.odms.cplex.help/refpythoncplex/html/cplex._internal._subinterfaces.LinearConstraintInterface-class.html)
I would like to know how I add a less than or equal to inequality, e.g., "x1 + x2 >= 2", something that is possible when I use the Cplex C++ ConCert Technology
Thanks in advance for your time to what probably is a really basic question (although I haven't been able to find the reply in a while)
Best regards,
DiegopythoncplexconstraintFri, 17 May 2019 16:51:44 GMTdiegorossitHow can I find the inconsistent constraints in CPLEX with Matlab?
https://developer.ibm.com/answers/questions/486612/how-can-i-find-the-inconsistent-constraints-in-cpl.html
I was trying to solve a MIP model with Cplex and Matlab. For convienient, I use yalmip to generate the constraints and solve the model by using function sdpsolve(). Obviously I have done something wrong, the Cplex shows that it's an infeasibleth problem and there are two constraint 'c201' and 'c211' are inconstent. But I have exactly no idea what these are and how to find it, so could you please help me figure out how to find these constraints?cplexmatlabconstraintWed, 02 Jan 2019 15:31:55 GMTSiddharth4Why does constraints of my cplex file fail to work?
https://developer.ibm.com/answers/questions/483400/why-does-constraints-of-my-cplex-file-fail-to-work.html
Hi guys,
I am an new user of IBM ILOG and just wrote the first cplex file today. For some reason, the constraints of my formulation doesn't affect the result and the solution is not correct.I attach the screenshot of that constraint below. The solution has more than one "1" finally, which doesn't make sense. If there is someone who could give me a favor, I would appreciate it very much.
![alt text][1]
[link text][2]
Many thx in advance.
[1]: /answers/storage/temp/25616-constraint.jpg
[2]: /answers/storage/temp/25615-microgrid.txtcplexoplconstraintTue, 04 Dec 2018 05:58:39 GMTPower JackVRP binar non-binary
https://developer.ibm.com/answers/questions/482613/vrp-binar-non-binary.html
hi,
i am writing a VRP model, and i want to link a binary and non binary variables in the same constraint. what i want to say is that if the path xij is chosen, then the constraint is considered otherwise it is 0 (C3 and C4).
i tried using big M but when i ran my model, all the paths were chosen even though i set a constraint saying that a path can only be chosen once.
Here is my model :
//Parameters
int n=...; //Number of Stations
range I=1..19; //from I
range J=1..19; // to J
float c[I][J]=...; //cost
int B_optimal[I]=...; //what we want
int B_upperlimit[I]=...; //what we acccept
int B_lowerlimit[I]=...; //what we accept
int M=100000000;
tuple pinfo
{
int station;
float c[J];
}
pinfo Stationinfo[I];
execute Initialize
{
for (var i in I) {
Stationinfo[i].station=i;
for (var j in J){
Stationinfo[i].c[j]=c[i][j];
}
}
}
tuple result
{ int bikes;
int X_in [I];
int X_out[I];
}
result Result[I];
//Decision Variables
dvar int+ X_in[I];
dvar int+ X_out[I];
int B_currentnumber[I]=...;
dvar boolean x[I][J];
dvar float+ u[I];
//Objective Function
//minimize sum(i in I, j in J : i!=j) (Stationinfo[i].cost[j]*x[i][j]); //+ abs(B_optimal[i] - (B_currentnumber[i] +X_in[i] - X_out[i])));
//minimize sum(i in I, j in J : i!=j) (Stationinfo[i].c[j]*x[i][j]);
minimize sum(i in 1..n-1, j in i+1..n)(Stationinfo[i].c[j]*x[i][j]);
//Constraints
subject to {
c1:
//forall (i in I)
sum (j in 2..19) x[1][j]==1;
c2:
//forall (j in J)
sum (i in 2..19) x[i][1]==1;
c3:
forall (i in 1..n-1, j in i+1..n)
B_currentnumber[i] + X_in[i] - X_out[i] <= B_upperlimit[i]+ M*(1-x[i][j]);
c4:
forall (i in 1..n-1, j in i+1..n )
(B_currentnumber[i] + X_in[i] - X_out[i]) >= B_lowerlimit[i]+ M*(1-x[i][j]);
c5:
forall (j in J)
sum (i in I: i!=j) x[i][j]==1;
c6:
forall (i in I)
sum (j in J: j!=i) x[i][j]==1;
c7:
sum (i in I)(X_in[i])== sum(i in I)(X_out[i]);
c8:
forall (i in I){
sum(j in J:i!=j)x[i][j] == 1;
sum (j in J: i!=j) x[i][j] ==1;
}
c9:
u[1]==1;
c10:
forall (i in I: i!=1) {
u[i]<=n;
u[i] >= 2;
}
c11:
forall(i in 2..19, j in 2..19: i!=j)
u[i]-u[j] + 19*x[i][j] <= 18;
}
execute output
{ for (var i in I) {
for (var j in J){
Result [i].X_in[i]=B_currentnumber[i];
Result [i].X_out[i]=B_currentnumber[i];
}
}
writeln(Result[i]);
}
DATA
SheetConnection sheet("BIXI.xlsx");
c from SheetRead (sheet, "Sheet2!B4:T22");
n from SheetRead (sheet, "Sheet1!A2");
B_optimal from SheetRead (sheet, "Sheet1!C2:C20");
B_upperlimit from SheetRead (sheet, "Sheet1!D2:D20");
B_lowerlimit from SheetRead (sheet, "Sheet1!E2:E20");
B_currentnumber from SheetRead (sheet, "Sheet1!B2:B20");
//X_in to SheetWrite (sheet, "Sheet1!F2:F19");
//X_out to SheetWrite (sheet, "Sheet1!G2:G19");
thanking you in advancecplexindexconstraintbinaryWed, 28 Nov 2018 17:59:49 GMTfrexkCPLEX encountered arrays with inconsistent lengths.
https://developer.ibm.com/answers/questions/473047/cplex-encountered-arrays-with-inconsistent-lengths.html
Dear all,
I try to find an optimum to a MILP problem (see code below). Therefore, I apply the CPLEX solver's Matlab API. I now get the error message:
Error using cplexmilp. CPLEX encountered arrays with inconsistent lengths.
To me, it seems like the reason must either be with the SOSs constraints or the lb, ub constraints, but I just couldn't figure out why. Also, it's my first time using SOSs constraints at all.
%% Optimization Framework
% General Definitions
p = Data.RAW.Marginal_Prices; % price vector
Smax = 13.5; % capacity
Pmax = 5; % maximal charging/discharging power
eta = 0.92; % battery efficiency
eta_c = sqrt(eta); % charge efficiency
eta_d = 1/sqrt(eta); % discharge efficiency
beta = 0.1; % in case penalty term is applied
% CPLEX Manipulation (split between charging and discharging)
p = [p;p];
%% Wholesale Arbitrage
% Cost function (minimize for arbitrage (negative))
f = p; % Double column vector for linear objective function
% Constraints
a1 = eye(length(p));
a2 = a1*-1;
tril1 = tril(ones(length(p)/2));
tril1 = tril1 * eta_c;
tril2 = tril(ones(length(p)/2));
tril2 = tril2 * eta_d;
a3 = [tril1, tril2];
a4 = a3*-1;
b1(1:2*length(p),1) = Pmax;
b2(1:length(p),1) = Smax/2;
lb1(1:length(p)/2,1) = 0;
lb2(1:length(p)/2,1) = -inf;
ub1(1:length(p)/2,1) = inf;
ub2(1:length(p)/2,1) = 0;
Aineq = [a1; a2; a3; a4]; % Linear inequality constraint: Aineq*x <= bineq.
bineq = [b1; b2];
Aeq = []; % Linear Equality constraint: Aeq*x = beq
beq = [];
lb = [lb1; lb2]; % Lower and upper bounds
ub = [ub1; ub2];
sostype = repmat('1', [1, length(p)/2]); % Replicate 1 time vertically, n times horizontally.
v1 = 1:length(p); % Create Vector
v2 = reshape(v1, [], 2)'; % Reshape Vector To 2-Row Matrix
sosind = mat2cell(v2, 2, ones(1,size(v2,2))); % Create Cell Array
v3(1:length(p)/2,1) = 0;
v4(1:length(p)/2,1) = 1;
v5 = [v3 v4]';
soswt = mat2cell(v5, 2, ones(1,size(v5,2)));
ctype = repmat('C', [1, length(p)]); % Replicate 1 time vertically, n times horizontally.
% Solver - IBM ILOG CPLEX
options = cplexoptimset;
options.Display = 'on';
[x,fval] = cplexmilp(f,Aineq,bineq,Aeq,beq,sostype,sosind,soswt,lb,ub,ctype,options);
Does anybody see the flaw here? The vector given by Data.RAW.Marginal_Prices looks like this:
51,52 51,52 51,52 51,52 67,30 67,30 74,01 74,01 74,01 74,01 74,01 74,01 74,01 74,01 74,01 74,01 74,01 74,01 74,01 74,01 74,01 67,30 67,30
Thanks a lot! MathiascplexoptimizationconstraintmatrixWed, 03 Oct 2018 10:35:41 GMTMathias_RWTHOptimization Constraint: One of every two variable pairs must be zero!
https://developer.ibm.com/answers/questions/471330/optimization-constraint-one-of-every-two-variable.html
Dear Community,
I ran into a problem I just couldn't solve:
I apply CPLEX to solve an optimization function as follows, with x being of the dimension of [2*8760 x 1]:
fun = @(x) x(:).'*p(:);
Now, I want to constrain that for every two elements of x, one must equal zero. Means, either x1 or x2 is zero; the same for the elements x3 and x4, x5 and x6 and so on...
Doing so, I can of course only use the constraint syntax as follows:
- a) Aineq*x <= bineq
- b) Aeq*x = beq
So, I would have to define either Aineq or Aeq and bineq or beq to achieve this constraint. Does anybody see any solution here? I am on the edge of losing my mind...
I am really looking forward to your thoughts on this! Thanks a lot!cplexoptimizationconstraintmatrixThu, 20 Sep 2018 15:45:57 GMTMathias_RWTHCan DOCplexCloud provide named constraints for infeasibilities?
https://developer.ibm.com/answers/questions/470253/can-docplexcloud-provide-named-constraints-for-inf.html
Can DOCplexCloud provide named constraints for infeasibilities?
It seems that the DOCplexCloud version for CPLEX returns constraint numbers when there are infeasibilities.
Infeasibility row 'c3510': 0 <= -1.
Is there a way for the cloud version to return the constraint name?cplexdocplexcloudconstraintThu, 13 Sep 2018 18:36:33 GMTJaneMHi, I want to know how to encode these two sum around in blue as constraint with Cplex using only the IBM ILOG CPLEX Optimization Studio software
https://developer.ibm.com/answers/questions/455691/hi-i-want-to-know-how-to-encode-these-two-sum-arou.html
![alt text][1]
[1]: /answers/storage/temp/22917-sans-titrekkkk-11.jpgcplexaddbranchconstraintWed, 27 Jun 2018 22:59:10 GMTSiWwConstraint programming
https://developer.ibm.com/answers/questions/452483/constraint-programming.html
Hi, I'm doing constraint programming using DoCplex and Python, to model an aircraft recovery problem.
2573 BAE300#1 LIG 07/01/06 05:30:00 ORY 07/01/06 06:35:00 0
2574 BAE300#1 ORY 07/01/06 08:00:00 LIG 07/01/06 09:00:00 0
2581 BAE300#1 LIG 07/01/06 10:48:00 CDG 07/01/06 12:03:00 1
2582 BAE300#1 CDG 07/01/06 12:30:00 LIG 07/01/06 13:45:00 0
The fields are: idFlight, aircraft, origin, dep. Date, dep. Time, destination, arr. Date, arr. Time, infeasible
The constraints are:
Transitime between flight >= 30 min.
Conitinuity between flights: arr. airport curr. flight == dep. airport of next flight
Airport departure capacity: no. dep./hour <= max_dep
Airport arrival capacity: no. arr./hour <= max_arr
I have coded the delay part:
for indexCurr, rCurr in enumerate(rotationList[:-1]):
currArrInt = rCurr.altArrInt
nextDepInt = rotationList[indexCurr+1].altDepInt
idNextFlight = rotationList[indexCurr+1].idFlight
tt = nextDepInt - currArrInt
# initialize the model variables
delay = mdl.integer_var(0, 2160, "delay"+str(idNextFlight))
ALL_DELAYS.append(delay)
mdl.add(tt + delay >= 30)
and for this case it returns delay2582 = 3
However there situations where it is not possible to delay because of airport capacity constraints. So my questions are:
How do I introduce cancellation?
If a flight is cancelled in the middle of the schedule how do I ensure continuity?
Best
FrancispythondocplexconstraintprogrammingSat, 09 Jun 2018 19:01:21 GMTFrancis@qmulIloAlgorithm cannot extract extractables
https://developer.ibm.com/answers/questions/413256/iloalgorithm-cannot-extract-extractables.html
I've already found the error constraints:
x[i][j][k]*(m[i][k]+travel_time[i][j]+pickup_delivery_time[i]-m[j][k])==0
in which x[i][j][k] is a binary variable
and m[i][k] is a real variable[0,1440],
and travel_time[i][j] & pickup_delivery_time are two real numbers.
This constraint is for time window in vehicle routing problem.
Could you tell me how to handle this problem? Can CPLEX support this kind of constraint?
The error message:
![alt text][1]
Thanks
[1]: /answers/storage/temp/18580-error-message.pngcplexextractconstraintWed, 15 Nov 2017 12:23:22 GMTxjtuIEhuan16How to use Search constraints REST API specification
https://developer.ibm.com/answers/questions/392142/how-to-use-search-constraints-rest-api-specificati-1.html
Hello everyone, recently I needed to use the search REST API for a project, I found the documentation and do step by step as follows: https://www.ibm.com/support/knowledgecenter/SSYJ99_8.5.0/Search-Rest-api/Search.html
But to search constraints, I use it according to the documentation, the results returned incorrect. I want to ask do I need to configure where in the portal to use search constraints ? I am using IBM WebSphere Portal 9 Build Level: 20161208-1058 2016-12-08 12:09 CF13. Thank you!
I use link URL search rest api: http://localhost:10039/wps/contenthandler/searchfeed/search?constraint={"type":"field","id":"authoringtemplate","values":["bidv-template-demo"]}&queryLang=en&locale=en&resultLang=en&query=developer&scope=com.ibm.lotus.search.ALL_SOURCES☆t=0&results=10digexprestapisearch portalsearch-resultconstraintMon, 07 Aug 2017 07:01:09 GMTfreeman92How to use Search constraints REST API specification
https://developer.ibm.com/answers/questions/392122/how-to-use-search-constraints-rest-api-specificati.html
Hello, recently I needed to use the search REST API for a project, I found the documentation and do step by step as follows: https://www.ibm.com/support/knowledgecenter/SSYJ99_8.5.0/Search-Rest-api/Search.html
But to **search constraints**, I use it according to the documentation, the results returned incorrect. I want to ask do I need to configure where in the portal to use search constraints ? I am using **IBM WebSphere Portal 9 Build Level: 20161208-1058 2016-12-08 12:09 CF13**. Thank you!
I use link URL search rest api: http://localhost:10039/wps/contenthandler/searchfeed/search?constraint={"type":"field","id":"authoringtemplate","values":["bidv-template-demo"]}&queryLang=en&locale=en&resultLang=en&query=developer&scope=com.ibm.lotus.search.ALL_SOURCES&start=0&results=10restapisearch portalconstraintMon, 07 Aug 2017 03:13:06 GMTfreeman92How to re-import information of constraints for each term in WEX studio dictionaries?
https://developer.ibm.com/answers/questions/383592/how-to-re-import-information-of-constraints-for-ea.html
Hey you all,
What we want to do is after exporting a dictionary, matching some terms (as synonyms or additional entries in the dictionary), and re-import the dictionary without losing the information of the constraints of each term as well as their inflections.
In Detail:
When I export the dictionary I receive a csv like this (Pic 1) ![alt text][1]:
So you see the binary Code highlighted yellow? I guess this is the information about the Constraints (alone, begin, middle, end).
Now the challenge: The file we import/ what WEX Studio allows us to import looks like (Pic 2):
![alt text][2]
So there is just the different categories of the dictionary and terms as synonyms. The thing is, it is not possible to re-import the export file with all the given information.
For me it would be amazing if there were a possibility to also import the information about the constraints for each term. Because there are a lot of false positives with false constraints, especially in the german language with all the compounds.
I already tried the option (see Pic 3) below as well (requires some re-formatting of the .csv and such things), but it was certainly not a straight forward solution.
![alt text][3]
Thank you very much in advance for your help!
[1]: /answers/storage/temp/15823-pic1.png
[2]: /answers/storage/temp/15824-pic-2.png
[3]: /answers/storage/temp/15825-pic-3.pngwatsonhow-towatson-explorerstudiowexdictionaryconstrainttermsTue, 27 Jun 2017 10:02:33 GMTViVaWatson2202How can we update an column with Foreign key constraint in DB2?
https://developer.ibm.com/answers/questions/325073/how-can-we-update-an-column-with-foreign-key-const.html
I have 2 Tables , please check images attached
PK: ![![PK][1]
FK: ![![FK][3]
P_Id in Pk table is the primary key and P_Id in FK table is the foreign key.
I need to add 10 to all records in P_Id column of both PK and FK table( meaning they need to match always)
I know in MS SQL we can easily update cascade as follows:
**ALTER TABLE FK
ADD CONSTRAINT FK_P_Id
FOREIGN KEY (P_Id)
REFERENCES PK (P_Id) ON UPDATE CASCADE**
and then update the rows of PK , which will automatically update FK too.
**update A
set A.P_Id= A.P_Id + 10
from PK A inner join FK B
on A.P_Id = B.P_Id**
But, i am not sure how this works in DB2.. can someone please help?
How can i get this to work?
Thanks in advance
[1]: /answers/storage/temp/11181-pk.png
[3]: /answers/storage/temp/11182-fk.pngdb2db2luwhow-todbdsupportdb2supportcolumnconstraintforeignSat, 03 Dec 2016 19:38:39 GMTswatswatHow to access the index of binary decision variable and put a constraint on it?
https://developer.ibm.com/answers/questions/320106/how-to-access-the-index-of-binary-decision-variabl.html
I have a decision variable X[i][t], Where i(1..20) is the index for notifications and t(1..100) is the index for time in my problem.
My problem is to assign X[i][t] such values that t in X[i+1][t] is greater than previously selected t.
I'll try to describe my problem. I have the inflow of notifications and I have a horizon of time. I have a binary decision variable X[i][t] which is 1 when i th notification is selected at time period t. But when the decision comes to select the next notification the time period now should be greater than the previous index t. As one can logically think the time to display next notification should be greater than the previous one.
Can anyone suggest a constraint such that I can access the index t in X[i][t] and use some formulation to make sure that the next t selected is greater than the previous one.
the code is as below:
range notification=1..20;
range modality=1..3;
range time=1..100;
float comm_score[notification]= [7,3,2,3,2,1,1,1,1,1,2,1,8,9,2,2,1,8,2,1];
float interf_score[modality][time]= [[9 ,9 ,5 ,5, 6 ,6, 9, 6, 9, 9, 9, 9, 9, 8, 9, 9, 9, 9, 9, 9, 6, 8, 9, 9, 9, 9, 9, 9, 9, 9, 5, 9, 9, 5, 9, 5, 5, 6, 5, 8, 9, 9, 8, 6, 9, 9, 9, 9, 9, 8, 9, 9, 9, 5, 5, 9, 9, 9, 8, 9, 9, 9, 9, 9, 9, 5, 9, 9, 5, 9, 9, 9, 9, 5, 9, 9, 6, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 6, 6, 5, 9, 6, 9, 9, 5, 9, 9, 9, 5, 5],
[9 ,9 ,8 ,5 ,8 ,9, 7, 8, 9, 7, 9, 9, 5, 9, 5, 9, 9, 9, 6, 9, 8, 9, 9, 9, 7, 7, 9, 9, 8, 8, 5, 9, 5, 5, 6, 5, 5, 9, 5, 9, 9, 9, 9, 9, 9, 7, 5, 7, 9, 9, 8, 9, 8, 8, 5, 7, 9, 7, 9, 9, 7, 9, 9, 9, 9, 8, 5, 8, 5, 5, 7, 9, 9, 5, 5, 8, 8, 9, 7, 7, 9, 9, 9, 9, 7, 9, 7, 8, 9, 8, 7, 8, 5, 9, 8, 9, 9, 7, 8, 5],
[9 ,9 ,7, 5 ,7, 7, 7, 7, 9, 7, 7, 9, 5, 6, 5, 9, 9, 9, 6, 9, 7, 6, 9, 9, 7, 7, 7, 9, 7, 7, 5, 9, 5, 5, 6, 5, 5, 7, 5, 6, 9, 7, 6, 7, 7, 7, 5, 7, 9, 6, 7, 9, 7, 7, 5, 7, 9, 7, 6, 9, 7, 9, 9, 7, 7, 7, 5, 7, 5, 5, 7, 9, 9, 5, 5, 7, 7, 6, 7, 7, 7, 7, 7, 9, 7, 9, 7, 7, 7, 7, 7, 7, 5, 9, 7, 7, 7, 7, 7, 5]];
dvar float+ X[notification][time];
dvar float+ m[notification][modality][time];
maximize sum(i in notification,t in time) (comm_score[i]*X[i][t])+sum(i in notification, j in modality, t in time)( interf_score[j][t]*m[i][j][t]);
subject to{
forall( i in notification) sum ( t in time) (X[i][t] + X[i][t]) <=1;
}cplexindexconstraintbinaryMon, 14 Nov 2016 07:38:36 GMTHazard!!How to alter a table with constraint null to not null in existing tables having data
https://developer.ibm.com/answers/questions/274123/how-to-alter-a-table-with-constraint-null-to-not-n.html
Hello Experts,
Am a newbie for IBM DB2. I have a requirement with my business where a column is nullable, which i need to change it to Not-Null. Is there any possibility to do that? If so how. Would really appreciate for correct answerstablesdecision tableconstraintMon, 23 May 2016 18:28:24 GMTkrishna2345add constraints to the model in cplex
https://developer.ibm.com/answers/questions/264826/add-constraints-to-the-model-in-cplex.html
Hi all,
I am using Cplex with C++ to find MIP , when i find LP solution for graph i want to add a cut and try again , but when i do this the optimal solution stay the same value.
can any one help me please?
code of program is attached
#include <ilcplex/ilocplex.h>
#include <ilconcert/ilolinear.h>
#include <ilconcert/iloexpression.h>
#include<ilconcert/iloextractable.h>
#include<ilconcert/iloalg.h>
#include<ilconcert/iloenv.h>
#include"iostream"
#include"fstream"
#include<vector>
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
//#define CPX_PARAM_SCRIND 1035
//#define CPX_BRANCH_DOWN -1
using namespace std;
const int james=533;
//---------------------------------------//
// Definition des structures specifiques //
//---------------------------------------//
typedef IloArray<IloIntArray> IloIntArray1; // matrice de reels
typedef IloArray<IloNumArray> IloNumArray1; // matrice de variables reelles
typedef IloArray<IloNumVarArray> IloNumVarArray1;
int main( )
{
int F;
while(F==1){
//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::://
// //
// CONSTRUCTION DU MODELE //
// //
//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::://
try {
IloModel model(env);
IloRangeArray con(env);
IloCplex cplex(model);
IloObjective obj;
IloNumVarArray X(env,Nb_Vertex, 0, 1,ILOFLOAT);
IloNumVarArray Y(env,Nb_Vertex, 0, 1,ILOFLOAT);
IloInt n ,k,alpha; // eventuellement les valeurs de a, b et c sont solutions d'un CSP
// ou sont entrees en ligne par l'utilisateur
n =Nb_Vertex;
// les boucles commencent.... tatiiiinnnnn.... //
IloExpr CardA(env);
IloExpr CardB(env);
IloExpr CardA1(env);
IloExpr CardB1(env);
IloExpr Obj(env);
for (i = 0; i< Nb_Vertex; i++ ){
IloRange con1=(X[i]+Y[i] <=1);
model.add(con1);
model.add(X[i]);
CardA += X[i];
model.add(Y[i] );
CardB += Y[i];
Obj +=(X[i]+Y[i]);
// Construction des sommes pour la contrainte 6 et pour l'objectif //
for (j = 0; j < Nb_Vertex; j++ )
{
if ( ADJACENCE[i][j] )
{
IloRange con1=(X[i]+Y[j]<=1);
model.add(con1);
IloRange con2=(Y[i]+X[j]<=1);
model.add(con2);
} // FIN for if
} // FIN for j
} // FIN for i
IloRange con3=(CardA>=3);
model.add(con3);
IloRange con4=(CardB<=James);
model.add(con4);
IloRange con5=(CardA+CardB <=n-alpha_min);
model.add(con5);
IloRange con6=(CardA+CardB >=James+3);
model.add(con6);
IloRange con7=(CardA <=ceil((n-alpha_min)/2));
model.add(con7);
IloRange con8=(CardA <=James);
model.add(con8);
//**************************//
// OBJECTIF //
//**************************//
model.add(IloMaximize(env, Obj));
//***** conditon of cut*****************//
if (F1==1){
for(int i=0;i<=James;i++){
CardA1 +=X[V1[i]];
CardB1 +=Y[V1[i]];
//cout<<" "<<V1[i];
}
IloInt R=V1.size();
IloRange con9=(CardA1+CardB1 <= James);
model.add(con9);
V1.clear();
}
cplex.exportModel("graphe.lp");
// sera illisible si on ne nomme pas les variables
cplex.setOut(logfile);
cplex.setWarning(logfile);
cplex.setError(logfile);
cplex.setParam(IloCplex::MIPInterval, 1000);//Controls the frequency of node logging when MIPDISPLAY is set higher than 1.
cplex.setParam(IloCplex::MIPDisplay, 2);//MIP node log display information-No display until optimal solution has been found
//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::://
// //
// RESOLUTION //
// //
//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::://
cplex.setParam(IloCplex::EpGap, 0.01);
cplex.setParam(IloCplex::WorkMem,3000.0);
cplex.setOut(logfile);
cplex.setWarning(logfile);
cplex.solve();
cplex.getParam(IloCplex::Param::Simplex::Tolerances::Feasibility);
cplex.setParam(IloCplex::Param::MIP::Strategy::Search,IloCplex::Traditional);
( IloCplex::BranchUp, cplex.getObjValue()); // variable >= 1
logfile << endl << "CardB: " << cplex.getValue(CardB) << endl;
logfile << endl << "CardC: " << Nb_Vertex- cplex.getValue(CardB+CardA) << endl;*/
logfile << endl << "Optimal value: " << cplex.getObjValue() << endl;
logfile<< "Number of B&B nodes: " <<cplex.getNnodes() << endl;
logfile<< " Faisabilite du probleme = " << cplex.getStatus() << endl; // statut du pb (realisabilite)
// logfile << " Valeur de l'objectif = " << cplex.getObjValue() << endl;
// logfile << "#############################################################################################################" <<endl;
//--------------------------
// definition d'une matrice reelle pour recuperer les valeurs des variables si necessaire
int max1=0, xcoun=0;
for(int j=0;j<Nb_Vertex;j++){
if(cplex.getValue(X[j]+Y[j]==1) ){
V1.push_back(j);
++max1;
if(cplex.getValue(X[j]==1) ||(cplex.getValue(X[j]==0) ) )
++xcoun;
}
}
if(max1>James){
F1=1;
F=1;
}
else
F=2;
++mm;
resultat<< " No. of cut is "<<mm<<endl;
resultat<<" V1.size is "<<V1.size()<<endl;
cout<<" V1.size is "<<V1.size()<<endl;
//resultat<<"******************************************************************************************"<<endl;
env.out() << "Objectif = " << cplex.getObjValue() << endl; // Valeur de l'OBJECTIF
cout<<mm<<endl;
cplex.end();
model.end();
}//end try
catch (IloException& e)
{
resultat << "Concert exception caught: " << e << endl;
}
catch (...)
{
resultat << "Unknown exception caught" << endl;
}
} //end for
// cout<<CS;
env.end();
cout<<"input number"<<endl;
cin>>p;
} // end creatLP
thankscplexaddbranchconstraintMon, 18 Apr 2016 10:57:26 GMThaederHow do I add a "constraint" to the "Group Management" view of the BPM Process Admin Console?
https://developer.ibm.com/answers/questions/191172/how-do-i-add-a-constraint-to-the-group-management.html
Before BPM 8.5.x the way to add/remove constraints for the various views in the BPM Process Admin Console was to manually edit the console.xml file
From BPM 8.5.x forward, many of the BPM configuration properties have migrated to WCCM and are supposed to be managed by wsadmin AdminTask commands.
This BPM Knowledge Center Article provides the basic information:
[Security configuration properties](http://www-01.ibm.com/support/knowledgecenter/SSFPJS_8.5.5/com.ibm.wbpm.imuc.stbpm.doc/topics/csec_config_properties.html)
but the examples were not helpful enough to allow me to accomplish my goalbpmwsadminprocess_admin_consoleconstraintWed, 13 May 2015 20:54:54 GMTBrad KonopikORA-00001 unique constraint (BPMDBPS_ADMIN.LSWC_LOCK) violated
https://developer.ibm.com/answers/questions/187533/ora-00001-unique-constraint-bpmdbps-adminlswc-lock.html
I have this exception lot of times.
CWLLG2229E: An exception occurred in an EJB call. Error: PreparedStatementCallback; SQL [INSERT INTO LSW_LOCK (LOCK_ID, DESCRIPTION) VALUES (?,?)]; ORA-00001: unique constraint (BPMDBPS_ADMIN.LSWC_LOCK) violated
; nested exception is com.ibm.websphere.ce.cm.DuplicateKeyException: ORA-00001: unique constraint (BPMDBPS_ADMIN.LSWC_LOCK) violatedconstraintcwllg2229euniquelsw_lockora-00001violatedlock_idTue, 21 Apr 2015 22:38:45 GMTYan Fang