solving problem without satisfying constraint

已查看 86 次
跳至第一个未读帖子

mahraz amini

未读,
2017年12月10日 18:29:402017/12/10
收件人 AMPL Modeling Language
Hi 

is it possible that AMPL gives the message of finding optimal solution while not satisfying the constraint? I am trying to solve a problem via AMPL in MATLAB. I am seeing that AMPL finds the optimal solution but clearly some of the constraint are not satisfied. 

This is one of the constraint that I have : 

subject to p_inj {k in BUS , p in Time : bus_type[k] == 2 || bus_type[k] ==3}:

   0 <= bus_p_inj[k,p]  <= bus_p_gen_max[k] ;


at the end of solving problem I checked some variables and constraint


ampl.display('bus_p_inj;')

ampl.eval('expand p_inj;')



The results that I got are as follows:

bus_p_inj [34,*]
:       1         2         3         4       :=

34   5.08048   5.08      5.08      5.08


subject to p_inj[34,1]:
0 <= bus_p_inj[34,1] <= 5.08;

subject to p_inj[34,2]:
0 <= bus_p_inj[34,2] <= 5.08;

subject to p_inj[34,3]:
0 <= bus_p_inj[34,3] <= 5.08;

subject to p_inj[34,4]:
0 <= bus_p_inj[34,4] <= 5.08;

as you can see constraint p_inj[34,1] is not satisfied. I tried it with two different solver, IPOPT and GUROBI and both of them give me the exact same answer. 

I know by provided details it is hard to say what exactly goes on in the system, but I wonder if you have any guess?

I attached the ampl file that I wrote. also I should mention that I run this file over different parameters, for some of them all the constraints are satisfied but for some other constraint p_inj[34,1] is not satisfied.


Thanks,

Mahraz
amplFile.rtf

Robert Fourer

未读,
2017年12月14日 03:18:302017/12/14
收件人 am...@googlegroups.com
First, check the built-in parameter solve_result to see that it has the value "solved"; for more information, check the built-in variable "solve_message" to see that it mentions that an optimal solution has been found. If solve_result is instead "infeasible" then no solution to your constraints is possible, and the solver may return a solution that does not satisfy the constraints.

If it checks out that the solver claims to have returned an optimal solution, then to get more help, reply with the name of the solver that you are using, and also copy into your reply any messages from the solver that you have seen.

Bob Fourer
am...@googlegroups.com

=======

mahraz amini

未读,
2017年12月14日 14:48:522017/12/14
收件人 AMPL Modeling Language
Hi Bob

Thanks for your response. "solve_message" and "solve_result" were the first things that I checked before posting the question. Strangely it seems the optimal solution is found and at the same time one of the constraint is not satisfied. 

I checked this with two different solver : IPOPT and GUROBI and both of them have found exact same solution while solve_message indicating finding the optimal solution. 

I made a quick test including 3 MATLAB files ( 1 main file which calls 1 function ( linking to AMPL) and 1 data file ) and 2 AMPL files ( 1 .mod and 1 .dat ). if you run the main file names amp_test2.m you can will see that bus_p_inj[34,1] would not be within its limit. ( look at constraint p_inj[34,1] )

Thanks,

Mahraz
test.zip

Filipe Brandão

未读,
2018年1月18日 13:45:062018/1/18
收件人 AMPL Modeling Language
By analyzing the example you provided we found out that the constraint p_inj has been substituted out during the presolve phase. While we are investigating why this substitution is leading the invalid solutions, please set the option presolve to 0 before ampl.solve() with:
ampl.setOption('presolve', '0');

Best regards,
Filipe

mahraz amini

未读,
2018年4月12日 08:23:212018/4/12
收件人 AMPL Modeling Language
Hi Filipe. 

I wonder  if you understand what caused that issue. 

will using ampl.setOption('preserve','0') solve this problem? and generally, do you recommend to use this command all the time or only for this specific case?

Thanks,

Mahraz

AMPL Google Group

未读,
2018年4月12日 14:56:102018/4/12
收件人 Zeyad Kassem' Via Ampl Modeling Language
We still haven't figured out what caused this issue in particular. By disabling presolve you are passing the model directly to the solver without any preprocessing made by AMPL. Nevertheless, the solver usually preforms some presolving which may result in a similar issue and may be necessary to disable it as well by setting a solver option.

Regarding your second question, presolving should be used unless some issue like this one arises. It can result in substantial performance improvements and therefore should be used when possible.

Best regards,
Filipe

--
Filipe Brandão
am...@googlegroups.com
{#HS:559800129-5040#}
--
You received this message because you are subscribed to the Google Groups "AMPL Modeling Language" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ampl+uns...@googlegroups.com.
To post to this group, send email to am...@googlegroups.com.
Visit this group at https://groups.google.com/group/ampl.
For more options, visit https://groups.google.com/d/optout.



回复全部
回复作者
转发
0 个新帖子